make tidy-js

This commit is contained in:
Xavier Guimard 2016-01-21 11:36:23 +00:00
parent 909ca1765e
commit 12f5db02bb
8 changed files with 946 additions and 1010 deletions

View File

@ -155,4 +155,4 @@
"timeout": 72000,
"userDB": "Demo",
"whatToTrace": "_whatToTrace"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,19 @@
$(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");
}
});
});
});

View File

@ -1,12 +1,12 @@
/* 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
}
});

View File

@ -1,26 +1,26 @@
$(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
});
}

View File

@ -1,3 +1,3 @@
$(document).ready(function() {
navigator.id.logout();
});
navigator.id.logout();
});

View 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);
});

View 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;
}
/* 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();
}
});
/* Sortable menu */
$("#appslist").sortable({
axis: "y",
cursor: "move",
opacity: 0.5,
revert: true,
items: "> div.category",
update: function() {
getOrder();
}
});
restoreOrder();
restoreOrder();
/* Display message */
$("div.message").fadeIn('slow');
/* Display message */
$("div.message").fadeIn('slow');
/* Set timezone */
$("input[name=timezone]").val(-(new Date().getTimezoneOffset() / 60));
/* 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);
/* 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);
}
/* 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();
}
/* 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");
}
/* 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");
/* 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 + "?";
}
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();
});
$("form.login input[type=hidden]").each(function(index) {
back_url = back_url + "&" + $(this).attr("name") + "=" + $(this).val();
});
var link = $("p.removeOther a").attr("href");
var link = $("p.removeOther a").attr("href");
link = link + "&method=" + method + "&url=" + $.base64Encode(back_url);
link = link + "&method=" + method + "&url=" + $.base64Encode(back_url);
$("p.removeOther a").attr("href", link);
$("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);
}
}
});
}