Commit 12f5db02 authored by Xavier Guimard's avatar Xavier Guimard

`make tidy-js`

parent 909ca176
......@@ -155,4 +155,4 @@
"timeout": 72000,
"userDB": "Demo",
"whatToTrace": "_whatToTrace"
}
}
\ No newline at end of file
$(document).ready(function() {
// Adapt some class to fit Bootstrap theme
$("div.message-positive").addClass("alert-success");
$("div.message-warning").addClass("alert-warning");
$("div.message-negative").addClass("alert-danger");
// Adapt some class to fit Bootstrap theme
$("div.message-positive").addClass("alert-success");
$("div.message-warning").addClass("alert-warning");
$("div.message-negative").addClass("alert-danger");
$("table.info").addClass("table");
$("table.info").addClass("table");
$(".notifCheck").addClass("checkbox");
$(".notifCheck").addClass("checkbox");
// Collapse menu on click
$('.nav a').on('click', function() {
if ($('.navbar-toggle').css('display') != 'none') {
$(".navbar-toggle").trigger("click");
}
});
// Collapse menu on click
$('.nav a').on('click', function() {
if ($('.navbar-toggle').css('display') != 'none') {
$(".navbar-toggle").trigger("click");
}
});
});
});
\ No newline at end of file
/* Watch login and logout events */
navigator.id.watch({
loggedInUser: null,
onlogin: function(assertion) {
// POST assertion
$('form.BrowserID').append('<input type="hidden" name="browserIdAssertion" value="' + assertion + '" />').submit();
},
onlogout: function() {
// Do nothing
}
});
loggedInUser: null,
onlogin: function(assertion) {
// POST assertion
$('form.BrowserID').append('<input type="hidden" name="browserIdAssertion" value="' + assertion + '" />').submit();
},
onlogout: function() {
// Do nothing
}
});
\ No newline at end of file
$(document).ready(function() {
// Manage auto login
if (browserIdAutoLogin.match('1')) {
launchRequest();
}
// Manage auto login
if (browserIdAutoLogin.match('1')) {
launchRequest();
}
// Intercept submit the first time
var intercepted = 0;
$("form.BrowserID").submit(function(event) {
if (!intercepted) {
event.preventDefault();
intercepted = 1;
launchRequest();
}
});
// Intercept submit the first time
var intercepted = 0;
$("form.BrowserID").submit(function(event) {
if (!intercepted) {
event.preventDefault();
intercepted = 1;
launchRequest();
}
});
});
function launchRequest() {
navigator.id.request({
siteName: browserIdSiteName,
siteLogo: browserIdSiteLogo,
backgroundColor: browserIdBackgroundColor
});
}
navigator.id.request({
siteName: browserIdSiteName,
siteLogo: browserIdSiteLogo,
backgroundColor: browserIdBackgroundColor
});
}
\ No newline at end of file
$(document).ready(function() {
navigator.id.logout();
});
navigator.id.logout();
});
\ No newline at end of file
......@@ -3,20 +3,20 @@
var i = 5;
function go() {
$("#form").submit();
$("#form").submit();
}
function timer() {
var h = $('#timer').html();
if (i > 0) {
i--;
}
h = h.replace(/\d+/, i);
$('#timer').html(h);
window.setTimeout('timer()', 1000);
var h = $('#timer').html();
if (i > 0) {
i--;
}
h = h.replace(/\d+/, i);
$('#timer').html(h);
window.setTimeout('timer()', 1000);
}
$(document).ready(function() {
window.setTimeout('go()', 5000);
window.setTimeout('timer()', 1000);
});
window.setTimeout('go()', 5000);
window.setTimeout('timer()', 1000);
});
\ No newline at end of file
......@@ -12,108 +12,108 @@
/* Set newwindow value (default is false) */
if (newwindow.match('1')) {
newwindow = true;
newwindow = true;
} else {
newwindow = false;
newwindow = false;
}
/* Set antiframe value (default is true) */
if (antiframe.match('0')) {
antiframe = false;
antiframe = false;
} else {
antiframe = true;
antiframe = true;
}
/* Set activeTimer value (default is true) */
if (activeTimer.match('0')) {
activeTimer = false;
activeTimer = false;
} else {
activeTimer = true;
activeTimer = true;
}
/* jQuery */
$(document).ready(function() {
/* AntiFrame script */
if (antiframe && top != self) {
top.location.href = location.href;
}
/* Sortable menu */
$("#appslist").sortable({
axis: "y",
cursor: "move",
opacity: 0.5,
revert: true,
items: "> div.category",
update: function() {
getOrder();
}
});
restoreOrder();
/* Display message */
$("div.message").fadeIn('slow');
/* Set timezone */
$("input[name=timezone]").val(-(new Date().getTimezoneOffset() / 60));
/* Menu tabs */
var menuTabs = $("#menu").tabs({
active: 0
});
var menuIndex = $('#menu a[href="#' + displaytab + '"]').parent().index();
if (menuIndex < 0) {
menuIndex = 0;
}
menuTabs.tabs("option", "active", menuIndex);
/* Authentication choice tabs */
var authMenuTabs = $("#authMenu").tabs({
active: 0
});
// TODO: cookie
//$("#authMenu").tabs({cookie: {name: 'lemonldapauthchoice'}});
if (choicetab) {
var authMenuIndex = $('#authMenu a[href="#' + choicetab + '"]').parent().index();
authMenuTabs.tabs("option", "active", authMenuIndex);
}
/* Focus on first visible input */
$("input[type!=hidden]:first").focus();
if (login) {
$("input[type=password]:first").focus();
}
/* Open links in new windows */
if (newwindow) {
$('#appslist a').attr("target", "_blank");
}
/* Complete removeOther link */
if ($("p.removeOther").length) {
var action = $("form.login").attr("action");
var method = $("form.login").attr("method");
var back_url = "";
if (action.indexOf("?") != -1) {
back_url = action.substring(0, action.indexOf("?")) + "?";
} else {
back_url = action + "?";
}
$("form.login input[type=hidden]").each(function(index) {
back_url = back_url + "&" + $(this).attr("name") + "=" + $(this).val();
});
var link = $("p.removeOther a").attr("href");
link = link + "&method=" + method + "&url=" + $.base64Encode(back_url);
$("p.removeOther a").attr("href", link);
}
/* AntiFrame script */
if (antiframe && top != self) {
top.location.href = location.href;
}
/* Sortable menu */
$("#appslist").sortable({
axis: "y",
cursor: "move",
opacity: 0.5,
revert: true,
items: "> div.category",
update: function() {
getOrder();
}
});
restoreOrder();
/* Display message */
$("div.message").fadeIn('slow');
/* Set timezone */
$("input[name=timezone]").val(-(new Date().getTimezoneOffset() / 60));
/* Menu tabs */
var menuTabs = $("#menu").tabs({
active: 0
});
var menuIndex = $('#menu a[href="#' + displaytab + '"]').parent().index();
if (menuIndex < 0) {
menuIndex = 0;
}
menuTabs.tabs("option", "active", menuIndex);
/* Authentication choice tabs */
var authMenuTabs = $("#authMenu").tabs({
active: 0
});
// TODO: cookie
//$("#authMenu").tabs({cookie: {name: 'lemonldapauthchoice'}});
if (choicetab) {
var authMenuIndex = $('#authMenu a[href="#' + choicetab + '"]').parent().index();
authMenuTabs.tabs("option", "active", authMenuIndex);
}
/* Focus on first visible input */
$("input[type!=hidden]:first").focus();
if (login) {
$("input[type=password]:first").focus();
}
/* Open links in new windows */
if (newwindow) {
$('#appslist a').attr("target", "_blank");
}
/* Complete removeOther link */
if ($("p.removeOther").length) {
var action = $("form.login").attr("action");
var method = $("form.login").attr("method");
var back_url = "";
if (action.indexOf("?") != -1) {
back_url = action.substring(0, action.indexOf("?")) + "?";
} else {
back_url = action + "?";
}
$("form.login input[type=hidden]").each(function(index) {
back_url = back_url + "&" + $(this).attr("name") + "=" + $(this).val();
});
var link = $("p.removeOther a").attr("href");
link = link + "&method=" + method + "&url=" + $.base64Encode(back_url);
$("p.removeOther a").attr("href", link);
}
});
/* Code from http://snipplr.com/view/29434/ */
......@@ -121,64 +121,64 @@ $(document).ready(function() {
var setSelector = "#appslist";
// function that writes the list order to session
function getOrder() {
// save custom order to persistent session
$.ajax({
type: "POST",
url: scriptname,
data: {
storeAppsListOrder: $(setSelector).sortable("toArray").join()
},
dataType: 'json'
});
// save custom order to persistent session
$.ajax({
type: "POST",
url: scriptname,
data: {
storeAppsListOrder: $(setSelector).sortable("toArray").join()
},
dataType: 'json'
});
}
// function that restores the list order from session
function restoreOrder() {
var list = $(setSelector);
if (list == null) return;
var list = $(setSelector);
if (list == null) return;
// fetch the session value (saved order)
if (!appslistorder) return;
// fetch the session value (saved order)
if (!appslistorder) return;
// make array from saved order
var IDs = appslistorder.split(",");
// make array from saved order
var IDs = appslistorder.split(",");
// fetch current order
var items = list.sortable("toArray");
// fetch current order
var items = list.sortable("toArray");
// make array from current order
var rebuild = new Array();
for (var v = 0, len = items.length; v < len; v++) {
rebuild[items[v]] = items[v];
}
// make array from current order
var rebuild = new Array();
for (var v = 0, len = items.length; v < len; v++) {
rebuild[items[v]] = items[v];
}
for (var i = 0, n = IDs.length; i < n; i++) {
for (var i = 0, n = IDs.length; i < n; i++) {
// item id from saved order
var itemID = IDs[i];
// item id from saved order
var itemID = IDs[i];
if (itemID in rebuild) {
if (itemID in rebuild) {
// select item id from current order
var item = rebuild[itemID];
// select item id from current order
var item = rebuild[itemID];
// select the item according to current order
var child = $(setSelector + ".ui-sortable").children("#" + item);
// select the item according to current order
var child = $(setSelector + ".ui-sortable").children("#" + item);
// select the item according to the saved order
var savedOrd = $(setSelector + ".ui-sortable").children("#" + itemID);
// select the item according to the saved order
var savedOrd = $(setSelector + ".ui-sortable").children("#" + itemID);
// remove all the items
child.remove();
// remove all the items
child.remove();
// add the items in turn according to saved order
// we need to filter here since the "ui-sortable"
// class is applied to all ul elements and we
// only want the very first! You can modify this
// to support multiple lists - not tested!
$(setSelector + ".ui-sortable").filter(":first").append(savedOrd);
}
}
// add the items in turn according to saved order
// we need to filter here since the "ui-sortable"
// class is applied to all ul elements and we
// only want the very first! You can modify this
// to support multiple lists - not tested!
$(setSelector + ".ui-sortable").filter(":first").append(savedOrd);
}
}
}
/* function boolean isHiddenFormValueSet(string option)
......@@ -187,11 +187,11 @@ function restoreOrder() {
* @return true if option is set, false else
*/
function isHiddenFormValueSet(option) {
if ($('#lmhidden_' + option).length) {
return true;
} else {
return false;
}
if ($('#lmhidden_' + option).length) {
return true;
} else {
return false;
}
}
/* function void ping()
......@@ -199,20 +199,20 @@ function isHiddenFormValueSet(option) {
* @return nothing
*/
function ping() {
$.ajax({
type: "POST",
url: scriptname,
data: {
ping: 1
},
dataType: 'json',
success: function(data) {
if (!data.auth) {
location.reload(true);
}
else {
setTimeout('ping();', pingInterval);
}
}
});
}
$.ajax({
type: "POST",
url: scriptname,
data: {
ping: 1
},
dataType: 'json',
success: function(data) {
if (!data.auth) {
location.reload(true);
}
else {
setTimeout('ping();', pingInterval);
}
}
});
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment