487 MyAMS.generateUUID = function () { |
487 MyAMS.generateUUID = function () { |
488 var d = new Date().getTime(); |
488 var d = new Date().getTime(); |
489 var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { |
489 var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { |
490 var r = (d + Math.random() * 16) % 16 | 0; |
490 var r = (d + Math.random() * 16) % 16 | 0; |
491 d = Math.floor(d / 16); |
491 d = Math.floor(d / 16); |
492 return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16); |
492 return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); |
493 }); |
493 }); |
494 return uuid; |
494 return uuid; |
495 }; |
495 }; |
496 |
496 |
497 |
497 |
1433 function _getProgressStatus() { |
1435 function _getProgressStatus() { |
1434 ams.ajax.post(handler, |
1436 ams.ajax.post(handler, |
1435 {progress_id: progress_id}, |
1437 {progress_id: progress_id}, |
1436 {error: _clearProgressStatus}, |
1438 {error: _clearProgressStatus}, |
1437 ams.getFunctionByName(progressCallback) || function(result, status) { |
1439 ams.getFunctionByName(progressCallback) || function(result, status) { |
1438 if (status == 'success') { |
1440 if (status === 'success') { |
1439 if (result.status === 'running') { |
1441 if (result.status === 'running') { |
1440 if (result.message) { |
1442 if (result.message) { |
1441 button.text(result.message); |
1443 button.text(result.message); |
1442 } else { |
1444 } else { |
1443 button.text(button.data('ams-progress-text') + |
1445 button.text(button.data('ams-progress-text') + |
2465 _registerPlugin(name, amsPlugins[name]); |
2466 _registerPlugin(name, amsPlugins[name]); |
2466 } |
2467 } |
2467 } |
2468 } |
2468 }); |
2469 }); |
2469 |
2470 |
|
2471 // Inner plug-in loader function |
|
2472 var plugin; |
|
2473 |
|
2474 function _loadPlugin() { |
|
2475 var index; |
|
2476 var callbacks = plugin.callbacks; |
|
2477 if (callbacks && callbacks.length) { |
|
2478 for (index=0; index < callbacks.length; index++) { |
|
2479 var called = ams.getFunctionByName(callbacks[index]); |
|
2480 if (plugin.register !== false) { |
|
2481 var enabled = ams.plugins.enabled; |
|
2482 if (enabled.hasOwnProperty(name)) { |
|
2483 enabled[name].push(called); |
|
2484 } else { |
|
2485 enabled[name] = [called]; |
|
2486 } |
|
2487 } |
|
2488 } |
|
2489 } else { |
|
2490 if (plugin.register !== false) { |
|
2491 ams.plugins.enabled[name] = null; |
|
2492 } |
|
2493 } |
|
2494 // If running in async mode, registered plug-ins are run |
|
2495 // before callback is called so we call plug-in manually |
|
2496 if (callbacks && callbacks.length && (plugin.async !== false)) { |
|
2497 for (index=0; index < callbacks.length; index++) { |
|
2498 ams.getFunctionByName(callbacks[index])(element); |
|
2499 } |
|
2500 } |
|
2501 } |
|
2502 |
2470 for (name in plugins) { |
2503 for (name in plugins) { |
2471 if (ams.plugins.enabled[name] === undefined) { |
2504 if (ams.plugins.enabled[name] === undefined) { |
2472 plugin = plugins[name]; |
2505 plugin = plugins[name]; |
2473 ams.getScript(plugin.src, function() { |
2506 ams.getScript(plugin.src, _loadPlugin, { |
2474 var index; |
|
2475 var callbacks = plugin.callbacks; |
|
2476 if (callbacks && callbacks.length) { |
|
2477 for (index=0; index < callbacks.length; index++) { |
|
2478 var called = ams.getFunctionByName(callbacks[index]); |
|
2479 if (plugin.register !== false) { |
|
2480 var enabled = ams.plugins.enabled; |
|
2481 if (enabled.hasOwnProperty(name)) { |
|
2482 enabled[name].push(called); |
|
2483 } else { |
|
2484 enabled[name] = [called]; |
|
2485 } |
|
2486 } |
|
2487 } |
|
2488 } else { |
|
2489 if (plugin.register !== false) { |
|
2490 ams.plugins.enabled[name] = null; |
|
2491 } |
|
2492 } |
|
2493 // If running in async mode, registered plug-ins are run |
|
2494 // before callback is called so we call plug-in manually |
|
2495 if (callbacks && callbacks.length && (plugin.async !== false)) { |
|
2496 for (index=0; index < callbacks.length; index++) { |
|
2497 ams.getFunctionByName(callbacks[index])(element); |
|
2498 } |
|
2499 } |
|
2500 }, { |
|
2501 async: plugin.async === undefined ? true : plugin.async |
2507 async: plugin.async === undefined ? true : plugin.async |
2502 }); |
2508 }); |
2503 } |
2509 } |
2504 } |
2510 } |
2505 |
2511 |
4077 _setPageHeight: function() { |
4083 _setPageHeight: function() { |
4078 var mainHeight = $('#main').height(); |
4084 var mainHeight = $('#main').height(); |
4079 var menuHeight = ams.leftPanel.height(); |
4085 var menuHeight = ams.leftPanel.height(); |
4080 var windowHeight = $(window).height() - ams.navbarHeight; |
4086 var windowHeight = $(window).height() - ams.navbarHeight; |
4081 if (mainHeight > windowHeight) { |
4087 if (mainHeight > windowHeight) { |
4082 ams.leftPanel.css('min-height', mainHeight); |
|
4083 ams.root.css('min-height', mainHeight + ams.navbarHeight); |
4088 ams.root.css('min-height', mainHeight + ams.navbarHeight); |
4084 } else { |
4089 } else { |
4085 ams.leftPanel.css('min-height', windowHeight); |
|
4086 ams.root.css('min-height', windowHeight); |
4090 ams.root.css('min-height', windowHeight); |
4087 } |
4091 } |
|
4092 ams.leftPanel.css('min-height', windowHeight); |
|
4093 ams.leftPanel.css('max-height', windowHeight); |
4088 }, |
4094 }, |
4089 |
4095 |
4090 /** |
4096 /** |
4091 * Check width for mobile devices |
4097 * Check width for mobile devices |
4092 */ |
4098 */ |