--- a/src/pyams_skin/resources/js/myams.js Fri Oct 12 15:02:10 2018 +0200
+++ b/src/pyams_skin/resources/js/myams.js Wed Oct 17 11:14:10 2018 +0200
@@ -12,32 +12,32 @@
"use strict";
-(function($, globals) {
+(function ($, globals) {
var console = globals.console;
/**
* String prototype extensions
*/
- String.prototype.startsWith = function(str) {
+ String.prototype.startsWith = function (str) {
var slen = this.length,
dlen = str.length;
if (slen < dlen) {
return false;
}
- return (this.substr(0,dlen) === str);
+ return (this.substr(0, dlen) === str);
};
- String.prototype.endsWith = function(str) {
+ String.prototype.endsWith = function (str) {
var slen = this.length,
dlen = str.length;
if (slen < dlen) {
return false;
}
- return (this.substr(slen-dlen) === str);
+ return (this.substr(slen - dlen) === str);
};
- String.prototype.unserialize = function(str) {
+ String.prototype.unserialize = function (str) {
var str = decodeURIComponent(this);
var chunks = str.split('&'),
obj = {};
@@ -52,7 +52,7 @@
* Array prototype extensions
*/
if (!Array.prototype.indexOf) {
- Array.prototype.indexOf = function(elt, from) {
+ Array.prototype.indexOf = function (elt, from) {
var len = this.length;
from = Number(from) || 0;
@@ -75,7 +75,7 @@
* JQuery 'hasvalue' expression
* Filter inputs containing value
*/
- $.expr[":"].hasvalue = function(obj, index, meta /*, stack*/) {
+ $.expr[":"].hasvalue = function (obj, index, meta /*, stack*/) {
return $(obj).val() !== "";
};
@@ -84,7 +84,7 @@
* JQuery 'econtains' expression
* Case insensitive contains expression
*/
- $.expr[":"].econtains = function(obj, index, meta /*, stack*/) {
+ $.expr[":"].econtains = function (obj, index, meta /*, stack*/) {
return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() === meta[3].toLowerCase();
};
@@ -93,7 +93,7 @@
* JQuery 'withtext' expression
* Case sensitive exact search expression
*/
- $.expr[":"].withtext = function(obj, index, meta /*, stack*/) {
+ $.expr[":"].withtext = function (obj, index, meta /*, stack*/) {
return (obj.textContent || obj.innerText || $(obj).text() || "") === meta[3];
};
@@ -108,7 +108,7 @@
*
* will select all elements with ".hint" class which don't have a parent with '.nohints' class.
*/
- $.expr[':'].parents = function(obj, index, meta /*, stack*/) {
+ $.expr[':'].parents = function (obj, index, meta /*, stack*/) {
return $(obj).parents(meta[3]).length > 0;
};
@@ -118,7 +118,7 @@
* Get width of default vertical scrollbar
*/
if ($.scrollbarWidth === undefined) {
- $.scrollbarWidth = function() {
+ $.scrollbarWidth = function () {
var parent = $('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo('body');
var child = parent.children();
var width = child.innerWidth() - child.height(99).innerWidth();
@@ -136,7 +136,7 @@
/**
* Check if current object is empty or not
*/
- exists: function() {
+ exists: function () {
return $(this).length > 0;
},
@@ -144,7 +144,7 @@
* Get object if it supports given CSS class,
* otherwise look for parents
*/
- objectOrParentWithClass: function(klass) {
+ objectOrParentWithClass: function (klass) {
if (this.hasClass(klass)) {
return this;
} else {
@@ -155,9 +155,9 @@
/**
* Build an array of attributes of the given selection
*/
- listattr: function(attr) {
+ listattr: function (attr) {
var result = [];
- this.each(function() {
+ this.each(function () {
result.push($(this).attr(attr));
});
return result;
@@ -167,7 +167,7 @@
* CSS style function
* Code from Aram Kocharyan on stackoverflow.com
*/
- style: function(styleName, value, priority) {
+ style: function (styleName, value, priority) {
// DOM node
var node = this.get(0);
// Ensure we have a DOM node
@@ -198,14 +198,345 @@
*/
removeClassPrefix: function (prefix) {
this.each(function (i, it) {
- var classes = it.className.split(" ").map(function(item) {
+ var classes = it.className.split(" ").map(function (item) {
return item.startsWith(prefix) ? "" : item;
});
it.className = $.trim(classes.join(" "));
});
return this;
+ }
+ });
+
+
+ /**
+ * MyAMS extensions to JQuery
+ */
+ if (globals.MyAMS === undefined) {
+ globals.MyAMS = {
+ devmode: true,
+ devext: '',
+ lang: 'en',
+ throttleDelay: 350,
+ menuSpeed: 235,
+ navbarHeight: 49,
+ ajaxNav: true,
+ safeMethods: ['GET', 'HEAD', 'OPTIONS', 'TRACE'],
+ csrfCookieName: 'csrf_token',
+ csrfHeaderName: 'X-CSRF-Token',
+ enableWidgets: true,
+ enableMobile: false,
+ enableFastclick: false,
+ warnOnFormChange: false,
+ ismobile: (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))
+ };
+ }
+ var MyAMS = globals.MyAMS;
+ var ams = MyAMS;
+
+ /**
+ * Get MyAMS base URL
+ * Copyright Andrew Davy: https://forrst.com/posts/Get_the_URL_of_the_current_javascript_file-Dst
+ */
+ MyAMS.baseURL = (function () {
+ var script = $('script[src*="/myams.js"], script[src*="/myams.min.js"]');
+ var src = script.attr("src");
+ ams.devmode = src.indexOf('.min.js') < 0;
+ ams.devext = ams.devmode ? '' : '.min';
+ return src.substring(0, src.lastIndexOf('/') + 1);
+ })();
+
+
+ /**
+ * Basic logging function which log all arguments to console
+ */
+ MyAMS.log = function () {
+ if (console) {
+ console.debug && console.debug(this, arguments);
+ }
+ };
+
+
+ /**
+ * Extract parameter value from given query string
+ */
+ MyAMS.getQueryVar = function (src, varName) {
+ // Check src
+ if (src.indexOf('?') < 0) {
+ return false;
+ }
+ if (!src.endsWith('&')) {
+ src += '&';
+ }
+ // Dynamic replacement RegExp
+ var regex = new RegExp('.*?[&\\?]' + varName + '=(.*?)&.*');
+ // Apply RegExp to the query string
+ var val = src.replace(regex, "$1");
+ // If the string is the same, we didn't find a match - return false
+ return val === src ? false : val;
+ };
+
+
+ /**
+ * Color conversion function
+ */
+ MyAMS.rgb2hex = function (color) {
+ return "#" + $.map(color.match(/\b(\d+)\b/g), function (digit) {
+ return ('0' + parseInt(digit).toString(16)).slice(-2);
+ }).join('');
+ };
+
+
+ /**
+ * Generate a random ID
+ */
+ MyAMS.generateId = function () {
+ function s4() {
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
+ }
+
+ return s4() + s4() + s4() + s4();
+ };
+
+
+ /**
+ * Generate a random UUID
+ */
+ MyAMS.generateUUID = function () {
+ var d = new Date().getTime();
+ var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
+ var r = (d + Math.random() * 16) % 16 | 0;
+ d = Math.floor(d / 16);
+ return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
+ });
+ return uuid;
+ };
+
+
+ /**
+ * Get an object given by name
+ */
+ MyAMS.getObject = function (objectName, context) {
+ if (!objectName) {
+ return undefined;
+ }
+ if (typeof(objectName) !== 'string') {
+ return objectName;
+ }
+ var namespaces = objectName.split(".");
+ context = (context === undefined || context === null) ? window : context;
+ for (var i = 0; i < namespaces.length; i++) {
+ try {
+ context = context[namespaces[i]];
+ } catch (e) {
+ return undefined;
+ }
+ }
+ return context;
+ };
+
+ /**
+ * Get and execute a function given by name
+ * Small piece of code by Jason Bunting
+ */
+ MyAMS.getFunctionByName = function (functionName, context) {
+ if (functionName === undefined) {
+ return undefined;
+ } else if (typeof(functionName) === 'function') {
+ return functionName;
+ }
+ var namespaces = functionName.split(".");
+ var func = namespaces.pop();
+ context = (context === undefined || context === null) ? window : context;
+ for (var i = 0; i < namespaces.length; i++) {
+ try {
+ context = context[namespaces[i]];
+ } catch (e) {
+ return undefined;
+ }
+ }
+ try {
+ return context[func];
+ } catch (e) {
+ return undefined;
+ }
+ };
+
+ MyAMS.executeFunctionByName = function (functionName, context /*, args */) {
+ var func = ams.getFunctionByName(functionName, window);
+ if (typeof(func) === 'function') {
+ var args = Array.prototype.slice.call(arguments, 2);
+ return func.apply(context, args);
+ }
+ };
+
+ /**
+ * Check to know if given element is still present in DOM
+ */
+ MyAMS.isInDOM = function (element) {
+ element = $(element);
+ if (!element.exists()) {
+ return false;
+ }
+ return globals.document.body.contains(element[0]);
+ };
+
+ /**
+ * Get target URL matching given source
+ *
+ * Given URL can include variable names (with their namespace), given between braces, as in {MyAMS.baseURL}
+ */
+ MyAMS.getSource = function (url) {
+ return url.replace(/{[^{}]*}/g, function (match) {
+ return ams.getFunctionByName(match.substr(1, match.length - 2));
+ });
+ };
+
+ /**
+ * Script loader function
+ *
+ * @param url: script URL
+ * @param callback: a callback to be called after script loading
+ * @param options: a set of options to be added to AJAX call
+ */
+ MyAMS.getScript = function (url, callback, options) {
+ if (typeof(callback) === 'object') {
+ options = callback;
+ callback = null;
+ }
+ if (options === undefined) {
+ options = {};
+ }
+ var defaults = {
+ dataType: 'script',
+ url: ams.getSource(url),
+ success: callback,
+ error: ams.error.show,
+ cache: !ams.devmode,
+ async: options.async === undefined ? typeof(callback) === 'function' : options.async
+ };
+ var settings = $.extend({}, defaults, options);
+ return $.ajax(settings);
+ };
+
+ /**
+ * CSS file loader function
+ * Cross-browser code copied from Stoyan Stefanov blog to be able to
+ * call a callback when CSS is realy loaded.
+ * See: https://www.phpied.com/when-is-a-stylesheet-really-loaded
+ *
+ * @param url: CSS file URL
+ * @param id: a unique ID given to CSS file
+ * @param callback: optional callback function to be called when CSS file is loaded. If set, callback is called
+ * with a 'first_load' boolean argument to indicate is CSS was already loaded (*false* value) or not (*true*
+ * value).
+ * @param options: callback options
+ */
+ MyAMS.getCSS = function (url, id, callback, options) {
+ if (callback) {
+ callback = ams.getFunctionByName(callback);
+ }
+ var head = $('HEAD');
+ var style = $('style[data-ams-id="' + id + '"]', head);
+ if (style.length === 0) {
+ style = $('<style>').attr('data-ams-id', id)
+ .text('@import "' + ams.getSource(url) + '";');
+ if (callback) {
+ var styleInterval = setInterval(function () {
+ try {
+ var _check = style[0].sheet.cssRules; // Is only populated when file is loaded
+ callback.call(window, true, options);
+ clearInterval(styleInterval);
+ } catch (e) {
+ // CSS is not loaded yet...
+ }
+ }, 10);
+ }
+ style.appendTo(head);
+ } else {
+ if (callback) {
+ callback.call(window, false, options);
+ }
+ }
+ };
+
+})(jQuery, this);
+
+/**
+ * MyAMS UTF-8 features
+ */
+(function($, globals) {
+
+ $.UTF8 = {
+
+ // public method for url encoding
+ encode : function (string) {
+ string = string.replace(/\r\n/g,"\n");
+ var utftext = "";
+
+ for (var n = 0; n < string.length; n++) {
+
+ var c = string.charCodeAt(n);
+
+ if (c < 128) {
+ utftext += String.fromCharCode(c);
+ }
+ else if((c > 127) && (c < 2048)) {
+ utftext += String.fromCharCode((c >> 6) | 192);
+ utftext += String.fromCharCode((c & 63) | 128);
+ }
+ else {
+ utftext += String.fromCharCode((c >> 12) | 224);
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+ utftext += String.fromCharCode((c & 63) | 128);
+ }
+ }
+ return utftext;
},
+ // public method for url decoding
+ decode : function (utftext) {
+ var string = "";
+ var i = 0,
+ c = 0,
+ c2 = 0,
+ c3 = 0;
+
+ while ( i < utftext.length ) {
+
+ c = utftext.charCodeAt(i);
+
+ if (c < 128) {
+ string += String.fromCharCode(c);
+ i++;
+ }
+ else if((c > 191) && (c < 224)) {
+ c2 = utftext.charCodeAt(i+1);
+ string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
+ i += 2;
+ }
+ else {
+ c2 = utftext.charCodeAt(i+1);
+ c3 = utftext.charCodeAt(i+2);
+ string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
+ i += 3;
+ }
+ }
+ return string;
+ }
+ }; /** $.UTF8 */
+
+})(jQuery, this);
+
+/**
+ * MyAMS menus management
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
+ $.fn.extend({
+
/**
* Context menu handler
*/
@@ -359,325 +690,16 @@
}
});
-
- /**
- * UTF-8 encoding class
- * Mainly used by IE...
- */
- $.UTF8 = {
-
- // public method for url encoding
- encode : function (string) {
- string = string.replace(/\r\n/g,"\n");
- var utftext = "";
-
- for (var n = 0; n < string.length; n++) {
-
- var c = string.charCodeAt(n);
-
- if (c < 128) {
- utftext += String.fromCharCode(c);
- }
- else if((c > 127) && (c < 2048)) {
- utftext += String.fromCharCode((c >> 6) | 192);
- utftext += String.fromCharCode((c & 63) | 128);
- }
- else {
- utftext += String.fromCharCode((c >> 12) | 224);
- utftext += String.fromCharCode(((c >> 6) & 63) | 128);
- utftext += String.fromCharCode((c & 63) | 128);
- }
- }
- return utftext;
- },
-
- // public method for url decoding
- decode : function (utftext) {
- var string = "";
- var i = 0,
- c = 0,
- c2 = 0,
- c3 = 0;
-
- while ( i < utftext.length ) {
-
- c = utftext.charCodeAt(i);
-
- if (c < 128) {
- string += String.fromCharCode(c);
- i++;
- }
- else if((c > 191) && (c < 224)) {
- c2 = utftext.charCodeAt(i+1);
- string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
- i += 2;
- }
- else {
- c2 = utftext.charCodeAt(i+1);
- c3 = utftext.charCodeAt(i+2);
- string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
- i += 3;
- }
- }
- return string;
- }
- }; /** $.UTF8 */
-
-
- /**
- * MyAMS extensions to JQuery
- */
- if (globals.MyAMS === undefined) {
- globals.MyAMS = {
- devmode: true,
- devext: '',
- lang: 'en',
- throttleDelay: 350,
- menuSpeed: 235,
- navbarHeight: 49,
- ajaxNav: true,
- safeMethods: ['GET', 'HEAD', 'OPTIONS', 'TRACE'],
- csrfCookieName: 'csrf_token',
- csrfHeaderName: 'X-CSRF-Token',
- enableWidgets: true,
- enableMobile: false,
- enableFastclick: false,
- warnOnFormChange: false,
- ismobile: (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))
- };
- }
- var MyAMS = globals.MyAMS;
- var ams = MyAMS;
-
- /**
- * Get MyAMS base URL
- * Copyright Andrew Davy: https://forrst.com/posts/Get_the_URL_of_the_current_javascript_file-Dst
- */
- MyAMS.baseURL = (function () {
- var script = $('script[src*="/myams.js"], script[src*="/myams.min.js"]');
- var src = script.attr("src");
- ams.devmode = src.indexOf('.min.js') < 0;
- ams.devext = ams.devmode ? '' : '.min';
- return src.substring(0, src.lastIndexOf('/') + 1);
- })();
-
-
- /**
- * Basic logging function which log all arguments to console
- */
- MyAMS.log = function() {
- if (console) {
- console.debug && console.debug(this, arguments);
- }
- };
-
-
- /**
- * Extract parameter value from given query string
- */
- MyAMS.getQueryVar = function(src, varName) {
- // Check src
- if (src.indexOf('?') < 0) {
- return false;
- }
- if (!src.endsWith('&')) {
- src += '&';
- }
- // Dynamic replacement RegExp
- var regex = new RegExp('.*?[&\\?]' + varName + '=(.*?)&.*');
- // Apply RegExp to the query string
- var val = src.replace(regex, "$1");
- // If the string is the same, we didn't find a match - return false
- return val === src ? false : val;
- };
-
-
- /**
- * Color conversion function
- */
- MyAMS.rgb2hex = function(color) {
- return "#" + $.map(color.match(/\b(\d+)\b/g), function(digit) {
- return ('0' + parseInt(digit).toString(16)).slice(-2);
- }).join('');
- };
-
-
- /**
- * Generate a random ID
- */
- MyAMS.generateId = function() {
- function s4() {
- return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
- }
- return s4() + s4() + s4() + s4();
- };
-
-
- /**
- * Generate a random UUID
- */
- MyAMS.generateUUID = function () {
- var d = new Date().getTime();
- var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
- var r = (d + Math.random() * 16) % 16 | 0;
- d = Math.floor(d / 16);
- return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
- });
- return uuid;
- };
-
-
- /**
- * Get an object given by name
- */
- MyAMS.getObject = function(objectName, context) {
- if (!objectName) {
- return undefined;
- }
- if (typeof(objectName) !== 'string') {
- return objectName;
- }
- var namespaces = objectName.split(".");
- context = (context === undefined || context === null) ? window : context;
- for (var i=0; i < namespaces.length; i++) {
- try {
- context = context[namespaces[i]];
- } catch (e) {
- return undefined;
- }
- }
- return context;
- };
-
- /**
- * Get and execute a function given by name
- * Small piece of code by Jason Bunting
- */
- MyAMS.getFunctionByName = function(functionName, context) {
- if (functionName === undefined) {
- return undefined;
- } else if (typeof(functionName) === 'function') {
- return functionName;
- }
- var namespaces = functionName.split(".");
- var func = namespaces.pop();
- context = (context === undefined || context === null) ? window : context;
- for (var i=0; i < namespaces.length; i++) {
- try {
- context = context[namespaces[i]];
- } catch (e) {
- return undefined;
- }
- }
- try {
- return context[func];
- } catch (e) {
- return undefined;
- }
- };
-
- MyAMS.executeFunctionByName = function(functionName, context /*, args */) {
- var func = ams.getFunctionByName(functionName, window);
- if (typeof(func) === 'function') {
- var args = Array.prototype.slice.call(arguments, 2);
- return func.apply(context, args);
- }
- };
-
- /**
- * Check to know if given element is still present in DOM
- */
- MyAMS.isInDOM = function(element) {
- element = $(element);
- if (!element.exists()) {
- return false;
- }
- return globals.document.body.contains(element[0]);
- };
-
- /**
- * Get target URL matching given source
- *
- * Given URL can include variable names (with their namespace), given between braces, as in {MyAMS.baseURL}
- */
- MyAMS.getSource = function(url) {
- return url.replace(/{[^{}]*}/g, function(match) {
- return ams.getFunctionByName(match.substr(1, match.length-2));
- });
- };
-
- /**
- * Script loader function
- *
- * @param url: script URL
- * @param callback: a callback to be called after script loading
- * @param options: a set of options to be added to AJAX call
- */
- MyAMS.getScript = function(url, callback, options) {
- if (typeof(callback) === 'object') {
- options = callback;
- callback = null;
- }
- if (options === undefined) {
- options = {};
- }
- var defaults = {
- dataType: 'script',
- url: ams.getSource(url),
- success: callback,
- error: ams.error.show,
- cache: !ams.devmode,
- async: options.async === undefined ? typeof(callback) === 'function' : options.async
- };
- var settings = $.extend({}, defaults, options);
- return $.ajax(settings);
- };
-
- /**
- * CSS file loader function
- * Cross-browser code copied from Stoyan Stefanov blog to be able to
- * call a callback when CSS is realy loaded.
- * See: https://www.phpied.com/when-is-a-stylesheet-really-loaded
- *
- * @param url: CSS file URL
- * @param id: a unique ID given to CSS file
- * @param callback: optional callback function to be called when CSS file is loaded. If set, callback is called
- * with a 'first_load' boolean argument to indicate is CSS was already loaded (*false* value) or not (*true*
- * value).
- * @param options: callback options
- */
- MyAMS.getCSS = function(url, id, callback, options) {
- if (callback) {
- callback = ams.getFunctionByName(callback);
- }
- var head = $('HEAD');
- var style = $('style[data-ams-id="' + id + '"]', head);
- if (style.length === 0) {
- style = $('<style>').attr('data-ams-id', id)
- .text('@import "' + ams.getSource(url) + '";');
- if (callback) {
- var styleInterval = setInterval(function() {
- try {
- var _check = style[0].sheet.cssRules; // Is only populated when file is loaded
- callback.call(window, true, options);
- clearInterval(styleInterval);
- } catch (e) {
- // CSS is not loaded yet...
- }
- }, 10);
- }
- style.appendTo(head);
- } else {
- if (callback) {
- callback.call(window, false, options);
- }
- }
- };
-
-
- /**
- * Events management
- */
+})(jQuery, this);
+
+/**
+ * MyAMS events management
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.event = {
/**
@@ -699,10 +721,16 @@
}
};
-
- /**
- * Browser testing functions; mostly for IE...
- */
+})(jQuery, this);
+
+/**
+ * MyAMS browser related features
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.browser = {
/**
@@ -761,7 +789,7 @@
* If 'text' argument is provided, given text is copied to clipboard.
* Otherwise, text ou event's source is copied.
* Several methods are tested to do clipboard copy (based on browser features); il copy can't be done,
- * a prompt is displayed to allow user to make a manual copy.
+ * a prompt is displayed to allow user to make a manual copy.
*/
copyToClipboard: function(text) {
@@ -814,10 +842,16 @@
}
};
-
- /**
- * Errors management features
- */
+})(jQuery, this);
+
+/**
+ * MyAMS errors management
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.error = {
/**
@@ -875,10 +909,16 @@
}
};
-
- /**
- * AJAX helper functions
- */
+})(jQuery, this);
+
+/**
+ * MyAMS AJAX features
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.ajax = {
/**
@@ -1328,10 +1368,16 @@
}
};
-
- /**
- * JSON-RPC helper functions
- */
+})(jQuery, this);
+
+/**
+ * MyAMS JSON-RPC features
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.jsonrpc = {
/**
@@ -1450,10 +1496,16 @@
}
};
-
- /**
- * XML-RPC helper functions
- */
+})(jQuery, this);
+
+/**
+ * MyAMS XML-RPC features
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.xmlrpc = {
/**
@@ -1510,10 +1562,16 @@
}
};
-
- /**
- * Forms helper functions
- */
+})(jQuery, this);
+
+/**
+ * MyAMS forms management
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.form = {
/**
@@ -2251,10 +2309,16 @@
}
};
-
- /**
- * Modal dialogs helper functions
- */
+})(jQuery, this);
+
+/**
+ * MyAMS modal dialogs management
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.dialog = {
/**
@@ -2544,14 +2608,20 @@
}
};
-
- /**
- * Plug-ins helpers functions
- *
- * These helpers functions are used by several JQuery plug-in extensions.
- * They have been extracted from these extensions management code to reuse them more easily into
- * application specific callbacks.
- */
+})(jQuery, this);
+
+/**
+ * MyAMS helpers
+ *
+ * These helpers functions are used by several JQuery plug-in extensions.
+ * They have been extracted from these extensions management code to reuse them more easily into
+ * application specific callbacks.
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.helpers = {
/** Sort DOM elements into selected container */
@@ -2785,20 +2855,26 @@
}
};
-
- /**
- * Plug-ins management features
- *
- * Only basic JQuery, Bootstrap and MyAMS javascript extensions are typically loaded from main page.
- * Other JQuery plug-ins may be loaded dynamically.
- * Several JQuery extension plug-ins are already included and pre-configured by MyAMS. Other external
- * plug-ins can be defined and loaded dynamically using simple "data" attributes.
- *
- * WARNING: any plug-in implicated into a form submit process (like JQuery-form or JQuery-progressbar)
- * must be loaded in a synchronous way. Otherwise, if you use named buttons to submit your forms,
- * dynamic hidden input fields created by JQuery-validate plug-in will be removed from the form
- * before the form is submitted!
- */
+})(jQuery, this);
+
+/**
+ * MyAMS standard plug-ins
+ *
+ * Only basic JQuery, Bootstrap and MyAMS javascript extensions are typically loaded from main page.
+ * Other JQuery plug-ins may be loaded dynamically.
+ * Several JQuery extension plug-ins are already included and pre-configured by MyAMS. Other external
+ * plug-ins can be defined and loaded dynamically using simple "data" attributes.
+ *
+ * WARNING: any plug-in implicated into a form submit process (like JQuery-form or JQuery-progressbar)
+ * must be loaded in a synchronous way. Otherwise, if you use named buttons to submit your forms,
+ * dynamic hidden input fields created by JQuery-validate plug-in will be removed from the form
+ * before the form is submitted!
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.plugins = {
/**
@@ -4741,10 +4817,16 @@
}
};
-
- /**
- * Callbacks management features
- */
+})(jQuery, this);
+
+/**
+ * MyAMS callbacks management
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.callbacks = {
/**
@@ -4901,10 +4983,16 @@
}
};
-
- /**
- * Events management
- */
+})(jQuery, this);
+
+/**
+ * MyAMS events management
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.events = {
/**
@@ -4930,10 +5018,16 @@
}
};
-
- /**
- * Container management
- */
+})(jQuery, this);
+
+/**
+ * MyAMS containers management
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.container = {
/**
@@ -5039,10 +5133,16 @@
}
};
-
- /**
- * Tree management
- */
+})(jQuery, this);
+
+/**
+ * MyAMS tree management
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.tree = {
/**
@@ -5263,10 +5363,16 @@
}
};
-
- /**
- * Generic skin features
- */
+})(jQuery, this);
+
+/**
+ * MyAMS skin management
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.skin = {
/**
@@ -5619,7 +5725,7 @@
$.scrollTo(element, options);
});
},
-
+
/**
* Initialize breadcrumbs based on active menu position
*/
@@ -5854,10 +5960,16 @@
}
};
-
- /**
- * Statistics management
- */
+})(jQuery, this);
+
+/**
+ * MyAMS stats management
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.stats = {
/**
@@ -5891,11 +6003,17 @@
}
};
-
- /**
- * Main page initialization
- * This code is called only once to register global events and callbacks
- */
+})(jQuery, this);
+
+/**
+ * MyAMS page initialization
+ * This code is called once to register global events and callbacks
+ */
+(function($, globals) {
+
+ var MyAMS = globals.MyAMS,
+ ams = MyAMS;
+
MyAMS.initPage = function() {
var body = $('body');
@@ -6427,7 +6545,7 @@
$(document).on('myams.refresh', function(event, options) {
MyAMS.executeFunctionByName(options.handler || MyAMS.skin.refreshContent, event.target, options);
});
-
+
// Init page content
ams.initContent(document);
if (ams.ajaxNav && nav.exists()) {