diff options
Diffstat (limited to 'ecomp-portal-BE/war/static/fusion/sample/js')
7 files changed, 1053 insertions, 0 deletions
diff --git a/ecomp-portal-BE/war/static/fusion/sample/js/FusionCharts.js b/ecomp-portal-BE/war/static/fusion/sample/js/FusionCharts.js new file mode 100644 index 00000000..4c174dfa --- /dev/null +++ b/ecomp-portal-BE/war/static/fusion/sample/js/FusionCharts.js @@ -0,0 +1,361 @@ +/** + * FusionCharts: Flash Player detection and Chart embedding. + * Version 1.2.3F ( 22 November 2008) - Specialized for FusionChartsFREE + * Checking Flash Version >=6 and added updateChartXML() for FREE Charts. + * Version: 1.2.3 (1st September, 2008) - Added Fix for % and & characters, scaled dimensions, fixes in to properly handling of double quotes and single quotes in setDataXML() function. + * Version: 1.2.2 (10th July, 2008) - Added Fix for % scaled dimensions, fixes in setDataXML() and setDataURL() functions + * Version: 1.2.1 (21st December, 2007) - Added setting up Transparent/opaque mode: setTransparent() function + * Version: 1.2 (1st November, 2007) - Added FORM fixes for IE + * Version: 1.1 (29th June, 2007) - Added Player detection, New conditional fixes for IE + * + * Morphed from SWFObject (http://blog.deconcept.com/swfobject/) under MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + */ +if(typeof infosoftglobal == "undefined") var infosoftglobal = new Object(); +if(typeof infosoftglobal.FusionChartsUtil == "undefined") infosoftglobal.FusionChartsUtil = new Object(); +infosoftglobal.FusionCharts = function(swf, id, w, h, debugMode, registerWithJS, c, scaleMode, lang, detectFlashVersion, autoInstallRedirect){ + if (!document.getElementById) { return; } + + //Flag to see whether data has been set initially + this.initialDataSet = false; + + //Create container objects + this.params = new Object(); + this.variables = new Object(); + this.attributes = new Array(); + + //Set attributes for the SWF + if(swf) { this.setAttribute('swf', swf); } + if(id) { this.setAttribute('id', id); } + + w=w.toString().replace(/\%$/,"%25"); + if(w) { this.setAttribute('width', w); } + h=h.toString().replace(/\%$/,"%25"); + if(h) { this.setAttribute('height', h); } + + + //Set background color + if(c) { this.addParam('bgcolor', c); } + + //Set Quality + this.addParam('quality', 'high'); + + //Add scripting access parameter + this.addParam('allowScriptAccess', 'always'); + + //Pass width and height to be appended as chartWidth and chartHeight + this.addVariable('chartWidth', w); + this.addVariable('chartHeight', h); + + //Whether in debug mode + debugMode = debugMode ? debugMode : 0; + this.addVariable('debugMode', debugMode); + //Pass DOM ID to Chart + this.addVariable('DOMId', id); + //Whether to registed with JavaScript + registerWithJS = registerWithJS ? registerWithJS : 0; + this.addVariable('registerWithJS', registerWithJS); + + //Scale Mode of chart + scaleMode = scaleMode ? scaleMode : 'noScale'; + this.addVariable('scaleMode', scaleMode); + + //Application Message Language + lang = lang ? lang : 'EN'; + this.addVariable('lang', lang); + + //Whether to auto detect and re-direct to Flash Player installation + this.detectFlashVersion = detectFlashVersion?detectFlashVersion:1; + this.autoInstallRedirect = autoInstallRedirect?autoInstallRedirect:1; + + //Ger Flash Player version + this.installedVer = infosoftglobal.FusionChartsUtil.getPlayerVersion(); + + if (!window.opera && document.all && this.installedVer.major > 7) { + // Only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE + infosoftglobal.FusionCharts.doPrepUnload = true; + } +} + +infosoftglobal.FusionCharts.prototype = { + setAttribute: function(name, value){ + this.attributes[name] = value; + }, + getAttribute: function(name){ + return this.attributes[name]; + }, + addParam: function(name, value){ + this.params[name] = value; + }, + getParams: function(){ + return this.params; + }, + addVariable: function(name, value){ + this.variables[name] = value; + }, + getVariable: function(name){ + return this.variables[name]; + }, + getVariables: function(){ + return this.variables; + }, + getVariablePairs: function(){ + var variablePairs = new Array(); + var key; + var variables = this.getVariables(); + for(key in variables){ + variablePairs.push(key +"="+ variables[key]); + } + return variablePairs; + }, + getSWFHTML: function() { + var swfNode = ""; + if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { + // netscape plugin architecture + swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" '; + swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" '; + var params = this.getParams(); + for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; } + var pairs = this.getVariablePairs().join("&"); + if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; } + swfNode += '/>'; + } else { // PC IE + swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">'; + swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />'; + var params = this.getParams(); + for(var key in params) { + swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />'; + } + var pairs = this.getVariablePairs().join("&"); + if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';} + swfNode += "</object>"; + } + return swfNode; + }, + setDataURL: function(strDataURL){ + //This method sets the data URL for the chart. + //If being set initially + if (this.initialDataSet==false){ + this.addVariable('dataURL',strDataURL); + //Update flag + this.initialDataSet = true; + }else{ + //Else, we update the chart data using External Interface + //Get reference to chart object + var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id')); + + if (!chartObj.setDataURL) + { + __flash__addCallback(chartObj, "setDataURL"); + } + + chartObj.setDataURL(strDataURL); + } + }, + //This function : + //fixes the double quoted attributes to single quotes + //Encodes all quotes inside attribute values + //Encodes % to %25 and & to %26; + encodeDataXML: function(strDataXML){ + + var regExpReservedCharacters=["\\$","\\+"]; + var arrDQAtt=strDataXML.match(/=\s*\".*?\"/g); + if (arrDQAtt){ + for(var i=0;i<arrDQAtt.length;i++){ + var repStr=arrDQAtt[i].replace(/^=\s*\"|\"$/g,""); + repStr=repStr.replace(/\'/g,"%26apos;"); + var strTo=strDataXML.indexOf(arrDQAtt[i]); + var repStrr="='"+repStr+"'"; + var strStart=strDataXML.substring(0,strTo); + var strEnd=strDataXML.substring(strTo+arrDQAtt[i].length); + var strDataXML=strStart+repStrr+strEnd; + } + } + + strDataXML=strDataXML.replace(/\"/g,"%26quot;"); + strDataXML=strDataXML.replace(/%(?![\da-f]{2}|[\da-f]{4})/ig,"%25"); + strDataXML=strDataXML.replace(/\&/g,"%26"); + + return strDataXML; + + }, + setDataXML: function(strDataXML){ + //If being set initially + if (this.initialDataSet==false){ + //This method sets the data XML for the chart INITIALLY. + this.addVariable('dataXML',this.encodeDataXML(strDataXML)); + //Update flag + this.initialDataSet = true; + }else{ + //Else, we update the chart data using External Interface + //Get reference to chart object + var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id')); + chartObj.setDataXML(strDataXML); + } + }, + setTransparent: function(isTransparent){ + //Sets chart to transparent mode when isTransparent is true (default) + //When no parameter is passed, we assume transparent to be true. + if(typeof isTransparent=="undefined") { + isTransparent=true; + } + //Set the property + if(isTransparent) + this.addParam('WMode', 'transparent'); + else + this.addParam('WMode', 'Opaque'); + }, + + render: function(elementId){ + //First check for installed version of Flash Player - we need a minimum of 6 + if((this.detectFlashVersion==1) && (this.installedVer.major < 6)){ + if (this.autoInstallRedirect==1){ + //If we can auto redirect to install the player? + var installationConfirm = window.confirm("You need Adobe Flash Player 6 (or above) to view the charts. It is a free and lightweight installation from Adobe.com. Please click on Ok to install the same."); + if (installationConfirm){ + window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"; + }else{ + return false; + } + }else{ + //Else, do not take an action. It means the developer has specified a message in the DIV (and probably a link). + //So, expect the developers to provide a course of way to their end users. + //window.alert("You need Adobe Flash Player 8 (or above) to view the charts. It is a free and lightweight installation from Adobe.com. "); + return false; + } + }else{ + //Render the chart + var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId; + n.innerHTML = this.getSWFHTML(); + + //Added <FORM> compatibility + //Check if it's added in Mozilla embed array or if already exits + if(!document.embeds[this.getAttribute('id')] && !window[this.getAttribute('id')]) + window[this.getAttribute('id')]=document.getElementById(this.getAttribute('id')); + //or else document.forms[formName/formIndex][chartId] + return true; + } + } +} + +/* ---- detection functions ---- */ +infosoftglobal.FusionChartsUtil.getPlayerVersion = function(){ + var PlayerVersion = new infosoftglobal.PlayerVersion([0,0,0]); + if(navigator.plugins && navigator.mimeTypes.length){ + var x = navigator.plugins["Shockwave Flash"]; + if(x && x.description) { + PlayerVersion = new infosoftglobal.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")); + } + }else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ + //If Windows CE + var axo = 1; + var counter = 3; + while(axo) { + try { + counter++; + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter); + PlayerVersion = new infosoftglobal.PlayerVersion([counter,0,0]); + } catch (e) { + axo = null; + } + } + } else { + // Win IE (non mobile) + // Do minor version lookup in IE, but avoid Flash Player 6 crashing issues + try{ + var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); + }catch(e){ + try { + var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); + PlayerVersion = new infosoftglobal.PlayerVersion([6,0,21]); + axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code) + } catch(e) { + if (PlayerVersion.major == 6) { + return PlayerVersion; + } + } + try { + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + } catch(e) {} + } + if (axo != null) { + PlayerVersion = new infosoftglobal.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(",")); + } + } + return PlayerVersion; +} +infosoftglobal.PlayerVersion = function(arrVersion){ + this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0; + this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0; + this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0; +} +// ------------ Fix for Out of Memory Bug in IE in FP9 ---------------// +/* Fix for video streaming bug */ +infosoftglobal.FusionChartsUtil.cleanupSWFs = function() { + var objects = document.getElementsByTagName("OBJECT"); + for (var i = objects.length - 1; i >= 0; i--) { + objects[i].style.display = 'none'; + for (var x in objects[i]) { + if (typeof objects[i][x] == 'function') { + objects[i][x] = function(){}; + } + } + } +} +// Fixes bug in fp9 +if (infosoftglobal.FusionCharts.doPrepUnload) { + if (!infosoftglobal.unloadSet) { + infosoftglobal.FusionChartsUtil.prepUnload = function() { + __flash_unloadHandler = function(){}; + __flash_savedUnloadHandler = function(){}; + window.attachEvent("onunload", infosoftglobal.FusionChartsUtil.cleanupSWFs); + } + window.attachEvent("onbeforeunload", infosoftglobal.FusionChartsUtil.prepUnload); + infosoftglobal.unloadSet = true; + } +} +/* Add document.getElementById if needed (mobile IE < 5) */ +if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }} +/* Add Array.push if needed (ie5) */ +if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }} + +/* Function to return Flash Object from ID */ +infosoftglobal.FusionChartsUtil.getChartObject = function(id) +{ + var chartRef=null; + if (navigator.appName.indexOf("Microsoft Internet")==-1) { + if (document.embeds && document.embeds[id]) + chartRef = document.embeds[id]; + else + chartRef = window.document[id]; + } + else { + chartRef = window[id]; + } + if (!chartRef) + chartRef = document.getElementById(id); + + return chartRef; +} +/* + Function to update chart's data at client side (FOR FusionCharts vFREE and 2.x +*/ +infosoftglobal.FusionChartsUtil.updateChartXML = function(chartId, strXML){ + //Get reference to chart object + var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(chartId); + //Set dataURL to null + chartObj.SetVariable("_root.dataURL",""); + //Set the flag + chartObj.SetVariable("_root.isNewData","1"); + //Set the actual data + chartObj.SetVariable("_root.newData",strXML); + //Go to the required frame + chartObj.TGotoLabel("/", "JavaScriptHandler"); +} + + +/* Aliases for easy usage */ +var getChartFromId = infosoftglobal.FusionChartsUtil.getChartObject; +var updateChartXML = infosoftglobal.FusionChartsUtil.updateChartXML; +var FusionCharts = infosoftglobal.FusionCharts;
\ No newline at end of file diff --git a/ecomp-portal-BE/war/static/fusion/sample/js/charts.js b/ecomp-portal-BE/war/static/fusion/sample/js/charts.js new file mode 100644 index 00000000..4bebbd36 --- /dev/null +++ b/ecomp-portal-BE/war/static/fusion/sample/js/charts.js @@ -0,0 +1,132 @@ + +function drawSingleSeriesChart(tabId, chartId, chartWidth, chartHeight, chartType, chartData,mme,yyyyMo) { + // define, set the data for each chart, and render them (if indicated) + var myChart = new FusionCharts("static/fusion/inc/fusionchart/" + chartType, "myChartId" + chartId, chartWidth, chartHeight); + + var mmeLabel = "";//mme + ""; + + var chartCaptionId = tabId + "-chartdiv" + chartId + "-label"; + + document.getElementById(chartCaptionId).innerHTML = "Hosted Voice Usage in "+ yyyyMo; + + myChart.setDataXML("<graph caption='"+mmeLabel + "' xAxisName='' yAxisName='# of Inbound/Outbound calls' showNames='1' decimalPrecision='0' formatNumberScale='0'>" + chartData + "</graph>"); + myChart.setTransparent(true); + myChart.render(tabId + "-"+ "chartdiv" + chartId); + + + } + + + // gauge charts + function drawGaugeChart(chartId, gaugeIndex, value) { + var myChart = new FusionCharts("static/fusion/inc/fusionchart/AngularGauge.swf", "myChartId" + chartId, "300", "300", "0", "0"); + //CPU for NYCMNYBWLT1 on 201301 : 12.63// + var chartData = + "<Chart showBorder='0' editMode='1' bgColor='FFFFFF' upperLimit='100' lowerLimit='0' label='CPU' baseFontColor='FFFFFF' majorTMNumber='11' majorTMColor='FFFFFF' majorTMHeight='8' minorTMNumber='5' minorTMColor='FFFFFF' minorTMHeight='3' toolTipBorderColor='FFFFFF' toolTipBgColor='333333' gaugeOuterRadius='100' gaugeOriginX='150' gaugeOriginY='150' gaugeScaleAngle='270' placeValuesInside='1' gaugeInnerRadius='80%25' annRenderDelay='0' gaugeFillMix='' pivotRadius='10' showPivotBorder='0' pivotFillMix='{CCCCCC},{333333}' pivotFillRatio='50,50' showShadow='0' >" + + "<colorRange>" + + "<color minValue='0' maxValue='50' code='C1E1C1' alpha='60'/>" + + "<color minValue='50' maxValue='85' code='F6F164' alpha='60'/>" + + "<color minValue='85' maxValue='120' code='F70118' alpha='60'/>" + + "</colorRange>" + + "<dials>" + + "<dial value='" + value + "' borderColor='FFFFFF' bgColor='000000,CCCCCC,000000' borderAlpha='0' baseWidth='10'/>" + + "</dials>" + + "<annotations>" + + "<annotationGroup xPos='150' yPos='150' showBelow='1'>" + + "<annotation type='circle' xPos='0' yPos='0' radius='120' startAngle='0' endAngle='360' fillColor='CCCCCC,111111' fillPattern='linear' fillAlpha='100,100' fillRatio='50,50' fillAngle='-45'/>" + + "<annotation type='circle' xPos='0' yPos='0' radius='110' startAngle='0' endAngle='360' fillColor='111111,cccccc' fillPattern='linear' fillAlpha='100,100' fillRatio='50,50' fillAngle='-45'/>" + + "<annotation type='text' label='CPU'/>" + + "</annotationGroup>" + + "</annotations>" + + "</Chart>"; + + myChart.setDataXML(chartData); + myChart.render("chartdiv" + chartId); + } + + + function updateGaugeChart(chartId, gaugeIndex, refreshCount) { + var myChart = getChartFromId("myChartId" + chartId); + var val = 0; + if (gaugeIndex == "10") val = 12; + else if (gaugeIndex == "20") val = 15; + else if (gaugeIndex == "30") val = 52; + else if (gaugeIndex == "40") val = 42; + myChart.setData(1, val); + myChart.setData(2, val+20); + } + + function updateGaugeChartWithMMEData(chartId, value) { + var myChart = getChartFromId("myChartId" + chartId); + myChart.setData(1, value); + } + + + function updateGaugeChartWithMMEData(chartId, value, yyyyMo, mme) { + var myChart = getChartFromId("myChartId" + chartId); + myChart.setData(1, value); + document.getElementById("cpuYyyyMm").innerHTML = "Hosted Voice Utilization in "+ yyyyMo; + + } + + function drawMultiSeriesChart(tabId,chartId, chartWidth, chartHeight, chartType) { + var myChart = new FusionCharts("static/fusion/inc/fusionchart/" + chartType, "myChartId" + chartId, chartWidth, chartHeight, "0", "0"); + + myChart.setTransparent(true); + + var chartData = + "<graph caption='Hosted Voice v Audited Communication' xAxisName='Month' yAxisName='Bandwidth Usage'" + + " showValues='0' decimalPrecision='0' bgcolor='ffffff' bgAlpha='70'" + + " showColumnShadow='1' divlinecolor='c5c5c5' divLineAlpha='60' showAlternateHGridColor='1'" + + " alternateHGridColor='f8f8f8' alternateHGridAlpha='60' >" + + "<categories>" + + "<category name='Jan' />" + + "<category name='Feb' />" + + "<category name='Mar' />" + + "<category name='Apr' />" + + "<category name='May' />" + + "<category name='Jun' />" + + "<category name='Jul' />" + + "<category name='Aug' />" + + "<category name='Sep' />" + + "<category name='Oct' />" + + "<category name='Nov' />" + + "<category name='Dec' />" + + "</categories>" + + "<dataset seriesName='Hosted Voice' color='c4e3f7' >" + + "<set value='7' />" + + "<set value='8.04' />" + + "<set value='10.04' />" + + "<set value='12.73' />" + + "<set value='12.41' />" + + "<set value='11.83' />" + + "<set value='14.06' />" + + "<set value='15.94' />" + + "<set value='22.97' />" + + "<set value='26.79' />" + + "<set value='20.35' />" + + "<set value='12.63' />" + + "</dataset>" + + "<dataset seriesName='Audited Communication' color='Fad35e' >" + + "<set value='5.49'/>" + + "<set value='8.05'/>" + + "<set value='15.36'/>" + + "<set value='21.23'/>" + + "<set value='23.48' />" + + "<set value='15.49' />" + + "<set value='26.8' />" + + "<set value='30.54' />" + + "<set value='64' />" + + "<set value='75' />" + + "<set value='63' />" + + "<set value='34' />" + + "</dataset>" + + "<trendlines>" + + "<line startValue='26000' color='91C728' displayValue='Target' showOnTop='1'/>" + + "</trendlines>" + + "</graph>"; + + myChart.setDataXML(chartData); + myChart.render(tabId + "-" + "chartdiv" + chartId); + } + diff --git a/ecomp-portal-BE/war/static/fusion/sample/js/eye.js b/ecomp-portal-BE/war/static/fusion/sample/js/eye.js new file mode 100644 index 00000000..8a281dc3 --- /dev/null +++ b/ecomp-portal-BE/war/static/fusion/sample/js/eye.js @@ -0,0 +1,34 @@ +/** + * + * Zoomimage + * Author: Stefan Petre www.eyecon.ro + * + */ +(function($){ + var EYE = window.EYE = function() { + var _registered = { + init: [] + }; + return { + init: function() { + $.each(_registered.init, function(nr, fn){ + fn.call(); + }); + }, + extend: function(prop) { + for (var i in prop) { + if (prop[i] != undefined) { + this[i] = prop[i]; + } + } + }, + register: function(fn, type) { + if (!_registered[type]) { + _registered[type] = []; + } + _registered[type].push(fn); + } + }; + }(); + $(EYE.init); +})(jQuery); diff --git a/ecomp-portal-BE/war/static/fusion/sample/js/scribble.js b/ecomp-portal-BE/war/static/fusion/sample/js/scribble.js new file mode 100644 index 00000000..5384b304 --- /dev/null +++ b/ecomp-portal-BE/war/static/fusion/sample/js/scribble.js @@ -0,0 +1,19 @@ + function storeUserScribble(id) { + var scribble = document.getElementById('scribble').innerHTML; + localStorage.setItem('userScribble',scribble); + } + + function getUserScribble() { + if ( localStorage.getItem('userScribble')) { + var scribble = localStorage.getItem('userScribble'); + } + else { + var scribble = 'You can scribble directly on this sticky... and I will also remember your message the next time you visit my blog!'; + } + document.getElementById('scribble').innerHTML = scribble; + } + + function clearLocal() { + clear: localStorage.clear(); + return false; + } diff --git a/ecomp-portal-BE/war/static/fusion/sample/js/slides.min.jquery.js b/ecomp-portal-BE/war/static/fusion/sample/js/slides.min.jquery.js new file mode 100644 index 00000000..1a1fcdd8 --- /dev/null +++ b/ecomp-portal-BE/war/static/fusion/sample/js/slides.min.jquery.js @@ -0,0 +1,20 @@ +/* +* Slides, A Slideshow Plugin for jQuery +* Intructions: http://slidesjs.com +* By: Nathan Searles, http://nathansearles.com +* Version: 1.1.9 +* Updated: September 5th, 2011 +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +(function(a){a.fn.slides=function(b){return b=a.extend({},a.fn.slides.option,b),this.each(function(){function w(g,h,i){if(!p&&o){p=!0,b.animationStart(n+1);switch(g){case"next":l=n,k=n+1,k=e===k?0:k,r=f*2,g=-f*2,n=k;break;case"prev":l=n,k=n-1,k=k===-1?e-1:k,r=0,g=0,n=k;break;case"pagination":k=parseInt(i,10),l=a("."+b.paginationClass+" li."+b.currentClass+" a",c).attr("href").match("[^#/]+$"),k>l?(r=f*2,g=-f*2):(r=0,g=0),n=k}h==="fade"?b.crossfade?d.children(":eq("+k+")",c).css({zIndex:10}).fadeIn(b.fadeSpeed,b.fadeEasing,function(){b.autoHeight?d.animate({height:d.children(":eq("+k+")",c).outerHeight()},b.autoHeightSpeed,function(){d.children(":eq("+l+")",c).css({display:"none",zIndex:0}),d.children(":eq("+k+")",c).css({zIndex:0}),b.animationComplete(k+1),p=!1}):(d.children(":eq("+l+")",c).css({display:"none",zIndex:0}),d.children(":eq("+k+")",c).css({zIndex:0}),b.animationComplete(k+1),p=!1)}):d.children(":eq("+l+")",c).fadeOut(b.fadeSpeed,b.fadeEasing,function(){b.autoHeight?d.animate({height:d.children(":eq("+k+")",c).outerHeight()},b.autoHeightSpeed,function(){d.children(":eq("+k+")",c).fadeIn(b.fadeSpeed,b.fadeEasing)}):d.children(":eq("+k+")",c).fadeIn(b.fadeSpeed,b.fadeEasing,function(){a.browser.msie&&a(this).get(0).style.removeAttribute("filter")}),b.animationComplete(k+1),p=!1}):(d.children(":eq("+k+")").css({left:r,display:"block"}),b.autoHeight?d.animate({left:g,height:d.children(":eq("+k+")").outerHeight()},b.slideSpeed,b.slideEasing,function(){d.css({left:-f}),d.children(":eq("+k+")").css({left:f,zIndex:5}),d.children(":eq("+l+")").css({left:f,display:"none",zIndex:0}),b.animationComplete(k+1),p=!1}):d.animate({left:g},b.slideSpeed,b.slideEasing,function(){d.css({left:-f}),d.children(":eq("+k+")").css({left:f,zIndex:5}),d.children(":eq("+l+")").css({left:f,display:"none",zIndex:0}),b.animationComplete(k+1),p=!1})),b.pagination&&(a("."+b.paginationClass+" li."+b.currentClass,c).removeClass(b.currentClass),a("."+b.paginationClass+" li:eq("+k+")",c).addClass(b.currentClass))}}function x(){clearInterval(c.data("interval"))}function y(){b.pause?(clearTimeout(c.data("pause")),clearInterval(c.data("interval")),u=setTimeout(function(){clearTimeout(c.data("pause")),v=setInterval(function(){w("next",i)},b.play),c.data("interval",v)},b.pause),c.data("pause",u)):x()}a("."+b.container,a(this)).children().wrapAll('<div class="slides_control"/>');var c=a(this),d=a(".slides_control",c),e=d.children().size(),f=d.children().outerWidth(),g=d.children().outerHeight(),h=b.start-1,i=b.effect.indexOf(",")<0?b.effect:b.effect.replace(" ","").split(",")[0],j=b.effect.indexOf(",")<0?i:b.effect.replace(" ","").split(",")[1],k=0,l=0,m=0,n=0,o,p,q,r,s,t,u,v;if(e<2)return a("."+b.container,a(this)).fadeIn(b.fadeSpeed,b.fadeEasing,function(){o=!0,b.slidesLoaded()}),a("."+b.next+", ."+b.prev).fadeOut(0),!1;if(e<2)return;h<0&&(h=0),h>e&&(h=e-1),b.start&&(n=h),b.randomize&&d.randomize(),a("."+b.container,c).css({overflow:"hidden",position:"relative"}),d.children().css({position:"absolute",top:0,left:d.children().outerWidth(),zIndex:0,display:"none"}),d.css({position:"relative",width:f*3,height:g,left:-f}),a("."+b.container,c).css({display:"block"}),b.autoHeight&&(d.children().css({height:"auto"}),d.animate({height:d.children(":eq("+h+")").outerHeight()},b.autoHeightSpeed));if(b.preload&&d.find("img:eq("+h+")").length){a("."+b.container,c).css({background:"url("+b.preloadImage+") no-repeat 50% 50%"});var z=d.find("img:eq("+h+")").attr("src")+"?"+(new Date).getTime();a("img",c).parent().attr("class")!="slides_control"?t=d.children(":eq(0)")[0].tagName.toLowerCase():t=d.find("img:eq("+h+")"),d.find("img:eq("+h+")").attr("src",z).load(function(){d.find(t+":eq("+h+")").fadeIn(b.fadeSpeed,b.fadeEasing,function(){a(this).css({zIndex:5}),a("."+b.container,c).css({background:""}),o=!0,b.slidesLoaded()})})}else d.children(":eq("+h+")").fadeIn(b.fadeSpeed,b.fadeEasing,function(){o=!0,b.slidesLoaded()});b.bigTarget&&(d.children().css({cursor:"pointer"}),d.children().click(function(){return w("next",i),!1})),b.hoverPause&&b.play&&(d.bind("mouseover",function(){x()}),d.bind("mouseleave",function(){y()})),b.generateNextPrev&&(a("."+b.container,c).after('<a href="#" class="'+b.prev+'">Prev</a>'),a("."+b.prev,c).after('<a href="#" class="'+b.next+'">Next</a>')),a("."+b.next,c).click(function(a){a.preventDefault(),b.play&&y(),w("next",i)}),a("."+b.prev,c).click(function(a){a.preventDefault(),b.play&&y(),w("prev",i)}),b.generatePagination?(b.prependPagination?c.prepend("<ul class="+b.paginationClass+"></ul>"):c.append("<ul class="+b.paginationClass+"></ul>"),d.children().each(function(){a("."+b.paginationClass,c).append('<li><a href="#'+m+'">'+(m+1)+"</a></li>"),m++})):a("."+b.paginationClass+" li a",c).each(function(){a(this).attr("href","#"+m),m++}),a("."+b.paginationClass+" li:eq("+h+")",c).addClass(b.currentClass),a("."+b.paginationClass+" li a",c).click(function(){return b.play&&y(),q=a(this).attr("href").match("[^#/]+$"),n!=q&&w("pagination",j,q),!1}),a("a.link",c).click(function(){return b.play&&y(),q=a(this).attr("href").match("[^#/]+$")-1,n!=q&&w("pagination",j,q),!1}),b.play&&(v=setInterval(function(){w("next",i)},b.play),c.data("interval",v))})},a.fn.slides.option={preload:!1,preloadImage:"/img/loading.gif",container:"slides_container",generateNextPrev:!1,next:"next",prev:"prev",pagination:!0,generatePagination:!0,prependPagination:!1,paginationClass:"pagination",currentClass:"current",fadeSpeed:350,fadeEasing:"",slideSpeed:350,slideEasing:"",start:1,effect:"slide",crossfade:!1,randomize:!1,play:0,pause:0,hoverPause:!1,autoHeight:!1,autoHeightSpeed:350,bigTarget:!1,animationStart:function(){},animationComplete:function(){},slidesLoaded:function(){}},a.fn.randomize=function(b){function c(){return Math.round(Math.random())-.5}return a(this).each(function(){var d=a(this),e=d.children(),f=e.length;if(f>1){e.hide();var g=[];for(i=0;i<f;i++)g[g.length]=i;g=g.sort(c),a.each(g,function(a,c){var f=e.eq(c),g=f.clone(!0);g.show().appendTo(d),b!==undefined&&b(f,g),f.remove()})}})}})(jQuery)
\ No newline at end of file diff --git a/ecomp-portal-BE/war/static/fusion/sample/js/spacegallery.js b/ecomp-portal-BE/war/static/fusion/sample/js/spacegallery.js new file mode 100644 index 00000000..69ab2ccc --- /dev/null +++ b/ecomp-portal-BE/war/static/fusion/sample/js/spacegallery.js @@ -0,0 +1,235 @@ +/** + * + * Spacegallery + * Author: Stefan Petre www.eyecon.ro + * + */ + +(function($){ + EYE.extend({ + + spacegallery: { + + //default options (many options are controled via CSS) + defaults: { + border: 6, // border arround the image + perspective: 140, // perpective height + minScale: 0.2, // minimum scale for the image in the back + duration: 800, // aimation duration + loadingClass: null, // CSS class applied to the element while looading images + before: function(){return false}, + after: function(){return false} + }, + + animated: false, + + //position images + positionImages: function(el) { + var top = 0; + EYE.spacegallery.animated = false; + $(el) + .find('a') + .removeClass(el.spacegalleryCfg.loadingClass) + .end() + .find('img') + .removeAttr('height') + .each(function(nr){ + var newWidth = this.spacegallery.origWidth - (this.spacegallery.origWidth - this.spacegallery.origWidth * el.spacegalleryCfg.minScale) * el.spacegalleryCfg.asins[nr]; + $(this) + .css({ + top: el.spacegalleryCfg.tops[nr] + 'px', + marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px', + opacity: 1 - el.spacegalleryCfg.asins[nr] + }) + .attr('width', parseInt(newWidth)); + this.spacegallery.next = el.spacegalleryCfg.asins[nr+1]; + this.spacegallery.nextTop = el.spacegalleryCfg.tops[nr+1] - el.spacegalleryCfg.tops[nr]; + this.spacegallery.origTop = el.spacegalleryCfg.tops[nr]; + this.spacegallery.opacity = 1 - el.spacegalleryCfg.asins[nr]; + this.spacegallery.increment = el.spacegalleryCfg.asins[nr] - this.spacegallery.next; + this.spacegallery.current = el.spacegalleryCfg.asins[nr]; + this.spacegallery.width = newWidth; + }) + }, + + //animate to nex image + next: function(e) { + if (EYE.spacegallery.animated === false) { + EYE.spacegallery.animated = true; + var el = this.parentNode; + el.spacegalleryCfg.before.apply(el); + $(el) + .css('spacegallery', 0) + .animate({ + spacegallery: 100 + },{ + easing: 'easeOut', + duration: el.spacegalleryCfg.duration, + complete: function() { + $(el) + .find('img:last') + .prependTo(el); + EYE.spacegallery.positionImages(el); + el.spacegalleryCfg.after.apply(el); + }, + step: function(now) { + $('img', this) + .each(function(nr){ + var newWidth, top, next; + if (nr + 1 == el.spacegalleryCfg.images) { + top = this.spacegallery.origTop + this.spacegallery.nextTop * 4 * now /100; + newWidth = this.spacegallery.width * top / this.spacegallery.origTop; + $(this) + .css({ + top: top + 'px', + opacity: 0.7 - now/100, + marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px' + }) + .attr('width', newWidth); + } else { + next = this.spacegallery.current - this.spacegallery.increment * now /100; + newWidth = this.spacegallery.origWidth - (this.spacegallery.origWidth - this.spacegallery.origWidth * el.spacegalleryCfg.minScale) * next; + $(this).css({ + top: this.spacegallery.origTop + this.spacegallery.nextTop * now /100 + 'px', + opacity: 1 - next, + marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px' + }) + .attr('width', newWidth); + } + }); + } + }); + } + + this.blur(); + return false; + }, + + autoNext: function(el) { + + if (EYE.spacegallery.animated === false) { + EYE.spacegallery.animated = true; + el.spacegalleryCfg.before.apply(el); // run the "before" function + $(el) + .css('spacegallery', 0) + .animate({ + spacegallery: 100 + },{ + easing: 'easeOut', + duration: el.spacegalleryCfg.duration, + complete: function() { // after animation is complete, move the front image to the back + $(el) + .find('img:last') // find the last image in this div + .prependTo(el); // and stick it at the beginning + EYE.spacegallery.positionImages(el); // run "position images" + el.spacegalleryCfg.after.apply(el); //run the "after" function + }, + step: function(now) { + $('img', this) + .each(function(nr){ + var newWidth, top, next; + if (nr + 1 == el.spacegalleryCfg.images) { + top = this.spacegallery.origTop + this.spacegallery.nextTop * 4 * now /100; + newWidth = this.spacegallery.width * top / this.spacegallery.origTop; + $(this) + .css({ + top: top + 'px', + opacity: 0.7 - now/100, + marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px' + }) + .attr('width', newWidth); + } else { + next = this.spacegallery.current - this.spacegallery.increment * now /100; + newWidth = this.spacegallery.origWidth - (this.spacegallery.origWidth - this.spacegallery.origWidth * el.spacegalleryCfg.minScale) * next; + $(this).css({ + top: this.spacegallery.origTop + this.spacegallery.nextTop * now /100 + 'px', + opacity: 1 - next, + marginLeft: - parseInt((newWidth + el.spacegalleryCfg.border)/2, 10) + 'px' + }) + .attr('width', newWidth); + } + }); + } + }); + } + + return false; + }, + + //constructor + init: function(opt) { + opt = $.extend({}, EYE.spacegallery.defaults, opt||{}); + return this.each(function(){ + var el = this; + if ($(el).is('.spacegallery')) { + $('<a href="#"></a>') + .appendTo(this) + .addClass(opt.loadingClass) + .bind('click', EYE.spacegallery.next); + el.spacegalleryCfg = opt; + el.spacegalleryCfg.images = el.getElementsByTagName('img').length; + el.spacegalleryCfg.loaded = 0; + el.spacegalleryCfg.asin = Math.asin(1); + el.spacegalleryCfg.asins = {}; + el.spacegalleryCfg.tops = {}; + el.spacegalleryCfg.increment = parseInt(el.spacegalleryCfg.perspective/el.spacegalleryCfg.images, 10); + var top = 0; + $('img', el) + .each(function(nr){ + var imgEl = new Image(); + var elImg = this; + el.spacegalleryCfg.asins[nr] = 1 - Math.asin((nr+1)/el.spacegalleryCfg.images)/el.spacegalleryCfg.asin; + top += el.spacegalleryCfg.increment - el.spacegalleryCfg.increment * el.spacegalleryCfg.asins[nr]; + el.spacegalleryCfg.tops[nr] = top; + elImg.spacegallery = {}; + imgEl.src = this.src; + if (imgEl.complete) { + el.spacegalleryCfg.loaded ++; + elImg.spacegallery.origWidth = imgEl.width; + elImg.spacegallery.origHeight = imgEl.height + } else { + imgEl.onload = function() { + el.spacegalleryCfg.loaded ++; + elImg.spacegallery.origWidth = imgEl.width; + elImg.spacegallery.origHeight = imgEl.height + if (el.spacegalleryCfg.loaded == el.spacegalleryCfg.images) { + + EYE.spacegallery.positionImages(el); + } + }; + } + }); + el.spacegalleryCfg.asins[el.spacegalleryCfg.images] = el.spacegalleryCfg.asins[el.spacegalleryCfg.images - 1] * 1.3; + el.spacegalleryCfg.tops[el.spacegalleryCfg.images] = el.spacegalleryCfg.tops[el.spacegalleryCfg.images - 1] * 1.3; + if (el.spacegalleryCfg.loaded == el.spacegalleryCfg.images) { + EYE.spacegallery.positionImages(el); + setInterval(function() { EYE.spacegallery.autoNext(el); }, 4000); + } + } + }); + } + } + }); + + $.fn.extend({ + + /** + * Create a space gallery + * @name spacegallery + * @description create a space gallery + * @option int border Images' border. Default: 6 + * @option int perspective Perpective height. Default: 140 + * @option float minScale Minimum scale for the image in the back. Default: 0.2 + * @option int duration Animation duration. Default: 800 + * @option string loadingClass CSS class applied to the element while looading images. Default: null + * @option function before Callback function triggered before going to the next image + * @option function after Callback function triggered after going to the next image + */ + spacegallery: EYE.spacegallery.init + }); + $.extend($.easing,{ + easeOut:function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + } + }); +})(jQuery);
\ No newline at end of file diff --git a/ecomp-portal-BE/war/static/fusion/sample/js/utils.js b/ecomp-portal-BE/war/static/fusion/sample/js/utils.js new file mode 100644 index 00000000..d9be8532 --- /dev/null +++ b/ecomp-portal-BE/war/static/fusion/sample/js/utils.js @@ -0,0 +1,252 @@ +/** + * + * Utilities + * Author: Stefan Petre www.eyecon.ro + * + */ +(function($) { +EYE.extend({ + getPosition : function(e, forceIt) + { + var x = 0; + var y = 0; + var es = e.style; + var restoreStyles = false; + if (forceIt && jQuery.curCSS(e,'display') == 'none') { + var oldVisibility = es.visibility; + var oldPosition = es.position; + restoreStyles = true; + es.visibility = 'hidden'; + es.display = 'block'; + es.position = 'absolute'; + } + var el = e; + if (el.getBoundingClientRect) { // IE + var box = el.getBoundingClientRect(); + x = box.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) - 2; + y = box.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop) - 2; + } else { + x = el.offsetLeft; + y = el.offsetTop; + el = el.offsetParent; + if (e != el) { + while (el) { + x += el.offsetLeft; + y += el.offsetTop; + el = el.offsetParent; + } + } + if (jQuery.browser.safari && jQuery.curCSS(e, 'position') == 'absolute' ) { + x -= document.body.offsetLeft; + y -= document.body.offsetTop; + } + el = e.parentNode; + while (el && el.tagName.toUpperCase() != 'BODY' && el.tagName.toUpperCase() != 'HTML') + { + if (jQuery.curCSS(el, 'display') != 'inline') { + x -= el.scrollLeft; + y -= el.scrollTop; + } + el = el.parentNode; + } + } + if (restoreStyles == true) { + es.display = 'none'; + es.position = oldPosition; + es.visibility = oldVisibility; + } + return {x:x, y:y}; + }, + getSize : function(e) + { + var w = parseInt(jQuery.curCSS(e,'width'), 10); + var h = parseInt(jQuery.curCSS(e,'height'), 10); + var wb = 0; + var hb = 0; + if (jQuery.curCSS(e, 'display') != 'none') { + wb = e.offsetWidth; + hb = e.offsetHeight; + } else { + var es = e.style; + var oldVisibility = es.visibility; + var oldPosition = es.position; + es.visibility = 'hidden'; + es.display = 'block'; + es.position = 'absolute'; + wb = e.offsetWidth; + hb = e.offsetHeight; + es.display = 'none'; + es.position = oldPosition; + es.visibility = oldVisibility; + } + return {w:w, h:h, wb:wb, hb:hb}; + }, + getClient : function(e) + { + var h, w; + if (e) { + w = e.clientWidth; + h = e.clientHeight; + } else { + var de = document.documentElement; + w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; + h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; + } + return {w:w,h:h}; + }, + getScroll : function (e) + { + var t=0, l=0, w=0, h=0, iw=0, ih=0; + if (e && e.nodeName.toLowerCase() != 'body') { + t = e.scrollTop; + l = e.scrollLeft; + w = e.scrollWidth; + h = e.scrollHeight; + } else { + if (document.documentElement) { + t = document.documentElement.scrollTop; + l = document.documentElement.scrollLeft; + w = document.documentElement.scrollWidth; + h = document.documentElement.scrollHeight; + } else if (document.body) { + t = document.body.scrollTop; + l = document.body.scrollLeft; + w = document.body.scrollWidth; + h = document.body.scrollHeight; + } + if (typeof pageYOffset != 'undefined') { + t = pageYOffset; + l = pageXOffset; + } + iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0; + ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0; + } + return { t: t, l: l, w: w, h: h, iw: iw, ih: ih }; + }, + getMargins : function(e, toInteger) + { + var t = jQuery.curCSS(e,'marginTop') || ''; + var r = jQuery.curCSS(e,'marginRight') || ''; + var b = jQuery.curCSS(e,'marginBottom') || ''; + var l = jQuery.curCSS(e,'marginLeft') || ''; + if (toInteger) + return { + t: parseInt(t, 10)||0, + r: parseInt(r, 10)||0, + b: parseInt(b, 10)||0, + l: parseInt(l, 10) + }; + else + return {t: t, r: r, b: b, l: l}; + }, + getPadding : function(e, toInteger) + { + var t = jQuery.curCSS(e,'paddingTop') || ''; + var r = jQuery.curCSS(e,'paddingRight') || ''; + var b = jQuery.curCSS(e,'paddingBottom') || ''; + var l = jQuery.curCSS(e,'paddingLeft') || ''; + if (toInteger) + return { + t: parseInt(t, 10)||0, + r: parseInt(r, 10)||0, + b: parseInt(b, 10)||0, + l: parseInt(l, 10) + }; + else + return {t: t, r: r, b: b, l: l}; + }, + getBorder : function(e, toInteger) + { + var t = jQuery.curCSS(e,'borderTopWidth') || ''; + var r = jQuery.curCSS(e,'borderRightWidth') || ''; + var b = jQuery.curCSS(e,'borderBottomWidth') || ''; + var l = jQuery.curCSS(e,'borderLeftWidth') || ''; + if (toInteger) + return { + t: parseInt(t, 10)||0, + r: parseInt(r, 10)||0, + b: parseInt(b, 10)||0, + l: parseInt(l, 10)||0 + }; + else + return {t: t, r: r, b: b, l: l}; + }, + traverseDOM : function(nodeEl, func) + { + func(nodeEl); + nodeEl = nodeEl.firstChild; + while(nodeEl){ + EYE.traverseDOM(nodeEl, func); + nodeEl = nodeEl.nextSibling; + } + }, + getInnerWidth : function(el, scroll) { + var offsetW = el.offsetWidth; + return scroll ? Math.max(el.scrollWidth,offsetW) - offsetW + el.clientWidth:el.clientWidth; + }, + getInnerHeight : function(el, scroll) { + var offsetH = el.offsetHeight; + return scroll ? Math.max(el.scrollHeight,offsetH) - offsetH + el.clientHeight:el.clientHeight; + }, + getExtraWidth : function(el) { + if($.boxModel) + return (parseInt($.curCSS(el, 'paddingLeft'))||0) + + (parseInt($.curCSS(el, 'paddingRight'))||0) + + (parseInt($.curCSS(el, 'borderLeftWidth'))||0) + + (parseInt($.curCSS(el, 'borderRightWidth'))||0); + return 0; + }, + getExtraHeight : function(el) { + if($.boxModel) + return (parseInt($.curCSS(el, 'paddingTop'))||0) + + (parseInt($.curCSS(el, 'paddingBottom'))||0) + + (parseInt($.curCSS(el, 'borderTopWidth'))||0) + + (parseInt($.curCSS(el, 'borderBottomWidth'))||0); + return 0; + }, + isChildOf: function(parentEl, el, container) { + if (parentEl == el) { + return true; + } + if (!el || !el.nodeType || el.nodeType != 1) { + return false; + } + if (parentEl.contains && !$.browser.safari) { + return parentEl.contains(el); + } + if ( parentEl.compareDocumentPosition ) { + return !!(parentEl.compareDocumentPosition(el) & 16); + } + var prEl = el.parentNode; + while(prEl && prEl != container) { + if (prEl == parentEl) + return true; + prEl = prEl.parentNode; + } + return false; + }, + centerEl : function(el, axis) + { + var clientScroll = EYE.getScroll(); + var size = EYE.getSize(el); + if (!axis || axis == 'vertically') + $(el).css( + { + top: clientScroll.t + ((Math.min(clientScroll.h,clientScroll.ih) - size.hb)/2) + 'px' + } + ); + if (!axis || axis == 'horizontally') + $(el).css( + { + left: clientScroll.l + ((Math.min(clientScroll.w,clientScroll.iw) - size.wb)/2) + 'px' + } + ); + } +}); +if (!$.easing.easeout) { + $.easing.easeout = function(p, n, firstNum, delta, duration) { + return -delta * ((n=n/duration-1)*n*n*n - 1) + firstNum; + }; +} + +})(jQuery);
\ No newline at end of file |