--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ id="svg2"
+ xml:space="preserve"
+ viewBox="0 0 64 64"
+ version="1.1"
+ inkscape:version="0.48.5 r10040"
+ width="100%"
+ height="100%"
+ sodipodi:docname="logout.svg"><defs
+ id="defs8" /><sodipodi:namedview
+ pagecolor="#666666"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1077"
+ inkscape:window-height="782"
+ id="namedview6"
+ showgrid="false"
+ inkscape:zoom="5.1943359"
+ inkscape:cx="24.357877"
+ inkscape:cy="26.948648"
+ inkscape:window-x="258"
+ inkscape:window-y="33"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2" /><metadata
+ id="metadata8"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><path
+ sodipodi:nodetypes="ssccccccsccccc"
+ style="fill:#3498db;fill-opacity:1"
+ id="path3"
+ d="m 21.267338,42.732446 c 3.741665,3.741354 9.807034,3.741354 13.548699,0 2.776803,-2.77657 3.490747,-6.8354 2.144089,-10.273324 l 5.763494,-5.763661 c 1.49694,-1.496847 1.496489,-3.922567 0,-5.419481 -1.496034,-1.496525 -3.922182,-1.496525 -5.419118,0 l -5.763946,5.764034 c -3.437493,-1.346908 -7.495965,-0.633431 -10.27367,2.144832 -3.740312,3.740676 -3.740765,9.806754 4.52e-4,13.5476 z m 6.435428,-6.434662 c 0.898073,0.897093 0.898073,2.353493 0,3.2516 -0.897621,0.897939 -2.35394,0.897939 -3.251561,0 -0.89717,-0.898107 -0.89717,-2.354507 0,-3.2516 0.897621,-0.898107 2.353489,-0.898107 3.251561,0 z"
+ inkscape:connector-curvature="0" /><path
+ sodipodi:type="arc"
+ style="fill:none;stroke:#3498db;stroke-width:1.80392128;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="path4097"
+ sodipodi:cx="16"
+ sodipodi:cy="16.5"
+ sodipodi:rx="14"
+ sodipodi:ry="12.5"
+ d="m 30,16.5 a 14,12.5 0 1 1 -28,0 14,12.5 0 1 1 28,0 z"
+ transform="matrix(1.5714286,0,0,1.7600001,6.8571426,2.9599978)" /></svg>
\ No newline at end of file
showPopupMessage(message, 'error');
}
+function doLogout() {
+ $.ajax({
+ url: '/',
+ username: ' ',
+ password: 'logout' + new Date().getTime(),
+ complete: function () {
+ window.location.href = '/?logout=true';
+ }
+ });
+
+ /* IE is always a breed apart */
+ if (document.execCommand) {
+ try {
+ document.execCommand('ClearAuthenticationCache');
+ }
+ catch (e) {
+ }
+
+ window.location.href = '/?logout=true';
+ }
+}
+
Object.keys = Object.keys || (function () {
var hasOwnProperty = Object.prototype.hasOwnProperty;
var hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString');
});
/* fetch & push handlers */
- $('#videoDeviceSelect').focus(function () {
+ $('#cameraSelect').focus(function () {
/* remember the previously selected index */
this._prevSelectedIndex = this.selectedIndex;
}).change(function () {
- if ($('#videoDeviceSelect').val() === 'add') {
+ if ($('#cameraSelect').val() === 'add') {
runAddCameraDialog();
this.selectedIndex = this._prevSelectedIndex;
}
/* remove camera button */
$('div.button.rem-camera-button').click(doRemCamera);
+
+ /* logout button */
+ $('div.button.logout-button').click(doLogout);
}
function openSettings(cameraId) {
if (cameraId != null) {
- $('#videoDeviceSelect').val(cameraId).change();
+ $('#cameraSelect').val(cameraId).change();
}
$('div.settings').addClass('open').removeClass('closed');
}
function updateConfigUi() {
- var objs = $('tr.settings-item, div.advanced-setting, table.advanced-setting, div.settings-section-title, table.settings').not('.rpi');
+ var objs = $('tr.settings-item, div.advanced-setting, table.advanced-setting, div.settings-section-title, table.settings');
function markHide() {
this._hide = true;
$('#wifiSwitch').parent().next('table.settings').find('tr.settings-item').each(markHide);
}
- if ($('#videoDeviceSelect').find('option').length < 2) { /* no camera configured */
+ if ($('#cameraSelect').find('option').length < 2) { /* no camera configured */
$('#videoDeviceSwitch').parent().each(markHide);
$('#videoDeviceSwitch').parent().nextAll('div.settings-section-title, table.settings').each(markHide);
}
});
/* select the first option for the selects with no current selection */
- $('div.settings').find('select').each(function () {
+ $('div.settings').find('select').not('#cameraSelect').each(function () {
if (this.selectedIndex === -1) {
this.selectedIndex = 0;
}
Object.keys(pushConfigs).forEach(function (key) {
var config = pushConfigs[key];
if (config.key !== 'main') {
- $('#videoDeviceSelect').find('option[value=' + key + ']').html(config.name);
+ $('#cameraSelect').find('option[value=' + key + ']').html(config.name);
}
$('#camera' + key).find('span.camera-name').html(config.name);
return runAlertDialog('Please apply the modified settings first!');
}
- var cameraId = $('#videoDeviceSelect').val();
+ var cameraId = $('#cameraSelect').val();
if (cameraId == null || cameraId === 'add') {
runAlertDialog('No camera to remove!');
return;
}
- var deviceName = $('#videoDeviceSelect').find('option[value=' + cameraId + ']').text();
+ var deviceName = $('#cameraSelect').find('option[value=' + cameraId + ']').text();
runConfirmDialog('Remove camera ' + deviceName + '?', function () {
/* disable further refreshing of this camera */
var i, cameras = data.cameras;
if (user === 'admin') {
- var videoDeviceSelect = $('#videoDeviceSelect');
- videoDeviceSelect.html('');
+ var cameraSelect = $('#cameraSelect');
+ cameraSelect.html('');
for (i = 0; i < cameras.length; i++) {
var camera = cameras[i];
- videoDeviceSelect.append('<option value="' + camera['id'] + '">' + camera['name'] + '</option>');
+ cameraSelect.append('<option value="' + camera['id'] + '">' + camera['name'] + '</option>');
}
- videoDeviceSelect.append('<option value="add">add camera...</option>');
+ cameraSelect.append('<option value="add">add camera...</option>');
var enabledCameras = cameras.filter(function (camera) {return camera['enabled'];});
if (enabledCameras.length > 0) { /* prefer the first enabled camera */
- videoDeviceSelect[0].selectedIndex = cameras.indexOf(enabledCameras[0]);
+ cameraSelect[0].selectedIndex = cameras.indexOf(enabledCameras[0]);
fetchCurrentCameraConfig();
}
else if (cameras.length) { /* a disabled camera */
- videoDeviceSelect[0].selectedIndex = 0;
+ cameraSelect[0].selectedIndex = 0;
fetchCurrentCameraConfig();
}
else { /* no camera at all */
- videoDeviceSelect[0].selectedIndex = -1;
+ cameraSelect[0].selectedIndex = -1;
}
updateConfigUi();
}
function fetchCurrentCameraConfig(onFetch) {
- var cameraId = $('#videoDeviceSelect').val();
+ var cameraId = $('#cameraSelect').val();
if (cameraId != null) {
ajax('GET', '/config/' + cameraId + '/get/', null, function (data) {
if (data == null || data.error) {
function pushCameraConfig() {
var cameraConfig = cameraUi2Dict();
- var cameraId = $('#videoDeviceSelect').val();
+ var cameraId = $('#cameraSelect').val();
pushConfigs[cameraId] = cameraConfig;
if (!isApplyVisible()) {
}
function pushPreview(control) {
- var cameraId = $('#videoDeviceSelect').val();
+ var cameraId = $('#cameraSelect').val();
var brightness = $('#brightnessSlider').val();
var contrast= $('#contrastSlider').val();
'</tr>' +
'<tr class="motioneye netcam">' +
'<td class="dialog-item-label"><span class="dialog-item-label">Camera</span></td>' +
- '<td class="dialog-item-value"><select class="styled" id="cameraSelect"></select><span id="cameraMsgLabel"></span></td>' +
+ '<td class="dialog-item-value"><select class="styled" id="addCameraSelect"></select><span id="cameraMsgLabel"></span></td>' +
'<td><span class="help-mark" title="the camera you wish to add to motionEye">?</span></td>' +
'</tr>' +
'</table>');
var urlEntry = content.find('#urlEntry');
var usernameEntry = content.find('#usernameEntry');
var passwordEntry = content.find('#passwordEntry');
- var cameraSelect = content.find('#cameraSelect');
+ var addCameraSelect = content.find('#addCameraSelect');
var cameraMsgLabel = content.find('#cameraMsgLabel');
/* make validators */
makeUrlValidator(urlEntry, true);
makeTextValidator(usernameEntry, false);
makeTextValidator(deviceSelect, false);
- makeComboValidator(cameraSelect, true);
+ makeComboValidator(addCameraSelect, true);
/* ui interaction */
content.find('tr.motioneye, tr.netcam').css('display', 'none');
content.find('tr.motioneye, tr.netcam').css('display', 'none');
if (deviceSelect.val() == 'motioneye') {
content.find('tr.motioneye').css('display', 'table-row');
- cameraSelect.hide();
+ addCameraSelect.hide();
}
else if (deviceSelect.val() == 'netcam') {
content.find('tr.netcam').css('display', 'table-row');
- cameraSelect.hide();
+ addCameraSelect.hide();
}
updateModalDialogPosition();
- cameraSelect.html('');
+ addCameraSelect.html('');
/* re-validate all the validators */
content.find('.validator').each(function () {
var valid = true;
var query = content.find('input, select');
if (!includeCameraSelect) {
- query = query.not('#cameraSelect');
+ query = query.not('#addCameraSelect');
}
query.each(function () {
if (this.invalid) {
function fetchRemoteCameras() {
var progress = $('<div style="text-align: center; margin: 2px;"><img src="' + staticUrl + 'img/small-progress.gif"></div>');
- cameraSelect.hide();
- cameraSelect.parent().find('div').remove(); /* remove any previous progress div */
- cameraSelect.before(progress);
+ addCameraSelect.hide();
+ addCameraSelect.parent().find('div').remove(); /* remove any previous progress div */
+ addCameraSelect.before(progress);
var data = splitUrl(urlEntry.val());
data.username = usernameEntry.val();
return;
}
- cameraSelect.html('');
+ addCameraSelect.html('');
if (data.error || !data.cameras) {
return;
}
data.cameras.forEach(function (info) {
- cameraSelect.append('<option value="' + info.id + '">' + info.name + '</option>');
+ addCameraSelect.append('<option value="' + info.id + '">' + info.name + '</option>');
});
- cameraSelect.show();
+ addCameraSelect.show();
});
}
data.proto = 'motioneye';
data.username = usernameEntry.val();
data.password = passwordEntry.val();
- data.remote_camera_id = cameraSelect.val();
+ data.remote_camera_id = addCameraSelect.val();
}
else if (deviceSelect.val() == 'netcam') {
data = splitUrl(urlEntry.val());
}
endProgress();
- var addCameraOption = $('#videoDeviceSelect').find('option[value=add]');
+ var addCameraOption = $('#addCameraSelect').find('option[value=add]');
addCameraOption.before('<option value="' + data.id + '">' + data.name + '</option>');
- $('#videoDeviceSelect').val(data.id).change();
+ $('#addCameraSelect').val(data.id).change();
recreateCameraFrames();
});
}
addCameraFrameUi(camera);
}
- if ($('#videoDeviceSelect').find('option').length < 2 && user === 'admin' && $('#motionEyeSwitch')[0].checked) {
+ if ($('#cameraSelect').find('option').length < 2 && user === 'admin' && $('#motionEyeSwitch')[0].checked) {
/* invite the user to add a camera */
var addCameraLink = $('<div class="add-camera-message">' +
'<a href="javascript:runAddCameraDialog()">You have not configured any camera yet. Click here to add one...</a></div>');