egroupware_official/pixelegg/js/fw_pixelegg.js
Ralf Becker f25070a9c2 - switching minifying of javascript to use Grunt and Uglify (instead of doing it on the fly with php on every host)
- generating now a couple of bundles: api, et2, mail, calendar, jdots, pixelegg and mobile
- developers need to update minified files whenever a javascript file changes: grunt uglify[:(api|et2|mail|calendar|jdots|pixelegg|mobile)]
- minified files also contains a map file allowing to debug with them
2016-03-01 20:45:31 +00:00

80 lines
2.7 KiB
JavaScript

/**
* EGroupware jDots / Stylite template
*
* @package framework
* @author Hadi Nategh <hn@stylite.de>
* @author Andreas Stoeckel <as@stylite.de>
* @copyright Stylite AG 2014
* @description Create jdots framework
*/
/*egw:uses
jquery.jquery;
framework.fw_desktop;
/pixelegg/js/slider.js;
*/
(function(window){
"use strict";
/**
* jdots framework object defenition
* here we can add framework methods and also override fw_desktop methods if it is neccessary
*/
var fw_pixelegg = fw_desktop.extend(
{
/**
* Callback to calculate height of browser iframe or div
*
* @param {object} _iframe dom node of iframe or null for div
* @returns number in pixel
*/
getIFrameHeight: function(_iframe)
{
var height = this._super.apply(this, arguments);
return height - 28;
}
});
/**
* Initialise framework
*/
egw_LAB.wait(function() {
function egw_setSideboxSize(_size)
{
document.getElementById('egw_fw_main').style.marginLeft = _size + 'px';
document.getElementById('egw_fw_sidebar').style.width = _size + 'px';
}
$j(document).ready(function() {
window.framework = new fw_pixelegg("egw_fw_sidemenu", "egw_fw_tabs",
window.egw_webserverUrl, egw_setSideboxSize,"egw_fw_splitter", 255, 245); // should be identical to jdots_framework::(DEFAULT|MIN)_SIDEBAR_WIDTH
window.callManual = window.framework.callManual;
jQuery('#egw_fw_print').click(function(){window.framework.print();});
jQuery('#egw_fw_logout').click(function(){ window.framework.redirect(this.getAttribute('data-logout-url')); });
jQuery('form[name^="tz_selection"]').children().on('change', function(){framework.tzSelection(this.value); return false;});
window.egw.link_quick_add('quick_add');
// allowing javascript urls in topmenu and sidebox only under CSP by binding click handlers to them
var href_regexp = /^javascript:([^\(]+)\((.*)?\);?$/;
jQuery('#egw_fw_topmenu_items,#egw_fw_topmenu_info_items,#egw_fw_sidemenu,#egw_fw_footer').on('click','a[href^="javascript:"]',function(ev){
ev.stopPropagation(); // do NOT execute regular event, as it will violate CSP, when handler does NOT return false
var matches = this.href.match(href_regexp);
var args = [];
if (matches.length > 1 && matches[2] !== undefined)
{
try {
args = JSON.parse('['+matches[2]+']');
}
catch(e) { // deal with '-encloded strings (JSON allows only ")
args = JSON.parse('['+matches[2].replace(/','/g, '","').replace(/((^|,)'|'(,|$))/g, '$2"$3')+']');
}
}
args.unshift(matches[1]);
et2_call.apply(this, args);
return false; // IE11 seems to require this, ev.stopPropagation() does NOT stop link from being executed
});
});
});
})(window);