|
From: <pe...@us...> - 2013-01-19 12:43:23
|
Revision: 1342
http://openautomation.svn.sourceforge.net/openautomation/?rev=1342&view=rev
Author: peuter
Date: 2013-01-19 12:43:11 +0000 (Sat, 19 Jan 2013)
Log Message:
-----------
* initial refactoring of the templateengine.js
Modified Paths:
--------------
CometVisu/trunk/visu/designs/metal/design_setup.js
CometVisu/trunk/visu/lib/templateengine.js
CometVisu/trunk/visu/plugins/clock/structure_plugin.js
CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
CometVisu/trunk/visu/plugins/svg/structure_plugin.js
CometVisu/trunk/visu/structure/pure/_common.js
CometVisu/trunk/visu/structure/pure/group.js
CometVisu/trunk/visu/structure/pure/image.js
CometVisu/trunk/visu/structure/pure/imagetrigger.js
CometVisu/trunk/visu/structure/pure/infotrigger.js
CometVisu/trunk/visu/structure/pure/multitrigger.js
CometVisu/trunk/visu/structure/pure/navbar.js
CometVisu/trunk/visu/structure/pure/page.js
CometVisu/trunk/visu/structure/pure/pagejump.js
CometVisu/trunk/visu/structure/pure/rgb.js
CometVisu/trunk/visu/structure/pure/slide.js
CometVisu/trunk/visu/structure/pure/switch.js
CometVisu/trunk/visu/structure/pure/toggle.js
CometVisu/trunk/visu/structure/pure/trigger.js
CometVisu/trunk/visu/structure/pure/urltrigger.js
CometVisu/trunk/visu/structure/pure/web.js
Modified: CometVisu/trunk/visu/designs/metal/design_setup.js
===================================================================
--- CometVisu/trunk/visu/designs/metal/design_setup.js 2013-01-18 22:37:05 UTC (rev 1341)
+++ CometVisu/trunk/visu/designs/metal/design_setup.js 2013-01-19 12:43:11 UTC (rev 1342)
@@ -86,9 +86,9 @@
}
if (/(iphone|ipod|ipad)/i.test(navigator.userAgent.toLowerCase())) {
// disable scrolling
- main_scroll.getConf().speed=0;
+ templateEngine.main_scroll.getConf().speed=0;
$('body').css('padding-top','1em');
- handleResize(true);
+ templateEngine.handleResize(true);
}
$('#navbarLeft .navbar .widget .label,#navbarRight .navbar .widget .label').each(function(i) {
var label = $(this);
Modified: CometVisu/trunk/visu/lib/templateengine.js
===================================================================
--- CometVisu/trunk/visu/lib/templateengine.js 2013-01-18 22:37:05 UTC (rev 1341)
+++ CometVisu/trunk/visu/lib/templateengine.js 2013-01-19 12:43:11 UTC (rev 1342)
@@ -17,1387 +17,1331 @@
* @module Templateengine
* @title CometVisu templateengine
*/
+var templateEngine = new TemplateEngine();
-var design = new VisuDesign_Custom();
-var icons = new icon();
+$(window).bind('resize', templateEngine.handleResize);
+$(window).unload(function() {
+ templateEngine.visu.stop();
+});
+$(document).ready(function() {
+ // get the data once the page was loaded
+ $.ajax({
+ url : 'visu_config'+ (templateEngine.configSuffix ? '_' + templateEngine.configSuffix : '') + '.xml',
+ cache : !templateEngine.forceReload,
+ success : templateEngine.parseXML,
+ error : function(jqXHR, textStatus, errorThrown) {
+ var message = 'Config-File Error! ';
+ switch (textStatus) {
+ case 'parsererror':
+ message += '<br />Invalid config file!<br /><a href="check_config.php?config='
+ + templateEngine.configSuffix + '">Please check!</a>';
+ }
+ $('#loading').html(message);
+ },
+ dataType : 'xml'
+ });
+});
-var mappings = {}; // store the mappings
-var stylings = {}; // store the stylings
-var navbars = { // store informations about the nav bars
- top : {
- dynamic : false
- },
- left : {
- dynamic : false
- },
- right : {
- dynamic : false
- },
- bottom : {
- dynamic : false
- }
-};
+function TemplateEngine() {
+ var thisTemplateEngine = this;
+ this.design = new VisuDesign_Custom();
+ this.icons = new icon();
+ this.pagePartsHandler = new PagePartsHandler();
-var ga_list = [];
+ this.mappings = {}; // store the mappings
+ this.stylings = {}; // store the stylings
+
+ this.ga_list = [];
-var main_scroll;
-var old_scroll = '';
+ this.main_scroll;
+ this.old_scroll = '';
+ this.visu;
-var scrollSpeed;
+ this.scrollSpeed;
-var resizeAfterScroll = false;
-var defaultColumns = 12;
-var minColumnWidth = 150;
-var enableColumnAdjustment = false;
-var backend = 'cgi-bin'; // default path to backend
-if ($.getUrlVar("backend")) {
- backend = $.getUrlVar("backend");
-}
+ this.resizeAfterScroll = false;
+ this.defaultColumns = 12;
+ this.minColumnWidth = 150;
+ this.enableColumnAdjustment = false;
+ this.backend = 'cgi-bin'; // default path to backend
+ if ($.getUrlVar("backend")) {
+ this.backend = $.getUrlVar("backend");
+ }
-function initBackendClient() {
- backend = '/' + backend + '/';
- visu = new CometVisu( backend );
- visu.update = function(json) { // overload the handler
- for (key in json) {
- $.event.trigger('_' + key, json[key]);
- }
+ this.initBackendClient = function() {
+ var backend = '/' + thisTemplateEngine.backend + '/';
+ thisTemplateEngine.visu = new CometVisu(backend);
+ thisTemplateEngine.visu.update = function(json) { // overload the handler
+ for (key in json) {
+ $.event.trigger('_' + key, json[key]);
+ }
+ };
+ thisTemplateEngine.visu.user = 'demo_user'; // example for setting a user
};
- visu.user = 'demo_user'; // example for setting a user
-}
-var configSuffix;
-if ($.getUrlVar("config")) {
- configSuffix = $.getUrlVar("config");
-}
+ this.configSuffix;
+ if ($.getUrlVar("config")) {
+ this.configSuffix = $.getUrlVar("config");
+ }
-var clientDesign = "";
+ this.clientDesign = "";
-if (typeof forceReload == "undefined") {
- var forceReload = false;
-}
+ if (typeof forceReload == "undefined") {
+ this.forceReload = false;
+ }
-if ($.getUrlVar('forceReload')) {
- forceReload = $.getUrlVar('forceReload') != 'false'; // true unless set to
- // false
-}
+ if ($.getUrlVar('forceReload')) {
+ this.forceReload = $.getUrlVar('forceReload') != 'false'; // true unless set
+ // to
+ // false
+ }
-// "Bug"-Fix for ID: 3204682 "Caching on web server"
-// This isn't a real fix for the problem as that's part of the web browser, but
-// it helps to avoid the problems on the client, e.g. when the config file
-// has changed but the browser doesn't even ask the server about it...
-forceReload = true;
+ // "Bug"-Fix for ID: 3204682 "Caching on web server"
+ // This isn't a real fix for the problem as that's part of the web browser,
+ // but
+ // it helps to avoid the problems on the client, e.g. when the config file
+ // has changed but the browser doesn't even ask the server about it...
+ this.forceReload = true;
-// Disable features that aren't ready yet
-// This can be overwritten in the URL with the parameter "maturity"
-var use_maturity;
-if ($.getUrlVar('maturity')) {
- var url_maturity = $.getUrlVar('maturity');
- if (!isNaN(url_maturity - 0)) {
- use_maturity = url_maturity - 0; // given directly as number
- } else {
- use_maturity = Maturity[url_maturity]; // or as the ENUM name
+ // Disable features that aren't ready yet
+ // This can be overwritten in the URL with the parameter "maturity"
+ this.use_maturity;
+ if ($.getUrlVar('maturity')) {
+ this.url_maturity = $.getUrlVar('maturity');
+ if (!isNaN(this.url_maturity - 0)) {
+ this.use_maturity = this.url_maturity - 0; // given directly as number
+ } else {
+ this.use_maturity = Maturity[this.url_maturity]; // or as the ENUM name
+ }
}
-}
-if (isNaN(use_maturity)) {
- use_maturity = Maturity.release; // default to release
-}
+ if (isNaN(this.use_maturity)) {
+ this.use_maturity = Maturity.release; // default to release
+ }
-$(document)
- .ready(
- function() {
- // get the data once the page was loaded
- $
- .ajax({
- url : 'visu_config' + (configSuffix ? '_' + configSuffix : '')
- + '.xml',
- cache : !forceReload,
- success : parseXML,
- error : function(jqXHR, textStatus, errorThrown) {
- var message = 'Config-File Error! ';
- switch (textStatus) {
- case 'parsererror':
- message += '<br />Invalid config file!<br /><a href="check_config.php?config='
- + configSuffix + '">Please check!</a>';
- }
- $('#loading').html(message);
- },
- dataType : 'xml'
- });
- });
+ this.transformEncode = function(transformation, value) {
+ var basetrans = transformation.split('.')[0];
+ return transformation in Transform ? Transform[transformation]
+ .encode(value) : (basetrans in Transform ? Transform[basetrans]
+ .encode(value) : value);
+ };
-$(window).unload(function() {
- visu.stop();
-});
+ this.transformDecode = function(transformation, value) {
+ var basetrans = transformation.split('.')[0];
+ return transformation in Transform ? Transform[transformation]
+ .decode(value) : (basetrans in Transform ? Transform[basetrans]
+ .decode(value) : value);
+ };
-function transformEncode(transformation, value) {
- var basetrans = transformation.split('.')[0];
- return transformation in Transform ? Transform[transformation].encode(value)
- : (basetrans in Transform ? Transform[basetrans].encode(value) : value);
-}
+ this.map = function(value, this_map) {
+ if (this_map && thisTemplateEngine.mappings[this_map]) {
+ var m = thisTemplateEngine.mappings[this_map];
-function transformDecode(transformation, value) {
- var basetrans = transformation.split('.')[0];
- return transformation in Transform ? Transform[transformation].decode(value)
- : (basetrans in Transform ? Transform[basetrans].decode(value) : value);
-}
+ if (m.formula) {
+ return m.formula(value);
+ } else if (m[value]) {
+ return m[value];
+ } else if (m['range']) {
+ var valueFloat = parseFloat(value);
-function map(value, this_map) {
- if (this_map && mappings[this_map]) {
- var m = mappings[this_map];
-
- if (m.formula) {
- return m.formula(value);
- } else if (m[value]) {
- return m[value];
- } else if (m['range']) {
- var valueFloat = parseFloat(value);
-
- var range = m['range'];
- for ( var min in range) {
- if (min > valueFloat)
- continue;
- if (range[min][0] < valueFloat)
- continue; // check max
- return range[min][1];
+ var range = m['range'];
+ for ( var min in range) {
+ if (min > valueFloat)
+ continue;
+ if (range[min][0] < valueFloat)
+ continue; // check max
+ return range[min][1];
+ }
}
}
- }
- return value;
-}
+ return value;
+ };
-function adjustColumns() {
- if (enableColumnAdjustment == false)
- return false;
+ this.adjustColumns = function() {
+ if (thisTemplateEngine.enableColumnAdjustment == false)
+ return false;
- var factor = window.devicePixelRatio || 1;
- var widthNavbarLeft = $('#navbarLeft').css('display') != 'none' ? $(
- '#navbarLeft').width() : 0;
- var widthNavbarRight = $('#navbarRight').css('display') != 'none' ? $(
- '#navbarRight').width() : 0;
- var width = $('body').width() - widthNavbarLeft - widthNavbarRight - 1; // remove
- // an
- // additional
- // pixel
- // for
- // Firefox
- width = width / factor;
+ var factor = window.devicePixelRatio || 1;
+ var widthNavbarLeft = $('#navbarLeft').css('display') != 'none' ? $('#navbarLeft').width() : 0;
+ var widthNavbarRight = $('#navbarRight').css('display') != 'none' ? $('#navbarRight').width() : 0;
+ var width = $('body').width() - widthNavbarLeft - widthNavbarRight - 1; // remove an additional pixel for Firefox
+ width = width / factor;
- var $main = $('#main');
- var newColumns = $main.data('columns');
- newColumns = (Math.ceil(width / minColumnWidth) % 2) > 0 ? Math.ceil(width
- / minColumnWidth) + 1 : Math.ceil(width / minColumnWidth);
- newColumns = Math.min(defaultColumns, newColumns);
- if (newColumns > defaultColumns / 2 && defaultColumns > newColumns)
- newColumns = defaultColumns;
+ var $main = $('#main');
+ var newColumns = $main.data('columns');
+ newColumns = (Math.ceil(width / thisTemplateEngine.minColumnWidth) % 2) > 0 ? Math.ceil(width
+ / thisTemplateEngine.minColumnWidth) + 1 : Math.ceil(width / thisTemplateEngine.minColumnWidth);
+ newColumns = Math.min(thisTemplateEngine.defaultColumns, newColumns);
+ if (newColumns > thisTemplateEngine.defaultColumns / 2 && thisTemplateEngine.defaultColumns > newColumns)
+ newColumns = thisTemplateEngine.defaultColumns;
- if (newColumns != $main.data('columns')) {
- $main.data({
- 'columns' : newColumns
- });
- return true;
- } else {
- return false;
- }
-}
-
-/*
- * Make sure everything looks right when the window gets resized. This is
- * necessary as the scroll effect requires a fixed element size
- */
-function handleResize(resize, skipScrollFix) {
- var uagent = navigator.userAgent.toLowerCase();
- var widthNavbarLeft = $('#navbarLeft').css('display') != 'none' ? $(
- '#navbarLeft').width() : 0;
- var widthNavbarRight = $('#navbarRight').css('display') != 'none' ? $(
- '#navbarRight').width() : 0;
- var width = $('body').width() - widthNavbarLeft - widthNavbarRight - 1; // remove
- // an
- // additional
- // pixel
- // for
- // Firefox
-
- var $main = $('#main');
-// if (/(android|blackberry|iphone|ipod|series60|symbian|windows ce|palm)/i
-// .test(uagent)) {
- var mobileDevice = (/(android|blackberry|iphone|ipod|series60|symbian|windows ce|palm)/i.test(uagent));
- if (/(nexus 7|tablet)/i.test(uagent)) mobileDevice = false; // Nexus 7 and Android Tablets have a "big" screen, so prevent Navbar from scrolling
- if (mobileDevice) {
- $main.css('width', width);
- $('#pageSize').text('.page{width:' + (width - 0) + 'px;}');
- // do nothing
- } else {
- var height = $(window).height() - $main.position().top;
- if ($('#navbarBottom').css('display') != 'none') {
- height -= $('#navbarBottom').outerHeight(true) - 1;
- }
- if ($('#bottom').css('display') != 'none') {
- height -= $('#bottom').outerHeight(true) - 1;
- }
- $main.css('width', width).css('height', height);
- $('#pageSize').text(
- '.page{width:' + (width - 0) + 'px;height:' + height + 'px;}');
- }
- if (skipScrollFix === undefined) {
- if (adjustColumns()) {
- var allContainer = $('.widget_container');
- allContainer.each(function(i, e) {
- var $e = $(e);
- var ourColspan = $e.children('*:first-child').data('colspan');
- if (ourColspan <= 0)
- return;
- var areaColspan = $e.parentsUntil('#centerContainer').last().data(
- 'columns')
- || defaultColumns;
- var ourWidth = Math.min(100, ourColspan / areaColspan * 100);
- $e.css('width', ourWidth + '%');
+ if (newColumns != $main.data('columns')) {
+ $main.data({
+ 'columns' : newColumns
});
- // and elements inside groups
- var adjustableElements = $('.group .widget_container');
- adjustableElements.each(function(i, e) {
- var $e = $(e);
- var ourColspan = $e.children('.widget').data('colspan');
- if (ourColspan <= 0)
- return;
- if (ourColspan == undefined) {
- // workaround for nowidget groups
- ourColspan = $e.children('.group').data('colspan');
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ /*
+ * Make sure everything looks right when the window gets resized. This is
+ * necessary as the scroll effect requires a fixed element size
+ */
+ this.handleResize = function(resize, skipScrollFix) {
+ var uagent = navigator.userAgent.toLowerCase();
+ var widthNavbarLeft = $('#navbarLeft').css('display') != 'none' ? $('#navbarLeft').width() : 0;
+ var widthNavbarRight = $('#navbarRight').css('display') != 'none' ? $('#navbarRight').width() : 0;
+ var width = $('body').width() - widthNavbarLeft - widthNavbarRight - 1; // remove an additional pixel for Firefox
+
+ var $main = $('#main');
+ // if (/(android|blackberry|iphone|ipod|series60|symbian|windows ce|palm)/i.test(uagent)) {
+ var mobileDevice = (/(android|blackberry|iphone|ipod|series60|symbian|windows ce|palm)/i.test(uagent));
+ if (/(nexus 7|tablet)/i.test(uagent)) mobileDevice = false; // Nexus 7 and Android Tablets have a "big" screen, so prevent Navbar from scrolling
+ if (mobileDevice) {
+ $main.css('width', width);
+ $('#pageSize').text('.page{width:' + (width - 0) + 'px;}');
+ //do nothing
+ } else {
+ var height = $(window).height() - $main.position().top;
+ if ($('#navbarBottom').css('display') != 'none') {
+ height -= $('#navbarBottom').outerHeight(true) - 1;
+ }
+ if ($('#bottom').css('display') != 'none') {
+ height -= $('#bottom').outerHeight(true) - 1;
+ }
+ $main.css('width', width).css('height', height);
+ $('#pageSize').text('.page{width:' + (width - 0) + 'px;height:' + height + 'px;}');
+ if (skipScrollFix === undefined) {
+ if (thisTemplateEngine.adjustColumns()) {
+ var allContainer = $('.widget_container');
+ allContainer.each(function(i, e) {
+ var $e = $(e);
+ var ourColspan = $e.children('*:first-child').data('colspan');
+ if (ourColspan <= 0)
+ return;
+ var areaColspan = $e.parentsUntil('#centerContainer').last().data('columns') || thisTemplateEngine.defaultColumns;
+ var ourWidth = Math.min(100, ourColspan / areaColspan * 100);
+ $e.css('width', ourWidth + '%');
+ });
+ // and elements inside groups
+ var adjustableElements = $('.group .widget_container');
+ adjustableElements.each(function(i, e) {
+ var $e = $(e);
+ var ourColspan = $e.children('.widget').data('colspan');
+ if (ourColspan <= 0)
+ return;
+ if (ourColspan == undefined) {
+ // workaround for nowidget groups
+ ourColspan = $e.children('.group').data('colspan');
+ }
+ var areaColspan = $e.parentsUntil('#centerContainer').last().data('columns') || thisTemplateEngine.defaultColumns;
+ var groupColspan = Math.min(areaColspan, $e.parentsUntil('.widget_container', '.group').data('colspan'));
+ var ourWidth = Math.min(100, ourColspan / groupColspan * 100); // in percent
+ $e.css('width', ourWidth + '%');
+ });
}
- var areaColspan = $e.parentsUntil('#centerContainer').last().data(
- 'columns')
- || defaultColumns;
- var groupColspan = Math.min(areaColspan, $e.parentsUntil(
- '.widget_container', '.group').data('colspan'));
- var ourWidth = Math.min(100, ourColspan / groupColspan * 100); // in
- // percent
- $e.css('width', ourWidth + '%');
- });
+ }
+ // main_scroll != undefined && main_scroll.seekTo( main_scroll.getIndex(),
+ // 0
+ // ); // fix scroll
}
- // main_scroll != undefined && main_scroll.seekTo( main_scroll.getIndex(), 0
- // ); // fix scroll
- }
-}
-$(window).bind('resize', handleResize);
+ };
+
-function rowspanClass(rowspan) {
- var className = 'rowspan rowspan' + rowspan;
- var styleId = className.replace(" ", "_") + 'Style';
- if (!$('#' + styleId).get(0)) {
- var dummyDiv = $(
- '<div class="clearfix" id="calcrowspan"><div id="containerDiv" class="widget_container"><div class="widget clearfix text" id="innerDiv" /></div></div>')
- .appendTo(document.body).show();
+ this.rowspanClass = function(rowspan) {
+ var className = 'rowspan rowspan' + rowspan;
+ var styleId = className.replace(" ", "_") + 'Style';
+ if (!$('#' + styleId).get(0)) {
+ var dummyDiv = $(
+ '<div class="clearfix" id="calcrowspan"><div id="containerDiv" class="widget_container"><div class="widget clearfix text" id="innerDiv" /></div></div>')
+ .appendTo(document.body).show();
- var singleHeight = $('#containerDiv').outerHeight(false);
- var singleHeightMargin = $('#containerDiv').outerHeight(true);
+ var singleHeight = $('#containerDiv').outerHeight(false);
+ var singleHeightMargin = $('#containerDiv').outerHeight(true);
- $('#calcrowspan').remove();
+ $('#calcrowspan').remove();
- // append css style
- $('head').append(
- '<style id="' + styleId + '">.rowspan.rowspan' + rowspan
- + ' { height: '
- + ((rowspan - 1) * singleHeightMargin + singleHeight)
- + 'px;} </style>').data(className, 1);
- }
- return className;
-}
+ // append css style
+ $('head').append(
+ '<style id="' + styleId + '">.rowspan.rowspan' + rowspan
+ + ' { height: '
+ + ((rowspan - 1) * singleHeightMargin + singleHeight)
+ + 'px;} </style>').data(className, 1);
+ }
+ return className;
+ };
-function parseXML(xml) {
- // erst mal den Cache für AJAX-Requests wieder aktivieren
- $.ajaxSetup({
- cache : true
- });
+ this.parseXML = function(xml) {
+ // erst mal den Cache für AJAX-Requests wieder aktivieren
+ $.ajaxSetup({
+ cache : true
+ });
- /*
- * First, we try to get a design by url Secondly, we try to get a predefined
- * design in the config file Otherwise we show the design selection dialog
- */
+ /*
+ * First, we try to get a design by url Secondly, we try to get a predefined
+ * design in the config file Otherwise we show the design selection dialog
+ */
- // read predefined design in config
- predefinedDesign = $('pages', xml).attr("design");
+ // read predefined design in config
+ predefinedDesign = $('pages', xml).attr("design");
- if ($('pages', xml).attr("backend")) {
- backend = $('pages', xml).attr("backend");
- }
- initBackendClient();
+ if ($('pages', xml).attr("backend")) {
+ backend = $('pages', xml).attr("backend");
+ }
+ thisTemplateEngine.initBackendClient();
- scrollSpeed = $('pages', xml).attr("scroll_speed");
- if ($('pages', xml).attr('enable_column_adjustment') == "true") {
- enableColumnAdjustment = true;
- } else if (/(android|blackberry|iphone|ipod|series60|symbian|windows ce|palm)/i
- .test(navigator.userAgent.toLowerCase())) {
- enableColumnAdjustment = true;
- }
- if ($('pages', xml).attr('default_columns')) {
- defaultColumns = $('pages', xml).attr('default_columns');
- }
- if ($('pages', xml).attr('min_column_width')) {
- minColumnWidth = $('pages', xml).attr('min_column_width');
- }
+ thisTemplateEngine.scrollSpeed = $('pages', xml).attr("scroll_speed");
+ if ($('pages', xml).attr('enable_column_adjustment') == "true") {
+ thisTemplateEngine.enableColumnAdjustment = true;
+ } else if (/(android|blackberry|iphone|ipod|series60|symbian|windows ce|palm)/i
+ .test(navigator.userAgent.toLowerCase())) {
+ thisTemplateEngine.enableColumnAdjustment = true;
+ }
+ if ($('pages', xml).attr('default_columns')) {
+ thisTemplateEngine.defaultColumns = $('pages', xml).attr('default_columns');
+ }
+ if ($('pages', xml).attr('min_column_width')) {
+ thisTemplateEngine.minColumnWidth = $('pages', xml).attr('min_column_width');
+ }
- // design by url
- if ($.getUrlVar("design")) {
- clientDesign = $.getUrlVar("design");
- }
- // design by config file
- else if (predefinedDesign) {
- clientDesign = predefinedDesign;
- }
- // selection dialog
- else {
- selectDesign();
- }
- var maxMobileScreenWidth = $('pages', xml).attr('max_mobile_screen_width') || 480;
+ // design by url
+ if ($.getUrlVar("design")) {
+ thisTemplateEngine.clientDesign = $.getUrlVar("design");
+ }
+ // design by config file
+ else if (predefinedDesign) {
+ thisTemplateEngine.clientDesign = predefinedDesign;
+ }
+ // selection dialog
+ else {
+ thisTemplateEngine.selectDesign();
+ }
+ var maxMobileScreenWidth = $('pages', xml).attr('max_mobile_screen_width') || 480;
- $('head')
- .append(
- '<link rel="stylesheet" type="text/css" href="designs/designglobals.css" />');
- $('head').append(
- '<link rel="stylesheet" type="text/css" href="designs/' + clientDesign
- + '/basic.css" />');
- $('head').append(
- '<link rel="stylesheet" type="text/css" href="designs/' + clientDesign
- + '/mobile.css" media="only screen and (max-device-width: '
- + maxMobileScreenWidth + 'px)" />');
- $('head').append(
- '<link rel="stylesheet" type="text/css" href="designs/' + clientDesign
- + '/custom.css" />');
- $('head').append(
- '<script src="designs/' + clientDesign
- + '/design_setup.js" type="text/javascript" />');
+ $('head')
+ .append(
+ '<link rel="stylesheet" type="text/css" href="designs/designglobals.css" />');
+ $('head').append(
+ '<link rel="stylesheet" type="text/css" href="designs/' + thisTemplateEngine.clientDesign
+ + '/basic.css" />');
+ $('head').append(
+ '<link rel="stylesheet" type="text/css" href="designs/' + thisTemplateEngine.clientDesign
+ + '/mobile.css" media="only screen and (max-device-width: '
+ + maxMobileScreenWidth + 'px)" />');
+ $('head').append(
+ '<link rel="stylesheet" type="text/css" href="designs/' + thisTemplateEngine.clientDesign
+ + '/custom.css" />');
+ $('head').append(
+ '<script src="designs/' + thisTemplateEngine.clientDesign
+ + '/design_setup.js" type="text/javascript" />');
- // start with the plugins
- var pluginsToLoad = 0;
- $('meta > plugins plugin', xml).each(function(i) {
- pluginsToLoad += 1;
- var name = 'plugins/' + $(this).attr('name') + '/structure_plugin.js';
- if (forceReload)
- name += '?_=' + (new Date().getTime());
- var html_doc = document.getElementsByTagName('body')[0];
- js = document.createElement('script');
- js.setAttribute('type', 'text/javascript');
- js.setAttribute('src', name);
- html_doc.appendChild(js);
+ // start with the plugins
+ var pluginsToLoad = 0;
+ $('meta > plugins plugin', xml).each(function(i) {
+ pluginsToLoad += 1;
+ var name = 'plugins/' + $(this).attr('name') + '/structure_plugin.js';
+ if (thisTemplateEngine.forceReload)
+ name += '?_=' + (new Date().getTime());
+ var html_doc = document.getElementsByTagName('body')[0];
+ js = document.createElement('script');
+ js.setAttribute('type', 'text/javascript');
+ js.setAttribute('src', name);
+ html_doc.appendChild(js);
- js.onreadystatechange = function() {
- if (js.readyState == 'complete') {
+ js.onreadystatechange = function() {
+ if (js.readyState == 'complete') {
+ pluginsToLoad -= 1;
+ if (pluginsToLoad <= 0) {
+ thisTemplateEngine.setup_page(xml);
+ }
+ }
+ };
+
+ js.onload = function() {
pluginsToLoad -= 1;
if (pluginsToLoad <= 0) {
- setup_page(xml);
+ thisTemplateEngine.setup_page(xml);
}
- }
- };
+ };
+ });
- js.onload = function() {
- pluginsToLoad -= 1;
- if (pluginsToLoad <= 0) {
- setup_page(xml);
- }
- };
- });
-
- // then the icons
- $('meta > icons icon-definition', xml).each(
- function(i) {
- var $this = $(this);
- var name = $this.attr('name');
- var uri = $this.attr('uri');
- var type = $this.attr('type');
+ // then the icons
+ $('meta > icons icon-definition', xml).each(function(i) {
+ var $this = $(this);
+ var name = $this.attr('name');
+ var uri = $this.attr('uri');
+ var type = $this.attr('type');
var flavour = $this.attr('flavour');
- var color = $this.attr('color');
+ var color = $this.attr('color');
var styling = $this.attr('styling');
var dynamic = $this.attr('dynamic');
- icons.insert(name, uri, type, flavour, color, styling, dynamic);
+ thisTemplateEngine.icons.insert(name, uri, type, flavour, color, styling, dynamic);
});
+
+ // then the mappings
+ $('meta > mappings mapping', xml).each(function(i) {
+ var $this = $(this);
+ var name = $this.attr('name');
+ thisTemplateEngine.mappings[name] = {};
+ var formula = $this.find('formula');
+ if (formula.length > 0) {
+ eval('var func = function(x){' + formula.text() + '; return y;}');
+ thisTemplateEngine.mappings[name]['formula'] = func;
+ } else {
+ $this.find('entry').each(function() {
+ var $localThis = $(this);
+ var origin = $localThis.contents();
+ var value = [];
+ for ( var i = 0; i < origin.length; i++) {
+ var $v = $(origin[i]);
+ if ($v.is('icon'))
+ value[i] = thisTemplateEngine.icons.getIcon($v.attr('name'), $v.attr('type'), $v.attr('flavour'), $v.attr('color'));
+ else
+ value[i] = $v.text();
+ }
+ if ($localThis.attr('value')) {
+ thisTemplateEngine.mappings[name][$localThis.attr('value')] = value.length == 1 ? value[0] : value;
+ } else {
+ if (!thisTemplateEngine.mappings[name]['range'])
+ thisTemplateEngine.mappings[name]['range'] = {};
+ thisTemplateEngine.mappings[name]['range'][parseFloat($localThis.attr('range_min'))] = [ parseFloat($localThis.attr('range_max')), value ];
+ }
+ });
+ }
+ });
- // then the mappings
- $('meta > mappings mapping', xml).each(
- function(i) {
- var $this = $(this);
- var name = $this.attr('name');
- mappings[name] = {};
- var formula = $this.find('formula');
- if (formula.length > 0) {
- eval('var func = function(x){' + formula.text() + '; return y;}');
- mappings[name]['formula'] = func;
- } else {
- $this.find('entry').each(
- function() {
- var $localThis = $(this);
- var origin = $localThis.contents();
- var value = [];
- for ( var i = 0; i < origin.length; i++) {
- var $v = $(origin[i]);
- if ($v.is('icon'))
- value[i] = icons.getIcon($v.attr('name'), $v.attr('type'), $v.attr('flavour'), $v.attr('color'));
- else
- value[i] = $v.text();
- }
-
- if ($localThis.attr('value')) {
- mappings[name][$localThis.attr('value')] = value.length == 1 ? value[0] : value;
- } else {
- if (!mappings[name]['range'])
- mappings[name]['range'] = {};
- mappings[name]['range'][parseFloat($localThis
- .attr('range_min'))] = [
- parseFloat($localThis.attr('range_max')), value ];
- }
- });
+ // then the stylings
+ $('meta > stylings styling', xml).each(function(i) {
+ var name = $(this).attr('name');
+ var classnames = '';
+ thisTemplateEngine.stylings[name] = {};
+ $(this).find('entry').each(function() {
+ classnames += $(this).text() + ' ';
+ if ($(this).attr('value')) {
+ thisTemplateEngine.stylings[name][$(this).attr('value')] = $(this).text();
+ } else { // a range
+ if (!thisTemplateEngine.stylings[name]['range'])
+ thisTemplateEngine.stylings[name]['range'] = {};
+ thisTemplateEngine.stylings[name]['range'][parseFloat($(this).attr('range_min'))] = [parseFloat($(this).attr('range_max')),$(this).text()];
}
});
+ thisTemplateEngine.stylings[name]['classnames'] = classnames;
+ });
- // then the stylings
- $('meta > stylings styling', xml)
- .each(
- function(i) {
- var name = $(this).attr('name');
- var classnames = '';
- stylings[name] = {};
- $(this).find('entry')
- .each(
- function() {
- classnames += $(this).text() + ' ';
- if ($(this).attr('value')) {
- stylings[name][$(this).attr('value')] = $(this).text();
- } else { // a range
- if (!stylings[name]['range'])
- stylings[name]['range'] = {};
- stylings[name]['range'][parseFloat($(this).attr(
- 'range_min'))] = [
- parseFloat($(this).attr('range_max')),
- $(this).text() ];
+ // then the status bar
+ $('meta > statusbar status', xml).each(function(i) {
+ var type = $(this).attr('type');
+ var condition = $(this).attr('condition');
+ var extend = $(this).attr('hrefextend');
+ var sPath = window.location.pathname;
+ var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
- }
- });
- stylings[name]['classnames'] = classnames;
- });
+ // @TODO: make this match once the new editor is finished-ish.
+ var editMode = 'edit_config.html' == sPage;
- // then the status bar
- $('meta > statusbar status', xml).each(function(i) {
- var type = $(this).attr('type');
- var condition = $(this).attr('condition');
- var extend = $(this).attr('hrefextend');
- var sPath = window.location.pathname;
- var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
+ // skip this element if it's edit-only and we are non-edit, or the other
+ // way
+ // round
+ if (editMode && '!edit' == condition)
+ return;
+ if (!editMode && 'edit' == condition)
+ return;
- // @TODO: make this match once the new editor is finished-ish.
- var editMode = 'edit_config.html' == sPage;
+ var text = $(this).text();
+ switch (extend) {
+ case 'all': // append all parameters
+ var search = window.location.search.replace(/\$/g, '$$$$');
+ text = text.replace(/(href="[^"]*)(")/g, '$1' + search + '$2');
+ break;
+ case 'config': // append config file info
+ var search = window.location.search.replace(/\$/g, '$$$$');
+ search = search.replace(/.*(config=[^&]*).*|.*/, '?$1');
- // skip this element if it's edit-only and we are non-edit, or the other way
- // round
- if (editMode && '!edit' == condition)
- return;
- if (!editMode && 'edit' == condition)
- return;
+ // text = $(text).replaceWith( /(href="[^"]*)(")/g, '$1' + search + '$2'
+ // );
- var text = $(this).text();
- switch (extend) {
- case 'all': // append all parameters
- var search = window.location.search.replace(/\$/g, '$$$$');
- text = text.replace(/(href="[^"]*)(")/g, '$1' + search + '$2');
- break;
- case 'config': // append config file info
- var search = window.location.search.replace(/\$/g, '$$$$');
- search = search.replace(/.*(config=[^&]*).*|.*/, '?$1');
+ text = text.replace(/(href="[^"]*)(")/g, '$1' + search + '$2');
+ break;
+ }
+ $('.footer').html($('.footer').html() + text);
+ });
- // text = $(text).replaceWith( /(href="[^"]*)(")/g, '$1' + search + '$2'
- // );
-
- text = text.replace(/(href="[^"]*)(")/g, '$1' + search + '$2');
- break;
+ if (pluginsToLoad <= 0) {
+ thisTemplateEngine.setup_page(xml);
}
- $('.footer').html($('.footer').html() + text);
- });
+ };
- if (pluginsToLoad <= 0) {
- setup_page(xml);
- }
-}
+
+ this.setup_page = function(xml) {
+ // and now setup the pages
+ var page = $('pages > page', xml)[0]; // only one page element allowed...
-function setup_page(xml) {
- // and now setup the pages
- var page = $('pages > page', xml)[0]; // only one page element allowed...
+ thisTemplateEngine.create_pages(page, 'id_0');
- create_pages(page, 'id_0');
+ thisTemplateEngine.adjustColumns();
+ // all containers
+ var allContainer = $('.widget_container');
+ allContainer.each(function(i, e) {
+ var $e = $(e);
+ var ourColspan = $e.children('*:first-child').data('colspan');
+ if (ourColspan <= 0)
+ return;
+ var areaColspan = $e.parentsUntil('#centerContainer').last().data('columns') || thisTemplateEngine.defaultColumns;
+ var ourWidth = Math.min(100, ourColspan / areaColspan * 100);
+ $e.css('width', ourWidth + '%');
+ });
+ // and elements inside groups
+ var adjustableElements = $('.group .widget_container');
+ adjustableElements.each(function(i, e) {
+ var $e = $(e);
+ var ourColspan = $e.children('.widget').data('colspan');
+ if (ourColspan <= 0)
+ return;
+ if (ourColspan == undefined) {
+ // workaround for nowidget groups
+ ourColspan = $e.children('.group').data('colspan');
+ }
+ var areaColspan = $e.parentsUntil('#centerContainer').last().data('columns') || thisTemplateEngine.defaultColumns;
+ var groupColspan = Math.min(areaColspan, $e.parentsUntil(
+ '.widget_container', '.group').data('colspan'));
+ var ourWidth = Math.min(100, ourColspan / groupColspan * 100); // in
+ // percent
+ $e.css('width', ourWidth + '%');
+ });
- adjustColumns();
- // all containers
- var allContainer = $('.widget_container');
- allContainer.each(function(i, e) {
- var $e = $(e);
- var ourColspan = $e.children('*:first-child').data('colspan');
- if (ourColspan <= 0)
- return;
- var areaColspan = $e.parentsUntil('#centerContainer').last()
- .data('columns')
- || defaultColumns;
- var ourWidth = Math.min(100, ourColspan / areaColspan * 100);
- $e.css('width', ourWidth + '%');
- });
- // and elements inside groups
- var adjustableElements = $('.group .widget_container');
- adjustableElements.each(function(i, e) {
- var $e = $(e);
- var ourColspan = $e.children('.widget').data('colspan');
- if (ourColspan <= 0)
- return;
- if (ourColspan == undefined) {
- // workaround for nowidget groups
- ourColspan = $e.children('.group').data('colspan');
+ // setup the scrollable
+ thisTemplateEngine.main_scroll = $('#main').scrollable({
+ keyboard : false,
+ touch : false
+ }).data('scrollable');
+ thisTemplateEngine.main_scroll.onSeek(thisTemplateEngine.pagePartsHandler.updateTopNavigation);
+ if (thisTemplateEngine.scrollSpeed != undefined) {
+ thisTemplateEngine.main_scroll.getConf().speed = thisTemplateEngine.scrollSpeed;
}
- var areaColspan = $e.parentsUntil('#centerContainer').last()
- .data('columns')
- || defaultColumns;
- var groupColspan = Math.min(areaColspan, $e.parentsUntil(
- '.widget_container', '.group').data('colspan'));
- var ourWidth = Math.min(100, ourColspan / groupColspan * 100); // in
- // percent
- $e.css('width', ourWidth + '%');
- });
- // setup the scrollable
- main_scroll = $('#main').scrollable({
- keyboard : false,
- touch : false
- }).data('scrollable');
- main_scroll.onSeek(updateTopNavigation);
- if (scrollSpeed != undefined) {
- main_scroll.getConf().speed = scrollSpeed;
- }
-
- if ($.getUrlVar('startpage')) {
- scrollToPage('id_' + $.getUrlVar('startpage'), 0);
- } else {
- scrollToPage('id_0', 0); // simple solution to show page name on top at
- // start
- }
-
- $('.fast').bind('click', function() {
- main_scroll.seekTo($(this).text());
- });
-
- // reaction on browser back button
- window.onpopstate = function(e) {
- // where do we come frome?
- lastpage = e.state;
- if (lastpage) {
- // browser back button takes back to the last page
- scrollToPage(lastpage, 0, true);
+ if ($.getUrlVar('startpage')) {
+ thisTemplateEngine.scrollToPage('id_' + $.getUrlVar('startpage'), 0);
+ } else {
+ thisTemplateEngine.scrollToPage('id_0', 0); // simple solution to show
+ // page name on top at
+ // start
}
- };
- $('embed')
- .each(
- function() {
- this.onload = function() {
- var svg = this.getSVGDocument();
+ $('.fast').bind('click', function() {
+ thisTemplateEngine.main_scroll.seekTo($(this).text());
+ });
- // Pipe-O-Matic:
- var pipes = svg.getElementsByClassName('pipe_group');
- $(pipes)
- .each(
- function() {
- var pipe_group = this;
- $(this)
- .find('path')
- .each(
- function() {
- var path = this;
- var halfsize = parseInt(parseFloat(path.style.strokeWidth) / 2);
- var opacity = 0.15;
- for ( var width = halfsize - 1; width > 0; width--) {
- opacity -= 0.1 / halfsize;
- var n = path.cloneNode();
- n.className.baseVal += ' pipe-o-matic_clone';
- n.style.strokeWidth = width * 2;
- n.style.stroke = '#ffffff';
- n.style.strokeOpacity = opacity;
- pipe_group.insertBefore(n,
- path.nextElementSibling);
- }
- });
- });
+ // reaction on browser back button
+ window.onpopstate = function(e) {
+ // where do we come frome?
+ lastpage = e.state;
+ if (lastpage) {
+ // browser back button takes back to the last page
+ thisTemplateEngine.scrollToPage(lastpage, 0, true);
+ }
+ };
- // Flow-O-Matic: add Paths
- var segmentLength = 40;
- var pipes = svg.getElementsByClassName('show_flow');
- $(pipes)
- .each(
- function() {
- var pipe_group = this;
- var length = 0.0;
- $(this)
- .find('path')
- .each( function() {
- var path = this;
- if (path.className.animVal.split(' ')
- .indexOf('pipe-o-matic_clone') > 0)
- return;
- var stroke = path.style.stroke;
- var r, g, b;
- if (stroke[0] == '#') {
- r = parseInt(path.style.stroke.substring(1,
- 3), 16);
- g = parseInt(path.style.stroke.substring(3,
- 5), 16);
- b = parseInt(path.style.stroke.substring(5,
- 7), 16);
- } else if (stroke.indexOf('rgb(') == 0) {
- var colors = stroke.replace(/[^0-9,.]*/g,
- '').split(',');
- r = colors[0];
- g = colors[1];
- b = colors[2];
- }
- var rTarget = 0; // this color should be
- // somehow user setable -
- // but how?
- var gTarget = 0;
- var bTarget = 0;
- function toHex(v) {
- var ret = parseInt(v).toString(16);
- return (ret.length < 2) ? '0' + ret : ret;
- }
- for ( var i = segmentLength / 2; i > 0; i -= 2) {
- var factor = 1 - i / (segmentLength / 2);
- var offset = (length + segmentLength / 2 - i)
- % segmentLength;
- var low = 2 * i;
- var high = segmentLength - low;
- var n = path.cloneNode();
- n.className.baseVal += ' flow-o-matic_clone';
- n.style.stroke = '#'
- + toHex(r * factor + rTarget
- * (1 - factor))
- + toHex(g * factor + gTarget
- * (1 - factor))
- + toHex(b * factor + bTarget
- * (1 - factor));
- if (high > offset) {
- n.style.strokeDasharray = [
- high - offset, low, offset, 0 ];
- } else {
- n.style.strokeDasharray = [ 0,
- low - (offset - high), high,
- offset - high ];
- }
- n.style.strokeDashoffset = length
- % (0.5 * segmentLength);
- pipe_group.insertBefore(n,
- path.nextElementSibling);
- }
- length += path.getTotalLength();
- });
- if( this.attributes.getNamedItem('data-cometvisu-active') )
- {
- activeValues = this.attributes.getNamedItem('data-cometvisu-active').value;
- $( activeValues.split(' ') ).each( function() {
- $('body').bind( '_' + this, function( e, data, passedElement ){
- if( data == '01' )
- //pipe_group.classList.add('flow_active');
- pipe_group.setAttribute('class', pipe_group.getAttribute('class').replace(' flow_active','') + ' flow_active' );
- else
- pipe_group.setAttribute('class', pipe_group.getAttribute('class').replace(' flow_active','') );
- //pipe_group.classList.remove('flow_active');
- } );
- } );
- }
- });
+ $('embed').each(function() {
+ this.onload = function() {
+ var svg = this.getSVGDocument();
- // Flow-O-Matic: add CSS
- // helper for multiple bowser support
- function createKeyframe(name, content) {
- return '@keyframes ' + name + " {\n" + content + "}\n"
- + '@-moz-keyframes ' + name + " {\n" + content + "}\n"
- + '@-webkit-keyframes ' + name + " {\n" + content + "}\n";
+ // Pipe-O-Matic:
+ var pipes = svg.getElementsByClassName('pipe_group');
+ $(pipes).each(function() {
+ var pipe_group = this;
+ $(this).find('path').each(function() {
+ var path = this;
+ var halfsize = parseInt(parseFloat(path.style.strokeWidth) / 2);
+ var opacity = 0.15;
+ for ( var width = halfsize - 1; width > 0; width--) {
+ opacity -= 0.1 / halfsize;
+ var n = path.cloneNode();
+ n.className.baseVal += ' pipe-o-matic_clone';
+ n.style.strokeWidth = width * 2;
+ n.style.stroke = '#ffffff';
+ n.style.strokeOpacity = opacity;
+ pipe_group.insertBefore(n,
+ path.nextElementSibling);
+ }
+ });
+ });
+
+ // Flow-O-Matic: add Paths
+ var segmentLength = 40;
+ var pipes = svg.getElementsByClassName('show_flow');
+ $(pipes).each(function() {
+ var pipe_group = this;
+ var length = 0.0;
+ $(this).find('path').each(function() {
+ var path = this;
+ if (path.className.animVal.split(' ')
+ .indexOf('pipe-o-matic_clone') > 0)
+ return;
+ var stroke = path.style.stroke;
+ var r, g, b;
+ if (stroke[0] == '#') {
+ r = parseInt(path.style.stroke.substring( 1, 3), 16);
+ g = parseInt(path.style.stroke.substring( 3, 5), 16);
+ b = parseInt(path.style.stroke.substring( 5, 7), 16);
+ } else if (stroke.indexOf('rgb(') == 0) {
+ var colors = stroke.replace(/[^0-9,.]*/g,'').split(',');
+ r = colors[0];
+ g = colors[1];
+ b = colors[2];
+ }
+ var rTarget = 0; // this color should be
+ // somehow user setable -
+ // but how?
+ var gTarget = 0;
+ var bTarget = 0;
+ function toHex(v) {
+ var ret = parseInt(v).toString(16);
+ return (ret.length < 2) ? '0' + ret : ret;
+ }
+ for ( var i = segmentLength / 2; i > 0; i -= 2) {
+ var factor = 1 - i / (segmentLength / 2);
+ var offset = (length + segmentLength / 2 - i)
+ % segmentLength;
+ var low = 2 * i;
+ var high = segmentLength - low;
+ var n = path.cloneNode();
+ n.className.baseVal += ' flow-o-matic_clone';
+ n.style.stroke = '#'+ toHex(r * factor + rTarget * (1 - factor))+ toHex(g * factor + gTarget* (1 - factor))+ toHex(b * factor + bTarget* (1 - factor));
+ if (high > offset) {
+ n.style.strokeDasharray = [high - offset, low, offset, 0 ];
+ } else {
+ n.style.strokeDasharray = [ 0,low - (offset - high), high, offset - high ];
}
- var keyframes = createKeyframe('move',
- "from { stroke-dashoffset: " + segmentLength + "; }\n"
- + "to { stroke-dashoffset: 0; }\n");
- function createCSSRules(style, value) {
- return style + ': ' + value + ";\n" + '-moz-' + style + ': '
- + value + ";\n" + '-webkit-' + style + ': ' + value + ";\n";
- }
- keyframes += ".flow_active path {\n"
- + createCSSRules('animation-duration', '3s')
- + createCSSRules('animation-name', 'move')
- + createCSSRules('animation-timing-function', 'linear')
- + createCSSRules('animation-iteration-count', 'infinite')
- + "}\n";
- var s = svg
- .createElementNS('http://www.w3.org/2000/svg', 'style');
- s.setAttribute('type', 'text/css');
- s.textContent = keyframes;
- $('svg', svg).prepend(s);
- };
+ n.style.strokeDashoffset = length % (0.5 * segmentLength);
+ pipe_group.insertBefore(n, path.nextElementSibling);
+ }
+ length += path.getTotalLength();
});
+ if (this.attributes.getNamedItem('data-cometvisu-active')) {
+ activeValues = this.attributes.getNamedItem('data-cometvisu-active').value;
+ $(activeValues.split(' ')).each(function() {
+ $('body').bind('_' + this,function(e, data, passedElement) {
+ if (data == '01')
+ // pipe_group.classList.add('flow_active');
+ pipe_group.setAttribute('class',pipe_group.getAttribute('class').replace(' flow_active', '')+ ' flow_active');
+ else
+ pipe_group.setAttribute('class',pipe_group.getAttribute('class').replace(' flow_active', ''));
+ // pipe_group.classList.remove('flow_active');
+ });
+ });
+ }
+ });
- visu.subscribe(ga_list);
- $(window).trigger('resize');
- $("#pages").triggerHandler("done");
-}
+ // Flow-O-Matic: add CSS
+ // helper for multiple bowser support
+ function createKeyframe(name, content) {
+ return '@keyframes ' + name + " {\n" + content + "}\n"
+ + '@-moz-keyframes ' + name + " {\n" + content + "}\n"
+ + '@-webkit-keyframes ' + name + " {\n" + content + "}\n";
+ }
+ var keyframes = createKeyframe('move',
+ "from { stroke-dashoffset: " + segmentLength + "; }\n"
+ + "to { stroke-dashoffset: 0; }\n");
+ function createCSSRules(style, value) {
+ return style + ': ' + value + ";\n" + '-moz-' + style + ': '
+ + value + ";\n" + '-webkit-' + style + ': ' + value
+ + ";\n";
+ }
+ keyframes += ".flow_active path {\n"
+ + createCSSRules('animation-duration', '3s')
+ + createCSSRules('animation-name', 'move')
+ + createCSSRules('animation-timing-function', 'linear')
+ + createCSSRules('animation-iteration-count', 'infinite')
+ + "}\n";
+ var s = svg.createElementNS('http://www.w3.org/2000/svg',
+ 'style');
+ s.setAttribute('type', 'text/css');
+ s.textContent = keyframes;
+ $('svg', svg).prepend(s);
+ };
+ });
-function create_pages(page, path, flavour, type) {
+ thisTemplateEngine.visu.subscribe(thisTemplateEngine.ga_list);
+ $(window).trigger('resize');
+ $("#pages").triggerHandler("done");
+ };
- var creator = design.getCreator(page.nodeName);
- var retval = creator.create(page, path, flavour, type);
+ this.create_pages = function(page, path, flavour, type) {
- if (jQuery(retval).is(".widget") || (jQuery(retval).is(".group"))) {
- retval = jQuery(
- "<div class='widget_container "
- + (retval.data("rowspanClass") ? retval.data("rowspanClass") : '')
- + "' />").append(retval);
- }
+ var creator = thisTemplateEngine.design.getCreator(page.nodeName);
+ var retval = creator.create(page, path, flavour, type);
- return retval;
-}
+ if (jQuery(retval).is(".widget") || (jQuery(retval).is(".group"))) {
+ retval = jQuery(
+ "<div class='widget_container "
+ + (retval.data("rowspanClass") ? retval.data("rowspanClass") : '')
+ + "' />").append(retval);
+ }
-function scrollToPage(page_id, speed, skipHistory) {
- $('.activePage', '#pages').removeClass('activePage');
- $('.pageActive', '#pages').removeClass('pageActive');
- $('.pagejump.active').removeClass('active');
- $('.pagejump.active_ancestor').removeClass('active_ancestor');
-
- if (page_id.match(/^id_[0-9_]+$/) == null) {
- // find Page-ID by name
- $('.page h1:contains(' + page_id + ')', '#pages').each(function(i) {
- if ($(this).text() == page_id) {
- page_id = $(this).closest(".page").attr("id");
- }
- });
+ return retval;
}
- var page = $('#' + page_id);
- page.addClass('pageActive activePage');// show new page
- // update visibility ob navbars, top-navigation, footer
- updatePageParts(page);
+ this.scrollToPage = function(page_id, speed, skipHistory) {
+ $('.activePage', '#pages').removeClass('activePage');
+ $('.pageActive', '#pages').removeClass('pageActive');
+ $('.pagejump.active').removeClass('active');
+ $('.pagejump.active_ancestor').removeClass('active_ancestor');
- if (main_scroll.getConf().speed > 0) {
- var scrollLeft = true;
- if (skipHistory) {
- // moving back in history -> scroll right
- scrollLeft = false;
- } else {
- var expr = new RegExp("^" + page_id + ".*", "i");
- if (expr.test(window.history.state)) {
- // moving up the page tree -> scroll right
+ if (page_id.match(/^id_[0-9_]+$/) == null) {
+ // find Page-ID by name
+ $('.page h1:contains(' + page_id + ')', '#pages').each(function(i) {
+ if ($(this).text() == page_id) {
+ page_id = $(this).closest(".page").attr("id");
+ }
+ });
+ }
+ var page = $('#' + page_id);
+
+ page.addClass('pageActive activePage');// show new page
+ // update visibility ob navbars, top-navigation, footer
+ thisTemplateEngine.pagePartsHandler.updatePageParts(page);
+
+ if (thisTemplateEngine.main_scroll.getConf().speed > 0) {
+ var scrollLeft = true;
+ if (skipHistory) {
+ // moving back in history -> scroll right
scrollLeft = false;
+ } else {
+ var expr = new RegExp("^" + page_id + ".*", "i");
+ if (expr.test(window.history.state)) {
+ // moving up the page tree -> scroll right
+ scrollLeft = false;
+ }
}
+ // jump to the page on the left of the page we need to scroll to
+ if (scrollLeft) {
+ $('#pages').css('left', -page.position().left + page.width());
+ } else {
+ $('#pages').css('left', -page.position().left - page.width());
+ }
}
- // jump to the page on the left of the page we need to scroll to
- if (scrollLeft) {
- $('#pages').css('left', -page.position().left + page.width());
- } else {
- $('#pages').css('left', -page.position().left - page.width());
- }
- }
- // push new state to history
- if (skipHistory === undefined)
- window.history.pushState(page_id, page_id, window.location.href);
+ // push new state to history
+ if (skipHistory === undefined)
+ window.history.pushState(page_id, page_id, window.location.href);
- main_scroll.seekTo(page, speed); // scroll to it
+ thisTemplateEngine.main_scroll.seekTo(page, speed); // scroll to it
- // show the navbars for this page
- /*
- * $('#'+page_id+'_top_navbar').addClass('navbarActive');
- * $('#'+page_id+'_right_navbar').addClass('navbarActive');
- * $('#'+page_id+'_bottom_navbar').addClass('navbarActive');
- * $('#'+page_id+'_left_navbar').addClass('navbarActive');
- */
- initializeNavbars(page_id);
+ // show the navbars for this page
+ /*
+ * $('#'+page_id+'_top_navbar').addClass('navbarActive');
+ * $('#'+page_id+'_right_navbar').addClass('navbarActive');
+ * $('#'+page_id+'_bottom_navbar').addClass('navbarActive');
+ * $('#'+page_id+'_left_navbar').addClass('...
[truncated message content] |