code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'bar' }, title: { text: 'Historic World Population by Region' }, subtitle: { text: 'Source: Wikipedia.org' }, xAxis: { categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'], title: { text: null } }, yAxis: { min: 0, title: { text: 'Population (millions)', align: 'high' } }, tooltip: { formatter: function() { return ''+ this.series.name +': '+ this.y +' millions'; } }, plotOptions: { bar: { dataLabels: { enabled: true } } }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'top', x: -100, y: 100, floating: true, borderWidth: 1, backgroundColor: '#FFFFFF', shadow: true }, credits: { enabled: false }, series: [{ name: 'Year 1800', data: [107, 31, 635, 203, 2] }, { name: 'Year 1900', data: [133, 156, 947, 408, 6] }, { name: 'Year 2008', data: [973, 914, 4054, 732, 34] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/bar-basic/index.htm
HTML
gpl2
2,400
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'area' }, title: { text: 'US and USSR nuclear stockpiles' }, subtitle: { text: 'Source: <a href="http://thebulletin.metapress.com/content/c4120650912x74k7/fulltext.pdf">'+ 'thebulletin.metapress.com</a>' }, xAxis: { labels: { formatter: function() { return this.value; // clean, unformatted number for year } } }, yAxis: { title: { text: 'Nuclear weapon states' }, labels: { formatter: function() { return this.value / 1000 +'k'; } } }, tooltip: { formatter: function() { return this.series.name +' produced <b>'+ Highcharts.numberFormat(this.y, 0) +'</b><br/>warheads in '+ this.x; } }, plotOptions: { area: { pointStart: 1940, marker: { enabled: false, symbol: 'circle', radius: 2, states: { hover: { enabled: true } } } } }, series: [{ name: 'USA', data: [null, null, null, null, null, 6 , 11, 32, 110, 235, 369, 640, 1005, 1436, 2063, 3057, 4618, 6444, 9822, 15468, 20434, 24126, 27387, 29459, 31056, 31982, 32040, 31233, 29224, 27342, 26662, 26956, 27912, 28999, 28965, 27826, 25579, 25722, 24826, 24605, 24304, 23464, 23708, 24099, 24357, 24237, 24401, 24344, 23586, 22380, 21004, 17287, 14747, 13076, 12555, 12144, 11009, 10950, 10871, 10824, 10577, 10527, 10475, 10421, 10358, 10295, 10104 ] }, { name: 'USSR/Russia', data: [null, null, null, null, null, null, null , null , null ,null, 5, 25, 50, 120, 150, 200, 426, 660, 869, 1060, 1605, 2471, 3322, 4238, 5221, 6129, 7089, 8339, 9399, 10538, 11643, 13092, 14478, 15915, 17385, 19055, 21205, 23044, 25393, 27935, 30062, 32049, 33952, 35804, 37431, 39197, 45000, 43000, 41000, 39000, 37000, 35000, 33000, 31000, 29000, 27000, 25000, 24000, 23000, 22000, 21000, 20000, 19000, 18000, 18000, 17000, 16000] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/area-basic/index.htm
HTML
gpl2
3,542
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'column' }, title: { text: 'Monthly Average Rainfall' }, subtitle: { text: 'Source: WorldClimate.com' }, xAxis: { categories: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ] }, yAxis: { min: 0, title: { text: 'Rainfall (mm)' } }, legend: { layout: 'vertical', backgroundColor: '#FFFFFF', align: 'left', verticalAlign: 'top', x: 100, y: 70, floating: true, shadow: true }, tooltip: { formatter: function() { return ''+ this.x +': '+ this.y +' mm'; } }, plotOptions: { column: { pointPadding: 0.2, borderWidth: 0 } }, series: [{ name: 'Tokyo', data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }, { name: 'New York', data: [83.6, 78.8, 98.5, 93.4, 106.0, 84.5, 105.0, 104.3, 91.2, 83.5, 106.6, 92.3] }, { name: 'London', data: [48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0, 59.6, 52.4, 65.2, 59.3, 51.2] }, { name: 'Berlin', data: [42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/column-basic/index.htm
HTML
gpl2
2,750
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'column', margin: [ 50, 50, 100, 80] }, title: { text: 'World\'s largest cities per 2008' }, xAxis: { categories: [ 'Tokyo', 'Jakarta', 'New York', 'Seoul', 'Manila', 'Mumbai', 'Sao Paulo', 'Mexico City', 'Dehli', 'Osaka', 'Cairo', 'Kolkata', 'Los Angeles', 'Shanghai', 'Moscow', 'Beijing', 'Buenos Aires', 'Guangzhou', 'Shenzhen', 'Istanbul' ], labels: { rotation: -45, align: 'right', style: { fontSize: '13px', fontFamily: 'Verdana, sans-serif' } } }, yAxis: { min: 0, title: { text: 'Population (millions)' } }, legend: { enabled: false }, tooltip: { formatter: function() { return '<b>'+ this.x +'</b><br/>'+ 'Population in 2008: '+ Highcharts.numberFormat(this.y, 1) + ' millions'; } }, series: [{ name: 'Population', data: [34.4, 21.8, 20.1, 20, 19.6, 19.5, 19.1, 18.4, 18, 17.3, 16.8, 15, 14.7, 14.5, 13.3, 12.8, 12.4, 11.8, 11.7, 11.2], dataLabels: { enabled: true, rotation: -90, color: '#FFFFFF', align: 'right', x: -3, y: 10, formatter: function() { return this.y; }, style: { fontSize: '13px', fontFamily: 'Verdana, sans-serif' } } }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/column-rotated-labels/index.htm
HTML
gpl2
3,125
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { var colors = Highcharts.getOptions().colors, categories = ['MSIE', 'Firefox', 'Chrome', 'Safari', 'Opera'], name = 'Browser brands', data = [{ y: 55.11, color: colors[0], drilldown: { name: 'MSIE versions', categories: ['MSIE 6.0', 'MSIE 7.0', 'MSIE 8.0', 'MSIE 9.0'], data: [10.85, 7.35, 33.06, 2.81], color: colors[0] } }, { y: 21.63, color: colors[1], drilldown: { name: 'Firefox versions', categories: ['Firefox 2.0', 'Firefox 3.0', 'Firefox 3.5', 'Firefox 3.6', 'Firefox 4.0'], data: [0.20, 0.83, 1.58, 13.12, 5.43], color: colors[1] } }, { y: 11.94, color: colors[2], drilldown: { name: 'Chrome versions', categories: ['Chrome 5.0', 'Chrome 6.0', 'Chrome 7.0', 'Chrome 8.0', 'Chrome 9.0', 'Chrome 10.0', 'Chrome 11.0', 'Chrome 12.0'], data: [0.12, 0.19, 0.12, 0.36, 0.32, 9.91, 0.50, 0.22], color: colors[2] } }, { y: 7.15, color: colors[3], drilldown: { name: 'Safari versions', categories: ['Safari 5.0', 'Safari 4.0', 'Safari Win 5.0', 'Safari 4.1', 'Safari/Maxthon', 'Safari 3.1', 'Safari 4.1'], data: [4.55, 1.42, 0.23, 0.21, 0.20, 0.19, 0.14], color: colors[3] } }, { y: 2.14, color: colors[4], drilldown: { name: 'Opera versions', categories: ['Opera 9.x', 'Opera 10.x', 'Opera 11.x'], data: [ 0.12, 0.37, 1.65], color: colors[4] } }]; function setChart(name, categories, data, color) { chart.xAxis[0].setCategories(categories); chart.series[0].remove(); chart.addSeries({ name: name, data: data, color: color || 'white' }); } chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'column' }, title: { text: 'Browser market share, April, 2011' }, subtitle: { text: 'Click the columns to view versions. Click again to view brands.' }, xAxis: { categories: categories }, yAxis: { title: { text: 'Total percent market share' } }, plotOptions: { column: { cursor: 'pointer', point: { events: { click: function() { var drilldown = this.drilldown; if (drilldown) { // drill down setChart(drilldown.name, drilldown.categories, drilldown.data, drilldown.color); } else { // restore setChart(name, categories, data); } } } }, dataLabels: { enabled: true, color: colors[0], style: { fontWeight: 'bold' }, formatter: function() { return this.y +'%'; } } } }, tooltip: { formatter: function() { var point = this.point, s = this.x +':<b>'+ this.y +'% market share</b><br/>'; if (point.drilldown) { s += 'Click to view '+ point.category +' versions'; } else { s += 'Click to return to browser brands'; } return s; } }, series: [{ name: name, data: data, color: 'white' }], exporting: { enabled: false } }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/column-drilldown/index.htm
HTML
gpl2
5,576
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'spline' }, title: { text: 'Monthly Average Temperature' }, subtitle: { text: 'Source: WorldClimate.com' }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, yAxis: { title: { text: 'Temperature' }, labels: { formatter: function() { return this.value +'°' } } }, tooltip: { crosshairs: true, shared: true }, plotOptions: { spline: { marker: { radius: 4, lineColor: '#666666', lineWidth: 1 } } }, series: [{ name: 'Tokyo', marker: { symbol: 'square' }, data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, { y: 26.5, marker: { symbol: 'url(http://www.highcharts.com/demo/gfx/sun.png)' } }, 23.3, 18.3, 13.9, 9.6] }, { name: 'London', marker: { symbol: 'diamond' }, data: [{ y: 3.9, marker: { symbol: 'url(http://www.highcharts.com/demo/gfx/snow.png)' } }, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/spline-symbols/index.htm
HTML
gpl2
2,562
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'area', inverted: true }, title: { text: 'Average fruit consumption during one week' }, subtitle: { style: { position: 'absolute', right: '0px', bottom: '10px' } }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'top', x: -150, y: 100, floating: true, borderWidth: 1, backgroundColor: '#FFFFFF' }, xAxis: { categories: [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ] }, yAxis: { title: { text: 'Number of units' }, labels: { formatter: function() { return this.value; } }, min: 0 }, tooltip: { formatter: function() { return ''+ this.x +': '+ this.y; } }, plotOptions: { area: { fillOpacity: 0.5 } }, series: [{ name: 'John', data: [3, 4, 3, 5, 4, 10, 12] }, { name: 'Jane', data: [1, 3, 4, 3, 3, 5, 4] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/area-inverted/index.htm
HTML
gpl2
2,478
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', zoomType: 'xy' }, title: { text: 'Average Monthly Temperature and Rainfall in Tokyo' }, subtitle: { text: 'Source: WorldClimate.com' }, xAxis: [{ categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }], yAxis: [{ // Primary yAxis labels: { formatter: function() { return this.value +'°C'; }, style: { color: '#89A54E' } }, title: { text: 'Temperature', style: { color: '#89A54E' } } }, { // Secondary yAxis title: { text: 'Rainfall', style: { color: '#4572A7' } }, labels: { formatter: function() { return this.value +' mm'; }, style: { color: '#4572A7' } }, opposite: true }], tooltip: { formatter: function() { return ''+ this.x +': '+ this.y + (this.series.name == 'Rainfall' ? ' mm' : '°C'); } }, legend: { layout: 'vertical', align: 'left', x: 120, verticalAlign: 'top', y: 100, floating: true, backgroundColor: '#FFFFFF' }, series: [{ name: 'Rainfall', color: '#4572A7', type: 'column', yAxis: 1, data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }, { name: 'Temperature', color: '#89A54E', type: 'spline', data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/combo-dual-axes/index.htm
HTML
gpl2
3,102
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'area' }, title: { text: 'Area chart with negative values' }, xAxis: { categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'] }, tooltip: { formatter: function() { return ''+ this.series.name +': '+ this.y +''; } }, credits: { enabled: false }, series: [{ name: 'John', data: [5, 3, 4, 7, 2] }, { name: 'Jane', data: [2, -2, -3, 2, 1] }, { name: 'Joe', data: [3, 4, 4, -2, 5] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/area-negative/index.htm
HTML
gpl2
1,497
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'area', spacingBottom: 30 }, title: { text: 'Fruit consumption *' }, subtitle: { text: '* Jane\'s banana consumption is unknown', floating: true, align: 'right', verticalAlign: 'bottom', y: 15 }, legend: { layout: 'vertical', align: 'left', verticalAlign: 'top', x: 150, y: 100, floating: true, borderWidth: 1, backgroundColor: '#FFFFFF' }, xAxis: { categories: ['Apples', 'Pears', 'Oranges', 'Bananas', 'Grapes', 'Plums', 'Strawberries', 'Raspberries'] }, yAxis: { title: { text: 'Y-Axis' }, labels: { formatter: function() { return this.value; } } }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y; } }, plotOptions: { area: { fillOpacity: 0.5 } }, credits: { enabled: false }, series: [{ name: 'John', data: [0, 1, 4, 4, 5, 2, 3, 7] }, { name: 'Jane', data: [1, 0, 3, null, 3, 1, 2, 1] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/area-missing/index.htm
HTML
gpl2
2,427
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'scatter', margin: [70, 50, 60, 80], events: { click: function(e) { // find the clicked values and the series var x = e.xAxis[0].value, y = e.yAxis[0].value, series = this.series[0]; // Add it series.addPoint([x, y]); } } }, title: { text: 'User supplied data' }, subtitle: { text: 'Click the plot area to add a point. Click a point to remove it.' }, xAxis: { minPadding: 0.2, maxPadding: 0.2, maxZoom: 60 }, yAxis: { title: { text: 'Value' }, minPadding: 0.2, maxPadding: 0.2, maxZoom: 60, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, legend: { enabled: false }, exporting: { enabled: false }, plotOptions: { series: { lineWidth: 1, point: { events: { 'click': function() { if (this.series.data.length > 1) this.remove(); } } } } }, series: [{ data: [[20, 20], [80, 80]] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/dynamic-click-to-add/index.htm
HTML
gpl2
2,522
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'column' }, title: { text: 'Stacked column chart' }, xAxis: { categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'] }, yAxis: { min: 0, title: { text: 'Total fruit consumption' } }, tooltip: { formatter: function() { return ''+ this.series.name +': '+ this.y +' ('+ Math.round(this.percentage) +'%)'; } }, plotOptions: { column: { stacking: 'percent' } }, series: [{ name: 'John', data: [5, 3, 4, 7, 2] }, { name: 'Jane', data: [2, 2, 3, 2, 1] }, { name: 'Joe', data: [3, 4, 4, 2, 5] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/column-stacked-percent/index.htm
HTML
gpl2
1,738
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'scatter', zoomType: 'xy' }, title: { text: 'Height Versus Weight of 507 Individuals by Gender' }, subtitle: { text: 'Source: Heinz 2003' }, xAxis: { title: { enabled: true, text: 'Height (cm)' }, startOnTick: true, endOnTick: true, showLastLabel: true }, yAxis: { title: { text: 'Weight (kg)' } }, tooltip: { formatter: function() { return ''+ this.x +' cm, '+ this.y +' kg'; } }, legend: { layout: 'vertical', align: 'left', verticalAlign: 'top', x: 100, y: 70, floating: true, backgroundColor: '#FFFFFF', borderWidth: 1 }, plotOptions: { scatter: { marker: { radius: 5, states: { hover: { enabled: true, lineColor: 'rgb(100,100,100)' } } }, states: { hover: { marker: { enabled: false } } } } }, series: [{ name: 'Female', color: 'rgba(223, 83, 83, .5)', data: [[161.2, 51.6], [167.5, 59.0], [159.5, 49.2], [157.0, 63.0], [155.8, 53.6], [170.0, 59.0], [159.1, 47.6], [166.0, 69.8], [176.2, 66.8], [160.2, 75.2], [172.5, 55.2], [170.9, 54.2], [172.9, 62.5], [153.4, 42.0], [160.0, 50.0], [147.2, 49.8], [168.2, 49.2], [175.0, 73.2], [157.0, 47.8], [167.6, 68.8], [159.5, 50.6], [175.0, 82.5], [166.8, 57.2], [176.5, 87.8], [170.2, 72.8], [174.0, 54.5], [173.0, 59.8], [179.9, 67.3], [170.5, 67.8], [160.0, 47.0], [154.4, 46.2], [162.0, 55.0], [176.5, 83.0], [160.0, 54.4], [152.0, 45.8], [162.1, 53.6], [170.0, 73.2], [160.2, 52.1], [161.3, 67.9], [166.4, 56.6], [168.9, 62.3], [163.8, 58.5], [167.6, 54.5], [160.0, 50.2], [161.3, 60.3], [167.6, 58.3], [165.1, 56.2], [160.0, 50.2], [170.0, 72.9], [157.5, 59.8], [167.6, 61.0], [160.7, 69.1], [163.2, 55.9], [152.4, 46.5], [157.5, 54.3], [168.3, 54.8], [180.3, 60.7], [165.5, 60.0], [165.0, 62.0], [164.5, 60.3], [156.0, 52.7], [160.0, 74.3], [163.0, 62.0], [165.7, 73.1], [161.0, 80.0], [162.0, 54.7], [166.0, 53.2], [174.0, 75.7], [172.7, 61.1], [167.6, 55.7], [151.1, 48.7], [164.5, 52.3], [163.5, 50.0], [152.0, 59.3], [169.0, 62.5], [164.0, 55.7], [161.2, 54.8], [155.0, 45.9], [170.0, 70.6], [176.2, 67.2], [170.0, 69.4], [162.5, 58.2], [170.3, 64.8], [164.1, 71.6], [169.5, 52.8], [163.2, 59.8], [154.5, 49.0], [159.8, 50.0], [173.2, 69.2], [170.0, 55.9], [161.4, 63.4], [169.0, 58.2], [166.2, 58.6], [159.4, 45.7], [162.5, 52.2], [159.0, 48.6], [162.8, 57.8], [159.0, 55.6], [179.8, 66.8], [162.9, 59.4], [161.0, 53.6], [151.1, 73.2], [168.2, 53.4], [168.9, 69.0], [173.2, 58.4], [171.8, 56.2], [178.0, 70.6], [164.3, 59.8], [163.0, 72.0], [168.5, 65.2], [166.8, 56.6], [172.7, 105.2], [163.5, 51.8], [169.4, 63.4], [167.8, 59.0], [159.5, 47.6], [167.6, 63.0], [161.2, 55.2], [160.0, 45.0], [163.2, 54.0], [162.2, 50.2], [161.3, 60.2], [149.5, 44.8], [157.5, 58.8], [163.2, 56.4], [172.7, 62.0], [155.0, 49.2], [156.5, 67.2], [164.0, 53.8], [160.9, 54.4], [162.8, 58.0], [167.0, 59.8], [160.0, 54.8], [160.0, 43.2], [168.9, 60.5], [158.2, 46.4], [156.0, 64.4], [160.0, 48.8], [167.1, 62.2], [158.0, 55.5], [167.6, 57.8], [156.0, 54.6], [162.1, 59.2], [173.4, 52.7], [159.8, 53.2], [170.5, 64.5], [159.2, 51.8], [157.5, 56.0], [161.3, 63.6], [162.6, 63.2], [160.0, 59.5], [168.9, 56.8], [165.1, 64.1], [162.6, 50.0], [165.1, 72.3], [166.4, 55.0], [160.0, 55.9], [152.4, 60.4], [170.2, 69.1], [162.6, 84.5], [170.2, 55.9], [158.8, 55.5], [172.7, 69.5], [167.6, 76.4], [162.6, 61.4], [167.6, 65.9], [156.2, 58.6], [175.2, 66.8], [172.1, 56.6], [162.6, 58.6], [160.0, 55.9], [165.1, 59.1], [182.9, 81.8], [166.4, 70.7], [165.1, 56.8], [177.8, 60.0], [165.1, 58.2], [175.3, 72.7], [154.9, 54.1], [158.8, 49.1], [172.7, 75.9], [168.9, 55.0], [161.3, 57.3], [167.6, 55.0], [165.1, 65.5], [175.3, 65.5], [157.5, 48.6], [163.8, 58.6], [167.6, 63.6], [165.1, 55.2], [165.1, 62.7], [168.9, 56.6], [162.6, 53.9], [164.5, 63.2], [176.5, 73.6], [168.9, 62.0], [175.3, 63.6], [159.4, 53.2], [160.0, 53.4], [170.2, 55.0], [162.6, 70.5], [167.6, 54.5], [162.6, 54.5], [160.7, 55.9], [160.0, 59.0], [157.5, 63.6], [162.6, 54.5], [152.4, 47.3], [170.2, 67.7], [165.1, 80.9], [172.7, 70.5], [165.1, 60.9], [170.2, 63.6], [170.2, 54.5], [170.2, 59.1], [161.3, 70.5], [167.6, 52.7], [167.6, 62.7], [165.1, 86.3], [162.6, 66.4], [152.4, 67.3], [168.9, 63.0], [170.2, 73.6], [175.2, 62.3], [175.2, 57.7], [160.0, 55.4], [165.1, 104.1], [174.0, 55.5], [170.2, 77.3], [160.0, 80.5], [167.6, 64.5], [167.6, 72.3], [167.6, 61.4], [154.9, 58.2], [162.6, 81.8], [175.3, 63.6], [171.4, 53.4], [157.5, 54.5], [165.1, 53.6], [160.0, 60.0], [174.0, 73.6], [162.6, 61.4], [174.0, 55.5], [162.6, 63.6], [161.3, 60.9], [156.2, 60.0], [149.9, 46.8], [169.5, 57.3], [160.0, 64.1], [175.3, 63.6], [169.5, 67.3], [160.0, 75.5], [172.7, 68.2], [162.6, 61.4], [157.5, 76.8], [176.5, 71.8], [164.4, 55.5], [160.7, 48.6], [174.0, 66.4], [163.8, 67.3]] }, { name: 'Male', color: 'rgba(119, 152, 191, .5)', data: [[174.0, 65.6], [175.3, 71.8], [193.5, 80.7], [186.5, 72.6], [187.2, 78.8], [181.5, 74.8], [184.0, 86.4], [184.5, 78.4], [175.0, 62.0], [184.0, 81.6], [180.0, 76.6], [177.8, 83.6], [192.0, 90.0], [176.0, 74.6], [174.0, 71.0], [184.0, 79.6], [192.7, 93.8], [171.5, 70.0], [173.0, 72.4], [176.0, 85.9], [176.0, 78.8], [180.5, 77.8], [172.7, 66.2], [176.0, 86.4], [173.5, 81.8], [178.0, 89.6], [180.3, 82.8], [180.3, 76.4], [164.5, 63.2], [173.0, 60.9], [183.5, 74.8], [175.5, 70.0], [188.0, 72.4], [189.2, 84.1], [172.8, 69.1], [170.0, 59.5], [182.0, 67.2], [170.0, 61.3], [177.8, 68.6], [184.2, 80.1], [186.7, 87.8], [171.4, 84.7], [172.7, 73.4], [175.3, 72.1], [180.3, 82.6], [182.9, 88.7], [188.0, 84.1], [177.2, 94.1], [172.1, 74.9], [167.0, 59.1], [169.5, 75.6], [174.0, 86.2], [172.7, 75.3], [182.2, 87.1], [164.1, 55.2], [163.0, 57.0], [171.5, 61.4], [184.2, 76.8], [174.0, 86.8], [174.0, 72.2], [177.0, 71.6], [186.0, 84.8], [167.0, 68.2], [171.8, 66.1], [182.0, 72.0], [167.0, 64.6], [177.8, 74.8], [164.5, 70.0], [192.0, 101.6], [175.5, 63.2], [171.2, 79.1], [181.6, 78.9], [167.4, 67.7], [181.1, 66.0], [177.0, 68.2], [174.5, 63.9], [177.5, 72.0], [170.5, 56.8], [182.4, 74.5], [197.1, 90.9], [180.1, 93.0], [175.5, 80.9], [180.6, 72.7], [184.4, 68.0], [175.5, 70.9], [180.6, 72.5], [177.0, 72.5], [177.1, 83.4], [181.6, 75.5], [176.5, 73.0], [175.0, 70.2], [174.0, 73.4], [165.1, 70.5], [177.0, 68.9], [192.0, 102.3], [176.5, 68.4], [169.4, 65.9], [182.1, 75.7], [179.8, 84.5], [175.3, 87.7], [184.9, 86.4], [177.3, 73.2], [167.4, 53.9], [178.1, 72.0], [168.9, 55.5], [157.2, 58.4], [180.3, 83.2], [170.2, 72.7], [177.8, 64.1], [172.7, 72.3], [165.1, 65.0], [186.7, 86.4], [165.1, 65.0], [174.0, 88.6], [175.3, 84.1], [185.4, 66.8], [177.8, 75.5], [180.3, 93.2], [180.3, 82.7], [177.8, 58.0], [177.8, 79.5], [177.8, 78.6], [177.8, 71.8], [177.8, 116.4], [163.8, 72.2], [188.0, 83.6], [198.1, 85.5], [175.3, 90.9], [166.4, 85.9], [190.5, 89.1], [166.4, 75.0], [177.8, 77.7], [179.7, 86.4], [172.7, 90.9], [190.5, 73.6], [185.4, 76.4], [168.9, 69.1], [167.6, 84.5], [175.3, 64.5], [170.2, 69.1], [190.5, 108.6], [177.8, 86.4], [190.5, 80.9], [177.8, 87.7], [184.2, 94.5], [176.5, 80.2], [177.8, 72.0], [180.3, 71.4], [171.4, 72.7], [172.7, 84.1], [172.7, 76.8], [177.8, 63.6], [177.8, 80.9], [182.9, 80.9], [170.2, 85.5], [167.6, 68.6], [175.3, 67.7], [165.1, 66.4], [185.4, 102.3], [181.6, 70.5], [172.7, 95.9], [190.5, 84.1], [179.1, 87.3], [175.3, 71.8], [170.2, 65.9], [193.0, 95.9], [171.4, 91.4], [177.8, 81.8], [177.8, 96.8], [167.6, 69.1], [167.6, 82.7], [180.3, 75.5], [182.9, 79.5], [176.5, 73.6], [186.7, 91.8], [188.0, 84.1], [188.0, 85.9], [177.8, 81.8], [174.0, 82.5], [177.8, 80.5], [171.4, 70.0], [185.4, 81.8], [185.4, 84.1], [188.0, 90.5], [188.0, 91.4], [182.9, 89.1], [176.5, 85.0], [175.3, 69.1], [175.3, 73.6], [188.0, 80.5], [188.0, 82.7], [175.3, 86.4], [170.5, 67.7], [179.1, 92.7], [177.8, 93.6], [175.3, 70.9], [182.9, 75.0], [170.8, 93.2], [188.0, 93.2], [180.3, 77.7], [177.8, 61.4], [185.4, 94.1], [168.9, 75.0], [185.4, 83.6], [180.3, 85.5], [174.0, 73.9], [167.6, 66.8], [182.9, 87.3], [160.0, 72.3], [180.3, 88.6], [167.6, 75.5], [186.7, 101.4], [175.3, 91.1], [175.3, 67.3], [175.9, 77.7], [175.3, 81.8], [179.1, 75.5], [181.6, 84.5], [177.8, 76.6], [182.9, 85.0], [177.8, 102.5], [184.2, 77.3], [179.1, 71.8], [176.5, 87.9], [188.0, 94.3], [174.0, 70.9], [167.6, 64.5], [170.2, 77.3], [167.6, 72.3], [188.0, 87.3], [174.0, 80.0], [176.5, 82.3], [180.3, 73.6], [167.6, 74.1], [188.0, 85.9], [180.3, 73.2], [167.6, 76.3], [183.0, 65.9], [183.0, 90.9], [179.1, 89.1], [170.2, 62.3], [177.8, 82.7], [179.1, 79.1], [190.5, 98.2], [177.8, 84.1], [180.3, 83.2], [180.3, 83.2]] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/scatter/index.htm
HTML
gpl2
12,361
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { // define the options var options = { chart: { renderTo: 'container' }, title: { text: 'Daily visits at www.highcharts.com' }, subtitle: { text: 'Source: Google Analytics' }, xAxis: { type: 'datetime', tickInterval: 7 * 24 * 3600 * 1000, // one week tickWidth: 0, gridLineWidth: 1, labels: { align: 'left', x: 3, y: -3 } }, yAxis: [{ // left y axis title: { text: null }, labels: { align: 'left', x: 3, y: 16, formatter: function() { return Highcharts.numberFormat(this.value, 0); } }, showFirstLabel: false }, { // right y axis linkedTo: 0, gridLineWidth: 0, opposite: true, title: { text: null }, labels: { align: 'right', x: -3, y: 16, formatter: function() { return Highcharts.numberFormat(this.value, 0); } }, showFirstLabel: false }], legend: { align: 'left', verticalAlign: 'top', y: 20, floating: true, borderWidth: 0 }, tooltip: { shared: true, crosshairs: true }, plotOptions: { series: { cursor: 'pointer', point: { events: { click: function() { hs.htmlExpand(null, { pageOrigin: { x: this.pageX, y: this.pageY }, headingText: this.series.name, maincontentText: Highcharts.dateFormat('%A, %b %e, %Y', this.x) +':<br/> '+ this.y +' visits', width: 200 }); } } }, marker: { lineWidth: 1 } } }, series: [{ name: 'All visits', lineWidth: 4, marker: { radius: 4 } }, { name: 'New visitors' }] }; // Load data asynchronously using jQuery. On success, add the data // to the options and initiate the chart. // This data is obtained by exporting a GA custom report to TSV. // http://api.jquery.com/jQuery.get/ jQuery.get('analytics.tsv', null, function(tsv, state, xhr) { var lines = [], listen = false, date, // set up the two data series allVisits = [], newVisitors = []; // inconsistency if (typeof tsv !== 'string') { tsv = xhr.responseText; } // split the data return into lines and parse them tsv = tsv.split(/\n/g); jQuery.each(tsv, function(i, line) { // listen for data lines between the Graph and Table headers if (tsv[i - 3] == '# Graph') { listen = true; } else if (line == '' || line.charAt(0) == '#') { listen = false; } // all data lines start with a double quote if (listen) { line = line.split(/\t/); date = Date.parse(line[0] +' UTC'); allVisits.push([ date, parseInt(line[1].replace(',', ''), 10) ]); newVisitors.push([ date, parseInt(line[2].replace(',', ''), 10) ]); } }); options.series[0].data = allVisits; options.series[1].data = newVisitors; chart = new Highcharts.Chart(options); }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <!-- Additional files for the Highslide popup effect --> <script type="text/javascript" src="http://www.highcharts.com/highslide/highslide-full.min.js"></script> <script type="text/javascript" src="http://www.highcharts.com/highslide/highslide.config.js" charset="utf-8"></script> <link rel="stylesheet" type="text/css" href="http://www.highcharts.com/highslide/highslide.css" /> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/line-ajax/index.htm
HTML
gpl2
5,939
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'column' }, title: { text: 'Total fruit consumtion, grouped by gender' }, xAxis: { categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'] }, yAxis: { allowDecimals: false, min: 0, title: { text: 'Number of fruits' } }, tooltip: { formatter: function() { return '<b>'+ this.x +'</b><br/>'+ this.series.name +': '+ this.y +'<br/>'+ 'Total: '+ this.point.stackTotal; } }, plotOptions: { column: { stacking: 'normal' } }, series: [{ name: 'John', data: [5, 3, 4, 7, 2], stack: 'male' }, { name: 'Joe', data: [3, 4, 4, 2, 5], stack: 'male' }, { name: 'Jane', data: [2, 5, 6, 2, 1], stack: 'female' }, { name: 'Janet', data: [3, 0, 4, 4, 3], stack: 'female' }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/column-stacked-and-grouped/index.htm
HTML
gpl2
2,084
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'spline', inverted: true, width: 500, style: { margin: '0 auto' } }, title: { text: 'Atmosphere Temperature by Altitude' }, subtitle: { text: 'According to the Standard Atmosphere Model' }, xAxis: { reversed: false, title: { enabled: true, text: 'Altitude' }, labels: { formatter: function() { return this.value +'km'; } }, maxPadding: 0.05, showLastLabel: true }, yAxis: { title: { text: 'Temperature' }, labels: { formatter: function() { return this.value + '°'; } }, lineWidth: 2 }, legend: { enabled: false }, tooltip: { formatter: function() { return ''+ this.x +' km: '+ this.y +'°C'; } }, plotOptions: { spline: { marker: { enable: false } } }, series: [{ name: 'Temperature', data: [[0, 15], [10, -50], [20, -56.5], [30, -46.5], [40, -22.1], [50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/spline-inverted/index.htm
HTML
gpl2
2,479
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', zoomType: 'xy' }, title: { text: 'Average Monthly Weather Data for Tokyo' }, subtitle: { text: 'Source: WorldClimate.com' }, xAxis: [{ categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }], yAxis: [{ // Primary yAxis labels: { formatter: function() { return this.value +'°C'; }, style: { color: '#89A54E' } }, title: { text: 'Temperature', style: { color: '#89A54E' } }, opposite: true }, { // Secondary yAxis gridLineWidth: 0, title: { text: 'Rainfall', style: { color: '#4572A7' } }, labels: { formatter: function() { return this.value +' mm'; }, style: { color: '#4572A7' } } }, { // Tertiary yAxis gridLineWidth: 0, title: { text: 'Sea-Level Pressure', style: { color: '#AA4643' } }, labels: { formatter: function() { return this.value +' mb'; }, style: { color: '#AA4643' } }, opposite: true }], tooltip: { formatter: function() { var unit = { 'Rainfall': 'mm', 'Temperature': '°C', 'Sea-Level Pressure': 'mb' }[this.series.name]; return ''+ this.x +': '+ this.y +' '+ unit; } }, legend: { layout: 'vertical', align: 'left', x: 120, verticalAlign: 'top', y: 80, floating: true, backgroundColor: '#FFFFFF' }, series: [{ name: 'Rainfall', color: '#4572A7', type: 'column', yAxis: 1, data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }, { name: 'Sea-Level Pressure', type: 'spline', color: '#AA4643', yAxis: 2, data: [1016, 1016, 1015.9, 1015.5, 1012.3, 1009.5, 1009.6, 1010.2, 1013.1, 1016.9, 1018.2, 1016.7], marker: { enabled: false }, dashStyle: 'shortdot' }, { name: 'Temperature', color: '#89A54E', type: 'spline', data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/combo-multi-axes/index.htm
HTML
gpl2
4,218
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container' }, xAxis: { min: -0.5, max: 5.5 }, yAxis: { min: 0 }, title: { text: 'Scatter plot with regression line' }, series: [{ type: 'line', name: 'Regression Line', data: [[0, 1.11], [5, 4.51]], marker: { enabled: false }, states: { hover: { lineWidth: 0 } }, enableMouseTracking: false }, { type: 'scatter', name: 'Observations', data: [1, 1.5, 2.8, 3.5, 3.9, 4.2], marker: { radius: 4 } }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/combo-regression/index.htm
HTML
gpl2
1,591
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'spline' }, title: { text: 'Wind speed during two days' }, subtitle: { text: 'October 6th and 7th 2009 at two locations in Vik i Sogn, Norway' }, xAxis: { type: 'datetime' }, yAxis: { title: { text: 'Wind speed (m/s)' }, min: 0, minorGridLineWidth: 0, gridLineWidth: 0, alternateGridColor: null, plotBands: [{ // Light air from: 0.3, to: 1.5, color: 'rgba(68, 170, 213, 0.1)', label: { text: 'Light air', style: { color: '#606060' } } }, { // Light breeze from: 1.5, to: 3.3, color: 'rgba(0, 0, 0, 0)', label: { text: 'Light breeze', style: { color: '#606060' } } }, { // Gentle breeze from: 3.3, to: 5.5, color: 'rgba(68, 170, 213, 0.1)', label: { text: 'Gentle breeze', style: { color: '#606060' } } }, { // Moderate breeze from: 5.5, to: 8, color: 'rgba(0, 0, 0, 0)', label: { text: 'Moderate breeze', style: { color: '#606060' } } }, { // Fresh breeze from: 8, to: 11, color: 'rgba(68, 170, 213, 0.1)', label: { text: 'Fresh breeze', style: { color: '#606060' } } }, { // Strong breeze from: 11, to: 14, color: 'rgba(0, 0, 0, 0)', label: { text: 'Strong breeze', style: { color: '#606060' } } }, { // High wind from: 14, to: 15, color: 'rgba(68, 170, 213, 0.1)', label: { text: 'High wind', style: { color: '#606060' } } }] }, tooltip: { formatter: function() { return ''+ Highcharts.dateFormat('%e. %b %Y, %H:00', this.x) +': '+ this.y +' m/s'; } }, plotOptions: { spline: { lineWidth: 4, states: { hover: { lineWidth: 5 } }, marker: { enabled: false, states: { hover: { enabled: true, symbol: 'circle', radius: 5, lineWidth: 1 } } }, pointInterval: 3600000, // one hour pointStart: Date.UTC(2009, 9, 6, 0, 0, 0) } }, series: [{ name: 'Hestavollane', data: [4.3, 5.1, 4.3, 5.2, 5.4, 4.7, 3.5, 4.1, 5.6, 7.4, 6.9, 7.1, 7.9, 7.9, 7.5, 6.7, 7.7, 7.7, 7.4, 7.0, 7.1, 5.8, 5.9, 7.4, 8.2, 8.5, 9.4, 8.1, 10.9, 10.4, 10.9, 12.4, 12.1, 9.5, 7.5, 7.1, 7.5, 8.1, 6.8, 3.4, 2.1, 1.9, 2.8, 2.9, 1.3, 4.4, 4.2, 3.0, 3.0] }, { name: 'Voll', data: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.3, 0.0, 0.0, 0.4, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6, 1.2, 1.7, 0.7, 2.9, 4.1, 2.6, 3.7, 3.9, 1.7, 2.3, 3.0, 3.3, 4.8, 5.0, 4.8, 5.0, 3.2, 2.0, 0.9, 0.4, 0.3, 0.5, 0.4] }] , navigation: { menuItemStyle: { fontSize: '10px' } } }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/spline-plot-bands/index.htm
HTML
gpl2
5,739
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'line', marginRight: 130, marginBottom: 25 }, title: { text: 'Monthly Average Temperature', x: -20 //center }, subtitle: { text: 'Source: WorldClimate.com', x: -20 }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, yAxis: { title: { text: 'Temperature (°C)' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y +'°C'; } }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'top', x: -10, y: 100, borderWidth: 0 }, series: [{ name: 'Tokyo', data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] }, { name: 'New York', data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5] }, { name: 'Berlin', data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0] }, { name: 'London', data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/line-basic/index.htm
HTML
gpl2
2,515
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'area' }, title: { text: 'Historic and Estimated Worldwide Population Growth by Region' }, subtitle: { text: 'Source: Wikipedia.org' }, xAxis: { categories: ['1750', '1800', '1850', '1900', '1950', '1999', '2050'], tickmarkPlacement: 'on', title: { enabled: false } }, yAxis: { title: { text: 'Billions' }, labels: { formatter: function() { return this.value / 1000; } } }, tooltip: { formatter: function() { return ''+ this.x +': '+ Highcharts.numberFormat(this.y, 0, ',') +' millions'; } }, plotOptions: { area: { stacking: 'normal', lineColor: '#666666', lineWidth: 1, marker: { lineWidth: 1, lineColor: '#666666' } } }, series: [{ name: 'Asia', data: [502, 635, 809, 947, 1402, 3634, 5268] }, { name: 'Africa', data: [106, 107, 111, 133, 221, 767, 1766] }, { name: 'Europe', data: [163, 203, 276, 408, 547, 729, 628] }, { name: 'America', data: [18, 31, 54, 156, 339, 818, 1201] }, { name: 'Oceania', data: [2, 2, 2, 6, 13, 30, 46] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/area-stacked/index.htm
HTML
gpl2
2,580
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart, categories = ['0-4', '5-9', '10-14', '15-19', '20-24', '25-29', '30-34', '35-39', '40-44', '45-49', '50-54', '55-59', '60-64', '65-69', '70-74', '75-79', '80-84', '85-89', '90-94', '95-99', '100 +']; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'bar' }, title: { text: 'Population pyramid for Germany, midyear 2010' }, subtitle: { text: 'Source: www.census.gov' }, xAxis: [{ categories: categories, reversed: false }, { // mirror axis on right side opposite: true, reversed: false, categories: categories, linkedTo: 0 }], yAxis: { title: { text: null }, labels: { formatter: function(){ return (Math.abs(this.value) / 1000000) + 'M'; } }, min: -4000000, max: 4000000 }, plotOptions: { series: { stacking: 'normal' } }, tooltip: { formatter: function(){ return '<b>'+ this.series.name +', age '+ this.point.category +'</b><br/>'+ 'Population: '+ Highcharts.numberFormat(Math.abs(this.point.y), 0); } }, series: [{ name: 'Male', data: [-1746181, -1884428, -2089758, -2222362, -2537431, -2507081, -2443179, -2664537, -3556505, -3680231, -3143062, -2721122, -2229181, -2227768, -2176300, -1329968, -836804, -354784, -90569, -28367, -3878] }, { name: 'Female', data: [1656154, 1787564, 1981671, 2108575, 2403438, 2366003, 2301402, 2519874, 3360596, 3493473, 3050775, 2759560, 2304444, 2426504, 2568938, 1785638, 1447162, 1005011, 330870, 130632, 21208] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/bar-negative-stack/index.htm
HTML
gpl2
2,894
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'area' }, title: { text: 'Historic and Estimated Worldwide Population Distribution by Region' }, subtitle: { text: 'Source: Wikipedia.org' }, xAxis: { categories: ['1750', '1800', '1850', '1900', '1950', '1999', '2050'], tickmarkPlacement: 'on', title: { enabled: false } }, yAxis: { title: { text: 'Percent' } }, tooltip: { formatter: function() { return ''+ this.x +': '+ Highcharts.numberFormat(this.percentage, 1) +'% ('+ Highcharts.numberFormat(this.y, 0, ',') +' millions)'; } }, plotOptions: { area: { stacking: 'percent', lineColor: '#ffffff', lineWidth: 1, marker: { lineWidth: 1, lineColor: '#ffffff' } } }, series: [{ name: 'Asia', data: [502, 635, 809, 947, 1402, 3634, 5268] }, { name: 'Africa', data: [106, 107, 111, 133, 221, 767, 1766] }, { name: 'Europe', data: [163, 203, 276, 408, 547, 729, 628] }, { name: 'America', data: [18, 31, 54, 156, 339, 818, 1201] }, { name: 'Oceania', data: [2, 2, 2, 6, 13, 30, 46] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/area-stacked-percent/index.htm
HTML
gpl2
2,506
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { // On document ready, call visualize on the datatable. $(document).ready(function() { /** * Visualize an HTML table using Highcharts. The top (horizontal) header * is used for series names, and the left (vertical) header is used * for category names. This function is based on jQuery. * @param {Object} table The reference to the HTML table to visualize * @param {Object} options Highcharts options */ Highcharts.visualize = function(table, options) { // the categories options.xAxis.categories = []; $('tbody th', table).each( function(i) { options.xAxis.categories.push(this.innerHTML); }); // the data series options.series = []; $('tr', table).each( function(i) { var tr = this; $('th, td', tr).each( function(j) { if (j > 0) { // skip first column if (i == 0) { // get the name and init the series options.series[j - 1] = { name: this.innerHTML, data: [] }; } else { // add values options.series[j - 1].data.push(parseFloat(this.innerHTML)); } } }); }); var chart = new Highcharts.Chart(options); } var table = document.getElementById('datatable'), options = { chart: { renderTo: 'container', type: 'column' }, title: { text: 'Data extracted from a HTML table in the page' }, xAxis: { }, yAxis: { title: { text: 'Units' } }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ this.y +' '+ this.x.toLowerCase(); } } }; Highcharts.visualize(table, options); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> <table id="datatable"> <thead> <tr> <th></th> <th>Jane</th> <th>John</th> </tr> </thead> <tbody> <tr> <th>Apples</th> <td>3</td> <td>4</td> </tr> <tr> <th>Pears</th> <td>2</td> <td>0</td> </tr> <tr> <th>Plums</th> <td>5</td> <td>11</td> </tr> <tr> <th>Bananas</th> <td>1</td> <td>1</td> </tr> <tr> <th>Oranges</th> <td>2</td> <td>4</td> </tr> </tbody> </table> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/column-parsed/index.htm
HTML
gpl2
3,249
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'areaspline' }, title: { text: 'Average fruit consumption during one week' }, legend: { layout: 'vertical', align: 'left', verticalAlign: 'top', x: 150, y: 100, floating: true, borderWidth: 1, backgroundColor: '#FFFFFF' }, xAxis: { categories: [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ], plotBands: [{ // visualize the weekend from: 4.5, to: 6.5, color: 'rgba(68, 170, 213, .2)' }] }, yAxis: { title: { text: 'Fruit units' } }, tooltip: { formatter: function() { return ''+ this.x +': '+ this.y +' units'; } }, credits: { enabled: false }, plotOptions: { areaspline: { fillOpacity: 0.5 } }, series: [{ name: 'John', data: [3, 4, 3, 5, 4, 10, 12] }, { name: 'Jane', data: [1, 3, 4, 3, 3, 5, 4] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/areaspline/index.htm
HTML
gpl2
2,347
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: 'Browser market shares at a specific website, 2010' }, tooltip: { formatter: function() { return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %'; } }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, color: '#000000', connectorColor: '#000000', formatter: function() { return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %'; } } } }, series: [{ type: 'pie', name: 'Browser share', data: [ ['Firefox', 45.0], ['IE', 26.8], { name: 'Chrome', y: 12.8, sliced: true, selected: true }, ['Safari', 8.5], ['Opera', 6.2], ['Others', 0.7] ] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/pie-basic/index.htm
HTML
gpl2
2,194
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'column' }, title: { text: 'Column chart with negative values' }, xAxis: { categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'] }, tooltip: { formatter: function() { return ''+ this.series.name +': '+ this.y +''; } }, credits: { enabled: false }, series: [{ name: 'John', data: [5, 3, 4, 7, 2] }, { name: 'Jane', data: [2, -2, -3, 2, 1] }, { name: 'Joe', data: [3, 4, 4, -2, 5] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/column-negative/index.htm
HTML
gpl2
1,501
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'column' }, title: { text: 'Stacked column chart' }, xAxis: { categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'] }, yAxis: { min: 0, title: { text: 'Total fruit consumption' }, stackLabels: { enabled: true, style: { fontWeight: 'bold', color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray' } } }, legend: { align: 'right', x: -100, verticalAlign: 'top', y: 20, floating: true, backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColorSolid) || 'white', borderColor: '#CCC', borderWidth: 1, shadow: false }, tooltip: { formatter: function() { return '<b>'+ this.x +'</b><br/>'+ this.series.name +': '+ this.y +'<br/>'+ 'Total: '+ this.point.stackTotal; } }, plotOptions: { column: { stacking: 'normal', dataLabels: { enabled: true, color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white' } } }, series: [{ name: 'John', data: [5, 3, 4, 7, 2] }, { name: 'Jane', data: [2, 2, 3, 2, 1] }, { name: 'Joe', data: [3, 4, 4, 2, 5] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/column-stacked/index.htm
HTML
gpl2
2,643
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var data = [ 0.8446, 0.8445, 0.8444, 0.8451, 0.8418, 0.8264, 0.8258, 0.8232, 0.8233, 0.8258, 0.8283, 0.8278, 0.8256, 0.8292, 0.8239, 0.8239, 0.8245, 0.8265, 0.8261, 0.8269, 0.8273, 0.8244, 0.8244, 0.8172, 0.8139, 0.8146, 0.8164, 0.82, 0.8269, 0.8269, 0.8269, 0.8258, 0.8247, 0.8286, 0.8289, 0.8316, 0.832, 0.8333, 0.8352, 0.8357, 0.8355, 0.8354, 0.8403, 0.8403, 0.8406, 0.8403, 0.8396, 0.8418, 0.8409, 0.8384, 0.8386, 0.8372, 0.839, 0.84, 0.8389, 0.84, 0.8423, 0.8423, 0.8435, 0.8422, 0.838, 0.8373, 0.8316, 0.8303, 0.8303, 0.8302, 0.8369, 0.84, 0.8385, 0.84, 0.8401, 0.8402, 0.8381, 0.8351, 0.8314, 0.8273, 0.8213, 0.8207, 0.8207, 0.8215, 0.8242, 0.8273, 0.8301, 0.8346, 0.8312, 0.8312, 0.8312, 0.8306, 0.8327, 0.8282, 0.824, 0.8255, 0.8256, 0.8273, 0.8209, 0.8151, 0.8149, 0.8213, 0.8273, 0.8273, 0.8261, 0.8252, 0.824, 0.8262, 0.8258, 0.8261, 0.826, 0.8199, 0.8153, 0.8097, 0.8101, 0.8119, 0.8107, 0.8105, 0.8084, 0.8069, 0.8047, 0.8023, 0.7965, 0.7919, 0.7921, 0.7922, 0.7934, 0.7918, 0.7915, 0.787, 0.7861, 0.7861, 0.7853, 0.7867, 0.7827, 0.7834, 0.7766, 0.7751, 0.7739, 0.7767, 0.7802, 0.7788, 0.7828, 0.7816, 0.7829, 0.783, 0.7829, 0.7781, 0.7811, 0.7831, 0.7826, 0.7855, 0.7855, 0.7845, 0.7798, 0.7777, 0.7822, 0.7785, 0.7744, 0.7743, 0.7726, 0.7766, 0.7806, 0.785, 0.7907, 0.7912, 0.7913, 0.7931, 0.7952, 0.7951, 0.7928, 0.791, 0.7913, 0.7912, 0.7941, 0.7953, 0.7921, 0.7919, 0.7968, 0.7999, 0.7999, 0.7974, 0.7942, 0.796, 0.7969, 0.7862, 0.7821, 0.7821, 0.7821, 0.7811, 0.7833, 0.7849, 0.7819, 0.7809, 0.7809, 0.7827, 0.7848, 0.785, 0.7873, 0.7894, 0.7907, 0.7909, 0.7947, 0.7987, 0.799, 0.7927, 0.79, 0.7878, 0.7878, 0.7907, 0.7922, 0.7937, 0.786, 0.787, 0.7838, 0.7838, 0.7837, 0.7836, 0.7806, 0.7825, 0.7798, 0.777, 0.777, 0.7772, 0.7793, 0.7788, 0.7785, 0.7832, 0.7865, 0.7865, 0.7853, 0.7847, 0.7809, 0.778, 0.7799, 0.78, 0.7801, 0.7765, 0.7785, 0.7811, 0.782, 0.7835, 0.7845, 0.7844, 0.782, 0.7811, 0.7795, 0.7794, 0.7806, 0.7794, 0.7794, 0.7778, 0.7793, 0.7808, 0.7824, 0.787, 0.7894, 0.7893, 0.7882, 0.7871, 0.7882, 0.7871, 0.7878, 0.79, 0.7901, 0.7898, 0.7879, 0.7886, 0.7858, 0.7814, 0.7825, 0.7826, 0.7826, 0.786, 0.7878, 0.7868, 0.7883, 0.7893, 0.7892, 0.7876, 0.785, 0.787, 0.7873, 0.7901, 0.7936, 0.7939, 0.7938, 0.7956, 0.7975, 0.7978, 0.7972, 0.7995, 0.7995, 0.7994, 0.7976, 0.7977, 0.796, 0.7922, 0.7928, 0.7929, 0.7948, 0.797, 0.7953, 0.7907, 0.7872, 0.7852, 0.7852, 0.786, 0.7862, 0.7836, 0.7837, 0.784, 0.7867, 0.7867, 0.7869, 0.7837, 0.7827, 0.7825, 0.7779, 0.7791, 0.779, 0.7787, 0.78, 0.7807, 0.7803, 0.7817, 0.7799, 0.7799, 0.7795, 0.7801, 0.7765, 0.7725, 0.7683, 0.7641, 0.7639, 0.7616, 0.7608, 0.759, 0.7582, 0.7539, 0.75, 0.75, 0.7507, 0.7505, 0.7516, 0.7522, 0.7531, 0.7577, 0.7577, 0.7582, 0.755, 0.7542, 0.7576, 0.7616, 0.7648, 0.7648, 0.7641, 0.7614, 0.757, 0.7587, 0.7588, 0.762, 0.762, 0.7617, 0.7618, 0.7615, 0.7612, 0.7596, 0.758, 0.758, 0.758, 0.7547, 0.7549, 0.7613, 0.7655, 0.7693, 0.7694, 0.7688, 0.7678, 0.7708, 0.7727, 0.7749, 0.7741, 0.7741, 0.7732, 0.7727, 0.7737, 0.7724, 0.7712, 0.772, 0.7721, 0.7717, 0.7704, 0.769, 0.7711, 0.774, 0.7745, 0.7745, 0.774, 0.7716, 0.7713, 0.7678, 0.7688, 0.7718, 0.7718, 0.7728, 0.7729, 0.7698, 0.7685, 0.7681, 0.769, 0.769, 0.7698, 0.7699, 0.7651, 0.7613, 0.7616, 0.7614, 0.7614, 0.7607, 0.7602, 0.7611, 0.7622, 0.7615, 0.7598, 0.7598, 0.7592, 0.7573, 0.7566, 0.7567, 0.7591, 0.7582, 0.7585, 0.7613, 0.7631, 0.7615, 0.76, 0.7613, 0.7627, 0.7627, 0.7608, 0.7583, 0.7575, 0.7562, 0.752, 0.7512, 0.7512, 0.7517, 0.752, 0.7511, 0.748, 0.7509, 0.7531, 0.7531, 0.7527, 0.7498, 0.7493, 0.7504, 0.75, 0.7491, 0.7491, 0.7485, 0.7484, 0.7492, 0.7471, 0.7459, 0.7477, 0.7477, 0.7483, 0.7458, 0.7448, 0.743, 0.7399, 0.7395, 0.7395, 0.7378, 0.7382, 0.7362, 0.7355, 0.7348, 0.7361, 0.7361, 0.7365, 0.7362, 0.7331, 0.7339, 0.7344, 0.7327, 0.7327, 0.7336, 0.7333, 0.7359, 0.7359, 0.7372, 0.736, 0.736, 0.735, 0.7365, 0.7384, 0.7395, 0.7413, 0.7397, 0.7396, 0.7385, 0.7378, 0.7366, 0.74, 0.7411, 0.7406, 0.7405, 0.7414, 0.7431, 0.7431, 0.7438, 0.7443, 0.7443, 0.7443, 0.7434, 0.7429, 0.7442, 0.744, 0.7439, 0.7437, 0.7437, 0.7429, 0.7403, 0.7399, 0.7418, 0.7468, 0.748, 0.748, 0.749, 0.7494, 0.7522, 0.7515, 0.7502, 0.7472, 0.7472, 0.7462, 0.7455, 0.7449, 0.7467, 0.7458, 0.7427, 0.7427, 0.743, 0.7429, 0.744, 0.743, 0.7422, 0.7388, 0.7388, 0.7369, 0.7345, 0.7345, 0.7345, 0.7352, 0.7341, 0.7341, 0.734, 0.7324, 0.7272, 0.7264, 0.7255, 0.7258, 0.7258, 0.7256, 0.7257, 0.7247, 0.7243, 0.7244, 0.7235, 0.7235, 0.7235, 0.7235, 0.7262, 0.7288, 0.7301, 0.7337, 0.7337, 0.7324, 0.7297, 0.7317, 0.7315, 0.7288, 0.7263, 0.7263, 0.7242, 0.7253, 0.7264, 0.727, 0.7312, 0.7305, 0.7305, 0.7318, 0.7358, 0.7409, 0.7454, 0.7437, 0.7424, 0.7424, 0.7415, 0.7419, 0.7414, 0.7377, 0.7355, 0.7315, 0.7315, 0.732, 0.7332, 0.7346, 0.7328, 0.7323, 0.734, 0.734, 0.7336, 0.7351, 0.7346, 0.7321, 0.7294, 0.7266, 0.7266, 0.7254, 0.7242, 0.7213, 0.7197, 0.7209, 0.721, 0.721, 0.721, 0.7209, 0.7159, 0.7133, 0.7105, 0.7099, 0.7099, 0.7093, 0.7093, 0.7076, 0.707, 0.7049, 0.7012, 0.7011, 0.7019, 0.7046, 0.7063, 0.7089, 0.7077, 0.7077, 0.7077, 0.7091, 0.7118, 0.7079, 0.7053, 0.705, 0.7055, 0.7055, 0.7045, 0.7051, 0.7051, 0.7017, 0.7, 0.6995, 0.6994, 0.7014, 0.7036, 0.7021, 0.7002, 0.6967, 0.695, 0.695, 0.6939, 0.694, 0.6922, 0.6919, 0.6914, 0.6894, 0.6891, 0.6904, 0.689, 0.6834, 0.6823, 0.6807, 0.6815, 0.6815, 0.6847, 0.6859, 0.6822, 0.6827, 0.6837, 0.6823, 0.6822, 0.6822, 0.6792, 0.6746, 0.6735, 0.6731, 0.6742, 0.6744, 0.6739, 0.6731, 0.6761, 0.6761, 0.6785, 0.6818, 0.6836, 0.6823, 0.6805, 0.6793, 0.6849, 0.6833, 0.6825, 0.6825, 0.6816, 0.6799, 0.6813, 0.6809, 0.6868, 0.6933, 0.6933, 0.6945, 0.6944, 0.6946, 0.6964, 0.6965, 0.6956, 0.6956, 0.695, 0.6948, 0.6928, 0.6887, 0.6824, 0.6794, 0.6794, 0.6803, 0.6855, 0.6824, 0.6791, 0.6783, 0.6785, 0.6785, 0.6797, 0.68, 0.6803, 0.6805, 0.676, 0.677, 0.677, 0.6736, 0.6726, 0.6764, 0.6821, 0.6831, 0.6842, 0.6842, 0.6887, 0.6903, 0.6848, 0.6824, 0.6788, 0.6814, 0.6814, 0.6797, 0.6769, 0.6765, 0.6733, 0.6729, 0.6758, 0.6758, 0.675, 0.678, 0.6833, 0.6856, 0.6903, 0.6896, 0.6896, 0.6882, 0.6879, 0.6862, 0.6852, 0.6823, 0.6813, 0.6813, 0.6822, 0.6802, 0.6802, 0.6784, 0.6748, 0.6747, 0.6747, 0.6748, 0.6733, 0.665, 0.6611, 0.6583, 0.659, 0.659, 0.6581, 0.6578, 0.6574, 0.6532, 0.6502, 0.6514, 0.6514, 0.6507, 0.651, 0.6489, 0.6424, 0.6406, 0.6382, 0.6382, 0.6341, 0.6344, 0.6378, 0.6439, 0.6478, 0.6481, 0.6481, 0.6494, 0.6438, 0.6377, 0.6329, 0.6336, 0.6333, 0.6333, 0.633, 0.6371, 0.6403, 0.6396, 0.6364, 0.6356, 0.6356, 0.6368, 0.6357, 0.6354, 0.632, 0.6332, 0.6328, 0.6331, 0.6342, 0.6321, 0.6302, 0.6278, 0.6308, 0.6324, 0.6324, 0.6307, 0.6277, 0.6269, 0.6335, 0.6392, 0.64, 0.6401, 0.6396, 0.6407, 0.6423, 0.6429, 0.6472, 0.6485, 0.6486, 0.6467, 0.6444, 0.6467, 0.6509, 0.6478, 0.6461, 0.6461, 0.6468, 0.6449, 0.647, 0.6461, 0.6452, 0.6422, 0.6422, 0.6425, 0.6414, 0.6366, 0.6346, 0.635, 0.6346, 0.6346, 0.6343, 0.6346, 0.6379, 0.6416, 0.6442, 0.6431, 0.6431, 0.6435, 0.644, 0.6473, 0.6469, 0.6386, 0.6356, 0.634, 0.6346, 0.643, 0.6452, 0.6467, 0.6506, 0.6504, 0.6503, 0.6481, 0.6451, 0.645, 0.6441, 0.6414, 0.6409, 0.6409, 0.6428, 0.6431, 0.6418, 0.6371, 0.6349, 0.6333, 0.6334, 0.6338, 0.6342, 0.632, 0.6318, 0.637, 0.6368, 0.6368, 0.6383, 0.6371, 0.6371, 0.6355, 0.632, 0.6277, 0.6276, 0.6291, 0.6274, 0.6293, 0.6311, 0.631, 0.6312, 0.6312, 0.6304, 0.6294, 0.6348, 0.6378, 0.6368, 0.6368, 0.6368, 0.636, 0.637, 0.6418, 0.6411, 0.6435, 0.6427, 0.6427, 0.6419, 0.6446, 0.6468, 0.6487, 0.6594, 0.6666, 0.6666, 0.6678, 0.6712, 0.6705, 0.6718, 0.6784, 0.6811, 0.6811, 0.6794, 0.6804, 0.6781, 0.6756, 0.6735, 0.6763, 0.6762, 0.6777, 0.6815, 0.6802, 0.678, 0.6796, 0.6817, 0.6817, 0.6832, 0.6877, 0.6912, 0.6914, 0.7009, 0.7012, 0.701, 0.7005, 0.7076, 0.7087, 0.717, 0.7105, 0.7031, 0.7029, 0.7006, 0.7035, 0.7045, 0.6956, 0.6988, 0.6915, 0.6914, 0.6859, 0.6778, 0.6815, 0.6815, 0.6843, 0.6846, 0.6846, 0.6923, 0.6997, 0.7098, 0.7188, 0.7232, 0.7262, 0.7266, 0.7359, 0.7368, 0.7337, 0.7317, 0.7387, 0.7467, 0.7461, 0.7366, 0.7319, 0.7361, 0.7437, 0.7432, 0.7461, 0.7461, 0.7454, 0.7549, 0.7742, 0.7801, 0.7903, 0.7876, 0.7928, 0.7991, 0.8007, 0.7823, 0.7661, 0.785, 0.7863, 0.7862, 0.7821, 0.7858, 0.7731, 0.7779, 0.7844, 0.7866, 0.7864, 0.7788, 0.7875, 0.7971, 0.8004, 0.7857, 0.7932, 0.7938, 0.7927, 0.7918, 0.7919, 0.7989, 0.7988, 0.7949, 0.7948, 0.7882, 0.7745, 0.771, 0.775, 0.7791, 0.7882, 0.7882, 0.7899, 0.7905, 0.7889, 0.7879, 0.7855, 0.7866, 0.7865, 0.7795, 0.7758, 0.7717, 0.761, 0.7497, 0.7471, 0.7473, 0.7407, 0.7288, 0.7074, 0.6927, 0.7083, 0.7191, 0.719, 0.7153, 0.7156, 0.7158, 0.714, 0.7119, 0.7129, 0.7129, 0.7049, 0.7095 ]; var masterChart, detailChart; $(document).ready(function() { // create the master chart function createMaster() { masterChart = new Highcharts.Chart({ chart: { renderTo: 'master-container', reflow: false, borderWidth: 0, backgroundColor: null, marginLeft: 50, marginRight: 20, zoomType: 'x', events: { // listen to the selection event on the master chart to update the // extremes of the detail chart selection: function(event) { var extremesObject = event.xAxis[0], min = extremesObject.min, max = extremesObject.max, detailData = [], xAxis = this.xAxis[0]; // reverse engineer the last part of the data jQuery.each(this.series[0].data, function(i, point) { if (point.x > min && point.x < max) { detailData.push({ x: point.x, y: point.y }); } }); // move the plot bands to reflect the new detail span xAxis.removePlotBand('mask-before'); xAxis.addPlotBand({ id: 'mask-before', from: Date.UTC(2006, 0, 1), to: min, color: 'rgba(0, 0, 0, 0.2)' }); xAxis.removePlotBand('mask-after'); xAxis.addPlotBand({ id: 'mask-after', from: max, to: Date.UTC(2008, 11, 31), color: 'rgba(0, 0, 0, 0.2)' }); detailChart.series[0].setData(detailData); return false; } } }, title: { text: null }, xAxis: { type: 'datetime', showLastTickLabel: true, maxZoom: 14 * 24 * 3600000, // fourteen days plotBands: [{ id: 'mask-before', from: Date.UTC(2006, 0, 1), to: Date.UTC(2008, 7, 1), color: 'rgba(0, 0, 0, 0.2)' }], title: { text: null } }, yAxis: { gridLineWidth: 0, labels: { enabled: false }, title: { text: null }, min: 0.6, showFirstLabel: false }, tooltip: { formatter: function() { return false; } }, legend: { enabled: false }, credits: { enabled: false }, plotOptions: { series: { fillColor: { linearGradient: [0, 0, 0, 70], stops: [ [0, '#4572A7'], [1, 'rgba(0,0,0,0)'] ] }, lineWidth: 1, marker: { enabled: false }, shadow: false, states: { hover: { lineWidth: 1 } }, enableMouseTracking: false } }, series: [{ type: 'area', name: 'USD to EUR', pointInterval: 24 * 3600 * 1000, pointStart: Date.UTC(2006, 0, 01), data: data }], exporting: { enabled: false } }, function(masterChart) { createDetail(masterChart) }); } // create the detail chart function createDetail(masterChart) { // prepare the detail chart var detailData = [], detailStart = Date.UTC(2008, 7, 1); jQuery.each(masterChart.series[0].data, function(i, point) { if (point.x >= detailStart) { detailData.push(point.y); } }); // create a detail chart referenced by a global variable detailChart = new Highcharts.Chart({ chart: { marginBottom: 120, renderTo: 'detail-container', reflow: false, marginLeft: 50, marginRight: 20, style: { position: 'absolute' } }, credits: { enabled: false }, title: { text: 'Historical USD to EUR Exchange Rate' }, subtitle: { text: 'Select an area by dragging across the lower chart' }, xAxis: { type: 'datetime' }, yAxis: { title: { text: null }, maxZoom: 0.1 }, tooltip: { formatter: function() { var point = this.points[0]; return '<b>'+ point.series.name +'</b><br/>'+ Highcharts.dateFormat('%A %B %e %Y', this.x) + ':<br/>'+ '1 USD = '+ Highcharts.numberFormat(point.y, 2) +' EUR'; }, shared: true }, legend: { enabled: false }, plotOptions: { series: { marker: { enabled: false, states: { hover: { enabled: true, radius: 3 } } } } }, series: [{ name: 'USD to EUR', pointStart: detailStart, pointInterval: 24 * 3600 * 1000, data: detailData }], exporting: { enabled: false } }); } // make the container smaller and add a second container for the master chart var $container = $('#container') .css('position', 'relative'); var $detailContainer = $('<div id="detail-container">') .appendTo($container); var $masterContainer = $('<div id="master-container">') .css({ position: 'absolute', top: 300, height: 80, width: '100%' }) .appendTo($container); // create master and in its callback, create the detail chart createMaster(); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/dynamic-master-detail/index.htm
HTML
gpl2
18,507
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container' }, title: { text: 'Logarithmic axis demo' }, xAxis: { tickInterval: 1 }, yAxis: { type: 'logarithmic', minorTickInterval: 0.1 }, tooltip: { headerFormat: '<b>{series.name}</b><br />', pointFormat: 'x = {point.x}, y = {point.y}' }, series: [{ data: [1, 2, 4, 8, 16, 32, 64, 128, 256, 512], pointStart: 1 }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/line-log-axis/index.htm
HTML
gpl2
1,366
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'line' }, title: { text: 'Monthly Average Temperature' }, subtitle: { text: 'Source: WorldClimate.com' }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, yAxis: { title: { text: 'Temperature (°C)' } }, tooltip: { enabled: false, formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y +'°C'; } }, plotOptions: { line: { dataLabels: { enabled: true }, enableMouseTracking: false } }, series: [{ name: 'Tokyo', data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] }, { name: 'London', data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/line-labels/index.htm
HTML
gpl2
1,975
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { $(document).ready(function() { Highcharts.setOptions({ global: { useUTC: false } }); var chart; chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'spline', marginRight: 10, events: { load: function() { // set up the updating of the chart each second var series = this.series[0]; setInterval(function() { var x = (new Date()).getTime(), // current time y = Math.random(); series.addPoint([x, y], true, true); }, 1000); } } }, title: { text: 'Live random data' }, xAxis: { type: 'datetime', tickPixelInterval: 150 }, yAxis: { title: { text: 'Value' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+ Highcharts.numberFormat(this.y, 2); } }, legend: { enabled: false }, exporting: { enabled: false }, series: [{ name: 'Random data', data: (function() { // generate an array of random data var data = [], time = (new Date()).getTime(), i; for (i = -19; i <= 0; i++) { data.push({ x: time + i * 1000, y: Math.random() }); } return data; })() }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/dynamic-update/index.htm
HTML
gpl2
2,886
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'spline' }, title: { text: 'Snow depth in the Vikjafjellet mountain, Norway' }, subtitle: { text: 'An example of irregular time data in Highcharts JS' }, xAxis: { type: 'datetime', dateTimeLabelFormats: { // don't display the dummy year month: '%e. %b', year: '%b' } }, yAxis: { title: { text: 'Snow depth (m)' }, min: 0 }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ Highcharts.dateFormat('%e. %b', this.x) +': '+ this.y +' m'; } }, series: [{ name: 'Winter 2007-2008', // Define the data points. All series have a dummy year // of 1970/71 in order to be compared on the same x axis. Note // that in JavaScript, months start at 0 for January, 1 for February etc. data: [ [Date.UTC(1970, 9, 27), 0 ], [Date.UTC(1970, 10, 10), 0.6 ], [Date.UTC(1970, 10, 18), 0.7 ], [Date.UTC(1970, 11, 2), 0.8 ], [Date.UTC(1970, 11, 9), 0.6 ], [Date.UTC(1970, 11, 16), 0.6 ], [Date.UTC(1970, 11, 28), 0.67], [Date.UTC(1971, 0, 1), 0.81], [Date.UTC(1971, 0, 8), 0.78], [Date.UTC(1971, 0, 12), 0.98], [Date.UTC(1971, 0, 27), 1.84], [Date.UTC(1971, 1, 10), 1.80], [Date.UTC(1971, 1, 18), 1.80], [Date.UTC(1971, 1, 24), 1.92], [Date.UTC(1971, 2, 4), 2.49], [Date.UTC(1971, 2, 11), 2.79], [Date.UTC(1971, 2, 15), 2.73], [Date.UTC(1971, 2, 25), 2.61], [Date.UTC(1971, 3, 2), 2.76], [Date.UTC(1971, 3, 6), 2.82], [Date.UTC(1971, 3, 13), 2.8 ], [Date.UTC(1971, 4, 3), 2.1 ], [Date.UTC(1971, 4, 26), 1.1 ], [Date.UTC(1971, 5, 9), 0.25], [Date.UTC(1971, 5, 12), 0 ] ] }, { name: 'Winter 2008-2009', data: [ [Date.UTC(1970, 9, 18), 0 ], [Date.UTC(1970, 9, 26), 0.2 ], [Date.UTC(1970, 11, 1), 0.47], [Date.UTC(1970, 11, 11), 0.55], [Date.UTC(1970, 11, 25), 1.38], [Date.UTC(1971, 0, 8), 1.38], [Date.UTC(1971, 0, 15), 1.38], [Date.UTC(1971, 1, 1), 1.38], [Date.UTC(1971, 1, 8), 1.48], [Date.UTC(1971, 1, 21), 1.5 ], [Date.UTC(1971, 2, 12), 1.89], [Date.UTC(1971, 2, 25), 2.0 ], [Date.UTC(1971, 3, 4), 1.94], [Date.UTC(1971, 3, 9), 1.91], [Date.UTC(1971, 3, 13), 1.75], [Date.UTC(1971, 3, 19), 1.6 ], [Date.UTC(1971, 4, 25), 0.6 ], [Date.UTC(1971, 4, 31), 0.35], [Date.UTC(1971, 5, 7), 0 ] ] }, { name: 'Winter 2009-2010', data: [ [Date.UTC(1970, 9, 9), 0 ], [Date.UTC(1970, 9, 14), 0.15], [Date.UTC(1970, 10, 28), 0.35], [Date.UTC(1970, 11, 12), 0.46], [Date.UTC(1971, 0, 1), 0.59], [Date.UTC(1971, 0, 24), 0.58], [Date.UTC(1971, 1, 1), 0.62], [Date.UTC(1971, 1, 7), 0.65], [Date.UTC(1971, 1, 23), 0.77], [Date.UTC(1971, 2, 8), 0.77], [Date.UTC(1971, 2, 14), 0.79], [Date.UTC(1971, 2, 24), 0.86], [Date.UTC(1971, 3, 4), 0.8 ], [Date.UTC(1971, 3, 18), 0.94], [Date.UTC(1971, 3, 24), 0.9 ], [Date.UTC(1971, 4, 16), 0.39], [Date.UTC(1971, 4, 21), 0 ] ] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/spline-irregular-time/index.htm
HTML
gpl2
5,350
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container' }, title: { text: 'Combination chart' }, xAxis: { categories: ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums'] }, tooltip: { formatter: function() { var s; if (this.point.name) { // the pie chart s = ''+ this.point.name +': '+ this.y +' fruits'; } else { s = ''+ this.x +': '+ this.y; } return s; } }, labels: { items: [{ html: 'Total fruit consumption', style: { left: '40px', top: '8px', color: 'black' } }] }, series: [{ type: 'column', name: 'Jane', data: [3, 2, 1, 3, 4] }, { type: 'column', name: 'John', data: [2, 3, 5, 7, 6] }, { type: 'column', name: 'Joe', data: [4, 3, 3, 9, 0] }, { type: 'spline', name: 'Average', data: [3, 2.67, 3, 6.33, 3.33] }, { type: 'pie', name: 'Total consumption', data: [{ name: 'Jane', y: 13, color: '#4572A7' // Jane's color }, { name: 'John', y: 23, color: '#AA4643' // John's color }, { name: 'Joe', y: 19, color: '#89A54E' // Joe's color }], center: [100, 80], size: 100, showInLegend: false, dataLabels: { enabled: false } }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/combo/index.htm
HTML
gpl2
2,864
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: 'Browser market shares at a specific website, 2010' }, tooltip: { formatter: function() { return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %'; } }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: false }, showInLegend: true } }, series: [{ type: 'pie', name: 'Browser share', data: [ ['Firefox', 45.0], ['IE', 26.8], { name: 'Chrome', y: 12.8, sliced: true, selected: true }, ['Safari', 8.5], ['Opera', 6.2], ['Others', 0.7] ] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/pie-legend/index.htm
HTML
gpl2
1,975
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', zoomType: 'x', spacingRight: 20 }, title: { text: 'USD to EUR exchange rate from 2006 through 2008' }, subtitle: { text: document.ontouchstart === undefined ? 'Click and drag in the plot area to zoom in' : 'Drag your finger over the plot to zoom in' }, xAxis: { type: 'datetime', maxZoom: 14 * 24 * 3600000, // fourteen days title: { text: null } }, yAxis: { title: { text: 'Exchange rate' }, min: 0.6, startOnTick: false, showFirstLabel: false }, tooltip: { shared: true }, legend: { enabled: false }, plotOptions: { area: { fillColor: { linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1}, stops: [ [0, Highcharts.getOptions().colors[0]], [1, 'rgba(2,0,0,0)'] ] }, lineWidth: 1, marker: { enabled: false, states: { hover: { enabled: true, radius: 5 } } }, shadow: false, states: { hover: { lineWidth: 1 } } } }, series: [{ type: 'area', name: 'USD to EUR', pointInterval: 24 * 3600 * 1000, pointStart: Date.UTC(2006, 0, 01), data: [ 0.8446, 0.8445, 0.8444, 0.8451, 0.8418, 0.8264, 0.8258, 0.8232, 0.8233, 0.8258, 0.8283, 0.8278, 0.8256, 0.8292, 0.8239, 0.8239, 0.8245, 0.8265, 0.8261, 0.8269, 0.8273, 0.8244, 0.8244, 0.8172, 0.8139, 0.8146, 0.8164, 0.82, 0.8269, 0.8269, 0.8269, 0.8258, 0.8247, 0.8286, 0.8289, 0.8316, 0.832, 0.8333, 0.8352, 0.8357, 0.8355, 0.8354, 0.8403, 0.8403, 0.8406, 0.8403, 0.8396, 0.8418, 0.8409, 0.8384, 0.8386, 0.8372, 0.839, 0.84, 0.8389, 0.84, 0.8423, 0.8423, 0.8435, 0.8422, 0.838, 0.8373, 0.8316, 0.8303, 0.8303, 0.8302, 0.8369, 0.84, 0.8385, 0.84, 0.8401, 0.8402, 0.8381, 0.8351, 0.8314, 0.8273, 0.8213, 0.8207, 0.8207, 0.8215, 0.8242, 0.8273, 0.8301, 0.8346, 0.8312, 0.8312, 0.8312, 0.8306, 0.8327, 0.8282, 0.824, 0.8255, 0.8256, 0.8273, 0.8209, 0.8151, 0.8149, 0.8213, 0.8273, 0.8273, 0.8261, 0.8252, 0.824, 0.8262, 0.8258, 0.8261, 0.826, 0.8199, 0.8153, 0.8097, 0.8101, 0.8119, 0.8107, 0.8105, 0.8084, 0.8069, 0.8047, 0.8023, 0.7965, 0.7919, 0.7921, 0.7922, 0.7934, 0.7918, 0.7915, 0.787, 0.7861, 0.7861, 0.7853, 0.7867, 0.7827, 0.7834, 0.7766, 0.7751, 0.7739, 0.7767, 0.7802, 0.7788, 0.7828, 0.7816, 0.7829, 0.783, 0.7829, 0.7781, 0.7811, 0.7831, 0.7826, 0.7855, 0.7855, 0.7845, 0.7798, 0.7777, 0.7822, 0.7785, 0.7744, 0.7743, 0.7726, 0.7766, 0.7806, 0.785, 0.7907, 0.7912, 0.7913, 0.7931, 0.7952, 0.7951, 0.7928, 0.791, 0.7913, 0.7912, 0.7941, 0.7953, 0.7921, 0.7919, 0.7968, 0.7999, 0.7999, 0.7974, 0.7942, 0.796, 0.7969, 0.7862, 0.7821, 0.7821, 0.7821, 0.7811, 0.7833, 0.7849, 0.7819, 0.7809, 0.7809, 0.7827, 0.7848, 0.785, 0.7873, 0.7894, 0.7907, 0.7909, 0.7947, 0.7987, 0.799, 0.7927, 0.79, 0.7878, 0.7878, 0.7907, 0.7922, 0.7937, 0.786, 0.787, 0.7838, 0.7838, 0.7837, 0.7836, 0.7806, 0.7825, 0.7798, 0.777, 0.777, 0.7772, 0.7793, 0.7788, 0.7785, 0.7832, 0.7865, 0.7865, 0.7853, 0.7847, 0.7809, 0.778, 0.7799, 0.78, 0.7801, 0.7765, 0.7785, 0.7811, 0.782, 0.7835, 0.7845, 0.7844, 0.782, 0.7811, 0.7795, 0.7794, 0.7806, 0.7794, 0.7794, 0.7778, 0.7793, 0.7808, 0.7824, 0.787, 0.7894, 0.7893, 0.7882, 0.7871, 0.7882, 0.7871, 0.7878, 0.79, 0.7901, 0.7898, 0.7879, 0.7886, 0.7858, 0.7814, 0.7825, 0.7826, 0.7826, 0.786, 0.7878, 0.7868, 0.7883, 0.7893, 0.7892, 0.7876, 0.785, 0.787, 0.7873, 0.7901, 0.7936, 0.7939, 0.7938, 0.7956, 0.7975, 0.7978, 0.7972, 0.7995, 0.7995, 0.7994, 0.7976, 0.7977, 0.796, 0.7922, 0.7928, 0.7929, 0.7948, 0.797, 0.7953, 0.7907, 0.7872, 0.7852, 0.7852, 0.786, 0.7862, 0.7836, 0.7837, 0.784, 0.7867, 0.7867, 0.7869, 0.7837, 0.7827, 0.7825, 0.7779, 0.7791, 0.779, 0.7787, 0.78, 0.7807, 0.7803, 0.7817, 0.7799, 0.7799, 0.7795, 0.7801, 0.7765, 0.7725, 0.7683, 0.7641, 0.7639, 0.7616, 0.7608, 0.759, 0.7582, 0.7539, 0.75, 0.75, 0.7507, 0.7505, 0.7516, 0.7522, 0.7531, 0.7577, 0.7577, 0.7582, 0.755, 0.7542, 0.7576, 0.7616, 0.7648, 0.7648, 0.7641, 0.7614, 0.757, 0.7587, 0.7588, 0.762, 0.762, 0.7617, 0.7618, 0.7615, 0.7612, 0.7596, 0.758, 0.758, 0.758, 0.7547, 0.7549, 0.7613, 0.7655, 0.7693, 0.7694, 0.7688, 0.7678, 0.7708, 0.7727, 0.7749, 0.7741, 0.7741, 0.7732, 0.7727, 0.7737, 0.7724, 0.7712, 0.772, 0.7721, 0.7717, 0.7704, 0.769, 0.7711, 0.774, 0.7745, 0.7745, 0.774, 0.7716, 0.7713, 0.7678, 0.7688, 0.7718, 0.7718, 0.7728, 0.7729, 0.7698, 0.7685, 0.7681, 0.769, 0.769, 0.7698, 0.7699, 0.7651, 0.7613, 0.7616, 0.7614, 0.7614, 0.7607, 0.7602, 0.7611, 0.7622, 0.7615, 0.7598, 0.7598, 0.7592, 0.7573, 0.7566, 0.7567, 0.7591, 0.7582, 0.7585, 0.7613, 0.7631, 0.7615, 0.76, 0.7613, 0.7627, 0.7627, 0.7608, 0.7583, 0.7575, 0.7562, 0.752, 0.7512, 0.7512, 0.7517, 0.752, 0.7511, 0.748, 0.7509, 0.7531, 0.7531, 0.7527, 0.7498, 0.7493, 0.7504, 0.75, 0.7491, 0.7491, 0.7485, 0.7484, 0.7492, 0.7471, 0.7459, 0.7477, 0.7477, 0.7483, 0.7458, 0.7448, 0.743, 0.7399, 0.7395, 0.7395, 0.7378, 0.7382, 0.7362, 0.7355, 0.7348, 0.7361, 0.7361, 0.7365, 0.7362, 0.7331, 0.7339, 0.7344, 0.7327, 0.7327, 0.7336, 0.7333, 0.7359, 0.7359, 0.7372, 0.736, 0.736, 0.735, 0.7365, 0.7384, 0.7395, 0.7413, 0.7397, 0.7396, 0.7385, 0.7378, 0.7366, 0.74, 0.7411, 0.7406, 0.7405, 0.7414, 0.7431, 0.7431, 0.7438, 0.7443, 0.7443, 0.7443, 0.7434, 0.7429, 0.7442, 0.744, 0.7439, 0.7437, 0.7437, 0.7429, 0.7403, 0.7399, 0.7418, 0.7468, 0.748, 0.748, 0.749, 0.7494, 0.7522, 0.7515, 0.7502, 0.7472, 0.7472, 0.7462, 0.7455, 0.7449, 0.7467, 0.7458, 0.7427, 0.7427, 0.743, 0.7429, 0.744, 0.743, 0.7422, 0.7388, 0.7388, 0.7369, 0.7345, 0.7345, 0.7345, 0.7352, 0.7341, 0.7341, 0.734, 0.7324, 0.7272, 0.7264, 0.7255, 0.7258, 0.7258, 0.7256, 0.7257, 0.7247, 0.7243, 0.7244, 0.7235, 0.7235, 0.7235, 0.7235, 0.7262, 0.7288, 0.7301, 0.7337, 0.7337, 0.7324, 0.7297, 0.7317, 0.7315, 0.7288, 0.7263, 0.7263, 0.7242, 0.7253, 0.7264, 0.727, 0.7312, 0.7305, 0.7305, 0.7318, 0.7358, 0.7409, 0.7454, 0.7437, 0.7424, 0.7424, 0.7415, 0.7419, 0.7414, 0.7377, 0.7355, 0.7315, 0.7315, 0.732, 0.7332, 0.7346, 0.7328, 0.7323, 0.734, 0.734, 0.7336, 0.7351, 0.7346, 0.7321, 0.7294, 0.7266, 0.7266, 0.7254, 0.7242, 0.7213, 0.7197, 0.7209, 0.721, 0.721, 0.721, 0.7209, 0.7159, 0.7133, 0.7105, 0.7099, 0.7099, 0.7093, 0.7093, 0.7076, 0.707, 0.7049, 0.7012, 0.7011, 0.7019, 0.7046, 0.7063, 0.7089, 0.7077, 0.7077, 0.7077, 0.7091, 0.7118, 0.7079, 0.7053, 0.705, 0.7055, 0.7055, 0.7045, 0.7051, 0.7051, 0.7017, 0.7, 0.6995, 0.6994, 0.7014, 0.7036, 0.7021, 0.7002, 0.6967, 0.695, 0.695, 0.6939, 0.694, 0.6922, 0.6919, 0.6914, 0.6894, 0.6891, 0.6904, 0.689, 0.6834, 0.6823, 0.6807, 0.6815, 0.6815, 0.6847, 0.6859, 0.6822, 0.6827, 0.6837, 0.6823, 0.6822, 0.6822, 0.6792, 0.6746, 0.6735, 0.6731, 0.6742, 0.6744, 0.6739, 0.6731, 0.6761, 0.6761, 0.6785, 0.6818, 0.6836, 0.6823, 0.6805, 0.6793, 0.6849, 0.6833, 0.6825, 0.6825, 0.6816, 0.6799, 0.6813, 0.6809, 0.6868, 0.6933, 0.6933, 0.6945, 0.6944, 0.6946, 0.6964, 0.6965, 0.6956, 0.6956, 0.695, 0.6948, 0.6928, 0.6887, 0.6824, 0.6794, 0.6794, 0.6803, 0.6855, 0.6824, 0.6791, 0.6783, 0.6785, 0.6785, 0.6797, 0.68, 0.6803, 0.6805, 0.676, 0.677, 0.677, 0.6736, 0.6726, 0.6764, 0.6821, 0.6831, 0.6842, 0.6842, 0.6887, 0.6903, 0.6848, 0.6824, 0.6788, 0.6814, 0.6814, 0.6797, 0.6769, 0.6765, 0.6733, 0.6729, 0.6758, 0.6758, 0.675, 0.678, 0.6833, 0.6856, 0.6903, 0.6896, 0.6896, 0.6882, 0.6879, 0.6862, 0.6852, 0.6823, 0.6813, 0.6813, 0.6822, 0.6802, 0.6802, 0.6784, 0.6748, 0.6747, 0.6747, 0.6748, 0.6733, 0.665, 0.6611, 0.6583, 0.659, 0.659, 0.6581, 0.6578, 0.6574, 0.6532, 0.6502, 0.6514, 0.6514, 0.6507, 0.651, 0.6489, 0.6424, 0.6406, 0.6382, 0.6382, 0.6341, 0.6344, 0.6378, 0.6439, 0.6478, 0.6481, 0.6481, 0.6494, 0.6438, 0.6377, 0.6329, 0.6336, 0.6333, 0.6333, 0.633, 0.6371, 0.6403, 0.6396, 0.6364, 0.6356, 0.6356, 0.6368, 0.6357, 0.6354, 0.632, 0.6332, 0.6328, 0.6331, 0.6342, 0.6321, 0.6302, 0.6278, 0.6308, 0.6324, 0.6324, 0.6307, 0.6277, 0.6269, 0.6335, 0.6392, 0.64, 0.6401, 0.6396, 0.6407, 0.6423, 0.6429, 0.6472, 0.6485, 0.6486, 0.6467, 0.6444, 0.6467, 0.6509, 0.6478, 0.6461, 0.6461, 0.6468, 0.6449, 0.647, 0.6461, 0.6452, 0.6422, 0.6422, 0.6425, 0.6414, 0.6366, 0.6346, 0.635, 0.6346, 0.6346, 0.6343, 0.6346, 0.6379, 0.6416, 0.6442, 0.6431, 0.6431, 0.6435, 0.644, 0.6473, 0.6469, 0.6386, 0.6356, 0.634, 0.6346, 0.643, 0.6452, 0.6467, 0.6506, 0.6504, 0.6503, 0.6481, 0.6451, 0.645, 0.6441, 0.6414, 0.6409, 0.6409, 0.6428, 0.6431, 0.6418, 0.6371, 0.6349, 0.6333, 0.6334, 0.6338, 0.6342, 0.632, 0.6318, 0.637, 0.6368, 0.6368, 0.6383, 0.6371, 0.6371, 0.6355, 0.632, 0.6277, 0.6276, 0.6291, 0.6274, 0.6293, 0.6311, 0.631, 0.6312, 0.6312, 0.6304, 0.6294, 0.6348, 0.6378, 0.6368, 0.6368, 0.6368, 0.636, 0.637, 0.6418, 0.6411, 0.6435, 0.6427, 0.6427, 0.6419, 0.6446, 0.6468, 0.6487, 0.6594, 0.6666, 0.6666, 0.6678, 0.6712, 0.6705, 0.6718, 0.6784, 0.6811, 0.6811, 0.6794, 0.6804, 0.6781, 0.6756, 0.6735, 0.6763, 0.6762, 0.6777, 0.6815, 0.6802, 0.678, 0.6796, 0.6817, 0.6817, 0.6832, 0.6877, 0.6912, 0.6914, 0.7009, 0.7012, 0.701, 0.7005, 0.7076, 0.7087, 0.717, 0.7105, 0.7031, 0.7029, 0.7006, 0.7035, 0.7045, 0.6956, 0.6988, 0.6915, 0.6914, 0.6859, 0.6778, 0.6815, 0.6815, 0.6843, 0.6846, 0.6846, 0.6923, 0.6997, 0.7098, 0.7188, 0.7232, 0.7262, 0.7266, 0.7359, 0.7368, 0.7337, 0.7317, 0.7387, 0.7467, 0.7461, 0.7366, 0.7319, 0.7361, 0.7437, 0.7432, 0.7461, 0.7461, 0.7454, 0.7549, 0.7742, 0.7801, 0.7903, 0.7876, 0.7928, 0.7991, 0.8007, 0.7823, 0.7661, 0.785, 0.7863, 0.7862, 0.7821, 0.7858, 0.7731, 0.7779, 0.7844, 0.7866, 0.7864, 0.7788, 0.7875, 0.7971, 0.8004, 0.7857, 0.7932, 0.7938, 0.7927, 0.7918, 0.7919, 0.7989, 0.7988, 0.7949, 0.7948, 0.7882, 0.7745, 0.771, 0.775, 0.7791, 0.7882, 0.7882, 0.7899, 0.7905, 0.7889, 0.7879, 0.7855, 0.7866, 0.7865, 0.7795, 0.7758, 0.7717, 0.761, 0.7497, 0.7471, 0.7473, 0.7407, 0.7288, 0.7074, 0.6927, 0.7083, 0.7191, 0.719, 0.7153, 0.7156, 0.7158, 0.714, 0.7119, 0.7129, 0.7129, 0.7049, 0.7095 ] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/line-time-series/index.htm
HTML
gpl2
13,767
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> $(function () { var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'bar' }, title: { text: 'Stacked bar chart' }, xAxis: { categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'] }, yAxis: { min: 0, title: { text: 'Total fruit consumption' } }, legend: { backgroundColor: '#FFFFFF', reversed: true }, tooltip: { formatter: function() { return ''+ this.series.name +': '+ this.y +''; } }, plotOptions: { series: { stacking: 'normal' } }, series: [{ name: 'John', data: [5, 3, 4, 7, 2] }, { name: 'Jane', data: [2, 2, 3, 2, 1] }, { name: 'Joe', data: [3, 4, 4, 2, 5] }] }); }); }); </script> </head> <body> <script src="../../js/highcharts.js"></script> <script src="../../js/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/examples/bar-stacked/index.htm
HTML
gpl2
1,806
<?php /** * This file is part of the exporting module for Highcharts JS. * www.highcharts.com/license * * * Available POST variables: * * $filename string The desired filename without extension * $type string The MIME type for export. * $width int The pixel width of the exported raster image. The height is calculated. * $svg string The SVG source code to convert. */ // Options define ('BATIK_PATH', 'batik-rasterizer.jar'); /////////////////////////////////////////////////////////////////////////////// ini_set('magic_quotes_gpc', 'off'); $type = $_POST['type']; $svg = (string) $_POST['svg']; $filename = (string) $_POST['filename']; // prepare variables if (!$filename) $filename = 'chart'; if (get_magic_quotes_gpc()) { $svg = stripslashes($svg); } $tempName = md5(rand()); // allow no other than predefined types if ($type == 'image/png') { $typeString = '-m image/png'; $ext = 'png'; } elseif ($type == 'image/jpeg') { $typeString = '-m image/jpeg'; $ext = 'jpg'; } elseif ($type == 'application/pdf') { $typeString = '-m application/pdf'; $ext = 'pdf'; } elseif ($type == 'image/svg+xml') { $ext = 'svg'; } $outfile = "temp/$tempName.$ext"; if (isset($typeString)) { // size if ($_POST['width']) { $width = (int)$_POST['width']; if ($width) $width = "-w $width"; } // generate the temporary file if (!file_put_contents("temp/$tempName.svg", $svg)) { die("Couldn't create temporary file. Check that the directory permissions for the /temp directory are set to 777."); } // do the conversion $output = shell_exec("java -jar ". BATIK_PATH ." $typeString -d $outfile $width temp/$tempName.svg"); // catch error if (!is_file($outfile) || filesize($outfile) < 10) { echo "<pre>$output</pre>"; echo "Error while converting SVG. "; if (strpos($output, 'SVGConverter.error.while.rasterizing.file') !== false) { echo "SVG code for debugging: <hr/>"; echo htmlentities($svg); } } // stream it else { header("Content-Disposition: attachment; filename=\"$filename.$ext\""); header("Content-Type: $type"); echo file_get_contents($outfile); } // delete it unlink("temp/$tempName.svg"); unlink($outfile); // SVG can be streamed directly back } else if ($ext == 'svg') { header("Content-Disposition: attachment; filename=\"$filename.$ext\""); header("Content-Type: $type"); echo $svg; } else { echo "Invalid type"; } ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/exporting-server/index.php
PHP
gpl2
2,448
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-utf-8" /> <title>Highcharts Examples</title> </head> <body> <h1>Highcharts Examples</h1> <h4>Line and scatter charts</h4> <ul> <li><a href="examples/line-basic/index.htm">Basic line</a></li> <li><a href="examples/line-ajax/index.htm">Ajax loaded data, clickable points</a></li> <li><a href="examples/line-labels/index.htm">With data labels</a></li> <li><a href="examples/line-time-series/index.htm">Time series, zoomable</a></li> <li><a href="examples/spline-inverted/index.htm">Spline with inverted axes</a></li> <li><a href="examples/spline-symbols/index.htm">Spline with symbols</a></li> <li><a href="examples/spline-plot-bands/index.htm">Spline with plot bands</a></li> <li><a href="examples/spline-irregular-time/index.htm">Time data with irregular intervals</a></li> <li><a href="examples/line-log-axis/index.htm">Logarithmic axis</a></li> <li><a href="examples/scatter/index.htm">Scatter plot</a></li> </ul> <h4>Area charts</h4> <ul> <li><a href="examples/area-basic/index.htm">Basic area</a></li> <li><a href="examples/area-negative/index.htm">Area with negative values</a></li> <li><a href="examples/area-stacked/index.htm">Stacked area</a></li> <li><a href="examples/area-stacked-percent/index.htm">Percentage area</a></li> <li><a href="examples/area-missing/index.htm">Area with missing points</a></li> <li><a href="examples/area-inverted/index.htm">Inverted axes</a></li> <li><a href="examples/areaspline/index.htm">Area-spline</a></li> </ul> <h4>Column and bar charts</h4> <ul> <li><a href="examples/bar-basic/index.htm">Basic bar</a></li> <li><a href="examples/bar-stacked/index.htm">Stacked bar</a></li> <li><a href="examples/bar-negative-stack/index.htm">Bar with negative stack</a></li> <li><a href="examples/column-basic/index.htm">Basic column</a></li> <li><a href="examples/column-negative/index.htm">Column with negative values</a></li> <li><a href="examples/column-stacked/index.htm">Stacked column</a></li> <li><a href="examples/column-stacked-and-grouped/index.htm">Stacked and grouped column</a></li> <li><a href="examples/column-stacked-percent/index.htm">Stacked percentage column</a></li> <li><a href="examples/column-rotated-labels/index.htm">Column with rotated labels</a></li> <li><a href="examples/column-drilldown/index.htm">Column with drilldown</a></li> <li><a href="examples/column-parsed/index.htm">Data defined in a HTML table</a></li> </ul> <h4>Pie charts</h4> <ul> <li><a href="examples/pie-basic/index.htm">Pie chart</a></li> <li><a href="examples/pie-donut/index.htm">Donut chart</a></li> <li><a href="examples/pie-legend/index.htm">Pie with legend</a></li> </ul> <h4>Dynamic charts</h4> <ul> <li><a href="examples/dynamic-update/index.htm">Spline updating each second</a></li> <li><a href="examples/dynamic-click-to-add/index.htm">Click to add a point</a></li> <li><a href="examples/dynamic-master-detail/index.htm">Master-detail chart</a></li> </ul> <h4>Combinations</h4> <ul> <li><a href="examples/combo/index.htm">Column, line and pie</a></li> <li><a href="examples/combo-dual-axes/index.htm">Dual axes, line and column</a></li> <li><a href="examples/combo-multi-axes/index.htm">Multiple axes</a></li> <li><a href="examples/combo-regression/index.htm">Scatter with regression line</a></li> </ul> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/Highcharts-2.2.3/index.htm
HTML
gpl2
3,587
/// <reference path="../../jquery-1.7.1.js" /> /// <reference path="../qunit/qunit.js" /> /// <reference path="../../jsrender.js" /> function compileTmpl( template ) { try { return typeof $.templates( null, template ).fn === "function" ? "compiled" : "failed compile"; } catch(e) { return "error:" + e; } } function sort( array ){ var ret = ""; if ( this.props.reverse ) { // Render in reverse order for ( var i = array.length; i; i-- ) { ret += this.tmpl.render( array[ i - 1 ] ); } } else { // Render in original order ret += this.tmpl.render( array ); } return ret; } var person = { name: "Jo" }, people = [{ name: "Jo" },{ name: "Bill" }], towns = [{ name: "Seattle" },{ name: "Paris" },{ name: "Delhi" }]; var tmplString = "A_{{:name}}_B"; $.views.allowCode = true; module( "api" ); test("templates", function() { expect(14); $.templates( "myTmpl", tmplString ); equal( $.render.myTmpl( person ), "A_Jo_B", 'Compile a template and then render it: $.templates( "myTmpl", tmplString ); $.render.myTmpl( data );' ); $.templates({ myTmpl2: tmplString }); equal( $.render.myTmpl2( person ), "A_Jo_B", 'Compile and register templates: $.templates({ "myTmpl", tmplString, ... }); $.render.myTmpl( data );' ); equal( $.templates.myTmpl2.render( person ), "A_Jo_B", 'Get named template: $.templates.myTmpl.render( data );' ); equal( $.templates( tmplString ).render( person ), "A_Jo_B", 'Compile without registering as named template: $.templates( tmplString ).render( person );' ); var tmpl2 = $.templates( "#myTmpl" ); equal( $.trim( tmpl2.render( person )), "A_Jo_B", 'var tmpl = $.templates( "#myTmpl" ); returns compiled template for script element' ); $.templates({ myTmpl3: { markup: "#myTmpl" } }); equal( $.trim( $.render.myTmpl3( person )), "A_Jo_B", 'Named template for template object with selector: { markup: "#myTmpl" }' ); var tmpl2 = $.templates( "#myTmpl" ); equal( $.trim( tmpl2.render( person )), "A_Jo_B", 'var tmpl = $.templates( "#myTmpl" ); returns compiled template for script element' ); var tmpl3 = $.templates( "", { markup: "#myTmpl" }); equal( $.trim( tmpl3.render( person )), "A_Jo_B", 'Compile from template object with selector, without registering: { markup: "#myTmpl" }' ); equal( $.templates( "#myTmpl" ).fn === tmpl2.fn && tmpl2.fn === tmpl3.fn, true, '$.templates( "#myTmpl" ) caches compiled template, and does not recompile each time;' ); equal( tmpl2 === $.templates( "", "#myTmpl" ), true, '$.templates( "#myTmpl" ) and $.templates( "", "#myTmpl" ) are equivalent' ); var cloned = $.templates( "cloned", "#myTmpl" ); equal( cloned !== tmpl2 && cloned.name == "cloned", true, '$.templates( "cloned", "#myTmpl" ) will clone the cached template' ); $.templates({ cloned: "#myTmpl" }); equal( $.templates.cloned !== tmpl2 && $.templates.cloned.name == "cloned", true, '$.templates({ cloned: "#myTmpl" }) will clone the cached template' ); $.templates( "myTmpl", null ); equal( $.templates.myTmpl, undefined, 'Remove a named template: $.templates( "myTmpl", null );' ); var tmpl3 = $.templates({ "scriptTmpl": { markup: "#myTmpl", debug:true }, "tmplFromString": { markup: "testDebug", debug:true } }); equal( $.templates.tmplFromString.fn.toString().indexOf("debugger;") > 0 && $.templates.scriptTmpl.fn.toString().indexOf("debugger;") > 0, true, 'Debug a template: set debug:true on object' ); }); test("render", function() { expect(5); equal( $.trim( $("#myTmpl").render( person )), "A_Jo_B", '$( tmplSelector ).render( data );' ); // Trimming because IE adds whitespace var tmpl3 = $.templates( "myTmpl4", tmplString ); equal( $.render.myTmpl4( person ), "A_Jo_B", '$.render.myTmpl( object );' ); equal( $.render.myTmpl4( people ), "A_Jo_BA_Bill_B", '$.render.myTmpl( array );' ); var tmplObject = $.templates.myTmpl4; equal( tmplObject.render( people ), "A_Jo_BA_Bill_B", 'var tmplObject = $.templates.myTmpl; tmplObject.render( data );' ); $.templates( "myTmpl5", "A_{{for}}inner{{:name}}content{{/for}}_B" ); equal( $.templates.myTmpl5.tmpls[0].render( person ), "innerJocontent", 'Nested template objects: $.templates.myTmpl.tmpls' ); }); test("converters", function() { expect(3); function loc( data ) { switch (data) { case "desktop": return "bureau"; }; } $.views.converters({ loc: loc }); equal( $.templates( "{{loc:#data}}:{{loc:'desktop'}}" ).render( "desktop" ), "bureau:bureau", "$.views.converters({ loc: locFunction })" ); $.views.converters( "loc2", loc ); equal( $.views.converters.loc2 === loc, true, 'locFunction === $.views.converters.loc' ); $.views.converters({ loc2: null}); equal( $.views.converters.loc2, undefined, 'Remove a registered converter: $.views.converters({ loc: null })'); }); test("tags", function() { expect(3); $.views.tags({ sort: sort }); equal( $.templates( "{{sort people reverse=true}}{{:name}}{{/sort}}" ).render({ people: people }), "BillJo", "$.views.tags({ sort: sortFunction })" ); $.views.tags( "sort2", sort ); equal( $.views.tags.sort === sort, true, 'sortFunction === $.views.tags.sort' ); $.views.tags( "sort2", null ); equal( $.views.tags.sort2, undefined, 'Remove a registered tag: $.views.tag({ sor: null })' ); }); test("helpers", function() { expect(3); function concat() { return "".concat.apply( "", arguments ); } $.views.helpers({ not: function( value ) { return !value; }, concat: concat }) equal( $.templates( "{{:~concat(a, 'b', ~not(false))}}" ).render({ a: "aVal" }), "aValbtrue", "$.views.helpers({ concat: concatFunction })"); $.views.helpers({ concat2: concat }); equal( $.views.helpers.concat === concat, true, 'concatFunction === $.views.helpers.concat' ); $.views.helpers("concat2", null); equal($.views.helpers.concat2, undefined, 'Remove a registered helper: $.views.helpers({ concat: null })' ); }); test("template encapsulation", function() { expect(1); $.templates({ myTmpl6: { markup: "{{sort reverse=true people}}{{:name}}{{/sort}}", tags: { sort: sort } } }); equal( $.render.myTmpl6({ people: people }), "BillJo", '$.templates( "myTmpl", tmplObjWithNestedItems );' ); });
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/test/unit/jsrender-tests-with-jquery.js
JavaScript
gpl2
6,189
/// <reference path="../../jsrender.js" /> function compileTmpl( template ) { try { return typeof jsviews.templates( template ).fn === "function" ? "compiled" : "failed compile"; } catch(e) { return "error:" + e; } } function sort( array ){ var ret = ""; if ( this.props.reverse ) { // Render in reverse order if (arguments.length > 1) { for ( i = arguments.length; i; i-- ) { ret += sort.call( this, arguments[ i - 1 ]); } } else for ( var i = array.length; i; i-- ) { ret += this.tmpl.render( array[ i - 1 ] ); } } else { // Render in original order ret += this.tmpl.render( array ); } return ret; } var person = { name: "Jo" }, people = [{ name: "Jo" },{ name: "Bill" }], towns = [{ name: "Seattle" },{ name: "Paris" },{ name: "Delhi" }]; var tmplString = "A_{{:name}}_B"; jsviews.tags({ sort: sort }); module( "tagParser" ); test("{{if}} {{else}}", function() { expect(3); equal( compileTmpl( "A_{{if true}}{{/if}}_B" ), "compiled", "Empty if block: {{if}}{{/if}}" ); equal( compileTmpl( "A_{{if true}}yes{{/if}}_B" ), "compiled", "{{if}}...{{/if}}" ); equal( compileTmpl( "A_{{if true/}}yes{{/if}}_B" ), "error:Expected block tag", "Mismatching block tags: {{if/}} {{/if}}" ); }); module( "{{if}}" ); test("{{if}}", function() { expect(4); equal( jsviews.templates( "A_{{if true}}yes{{/if}}_B" ).render({}), "A_yes_B", "{{if a}}: a" ); equal( jsviews.templates( "A_{{if false}}yes{{/if}}_B" ).render({}), "A__B", "{{if a}}: !a" ); equal( jsviews.templates( "A_{{if true}}{{/if}}_B" ).render({}), "A__B", "{{if a}}: empty: a" ); equal( jsviews.templates( "A_{{if false}}{{/if}}_B" ).render({}), "A__B", "{{if a}}: empty: !a" ); }); test("{{if}} {{else}}", function() { expect(5); equal( jsviews.templates( "A_{{if true}}yes{{else}}no{{/if}}_B" ).render({}), "A_yes_B", "{{if a}} {{else}}: a" ); equal( jsviews.templates( "A_{{if false}}yes{{else}}no{{/if}}_B" ).render({}), "A_no_B", "{{if a}} {{else}}: !a" ); equal( jsviews.templates( "A_{{if true}}yes{{else true}}or{{else}}no{{/if}}_B" ).render({}), "A_yes_B", "{{if a}} {{else b}} {{else}}: a" ); equal( jsviews.templates( "A_{{if false}}yes{{else true}}or{{else}}no{{/if}}_B" ).render({}), "A_or_B", "{{if a}} {{else b}} {{else}}: b" ); equal( jsviews.templates( "A_{{if false}}yes{{else false}}or{{else}}no{{/if}}_B" ).render({}), "A_no_B", "{{if a}} {{else b}} {{else}}: !a!b" ); }); test("{{if}} {{else}} external templates", function() { expect(2); equal( jsviews.templates( "A_{{if true tmpl='yes<br/>'/}}_B" ).render({}), "A_yes<br/>_B", "{{if a tmpl=foo/}}: a" ); equal( jsviews.templates( "A_{{if false tmpl='yes<br/>'}}{{else false tmpl='or<br/>'}}{{else tmpl='no<br/>'}}{{/if}}_B" ).render({}), "A_no<br/>_B", "{{if a tmpl=foo}}{{else b tmpl=bar}}{{else tmpl=baz}}: !a!b" ); }); module( "{{:}}" ); test("convert", function() { expect(4); equal( jsviews.templates( "{{>#data}}" ).render( "<br/>'\"&" ), "&lt;br/&gt;&#39;&#34;&amp;", "default html converter" ); equal( jsviews.templates( "{{html:#data}}" ).render( "<br/>'\"&" ), "&lt;br/&gt;&#39;&#34;&amp;", "html converter" ); equal( jsviews.templates( "{{:#data}}" ).render( "<br/>'\"&" ), "<br/>'\"&", "no convert" ); function loc( data ) { switch (data) { case "desktop": return "bureau"; }; } jsviews.converters("loc", loc); equal(jsviews.templates( "{{loc:#data}}:{{loc:'desktop'}}" ).render( "desktop" ), "bureau:bureau", 'jsviews.converters("loc", locFunction);... {{loc:#data}}' ); }); test("paths", function() { expect(16); equal( jsviews.templates( "{{:a}}" ).render({ a: "aVal" }), "aVal", "a" ); equal( jsviews.templates( "{{:a.b}}" ).render({ a: { b: "bVal" }}), "bVal", "a.b" ); equal( jsviews.templates( "{{:a.b.c}}" ).render({ a: { b: { c: "cVal" }}}), "cVal", "a.b.c" ); equal( jsviews.templates( "{{:a.name}}" ).render({ a: { name: "aName" }} ), "aName", "a.name" ); equal( jsviews.templates( "{{:a['name']}}" ).render({ a: { name: "aName"} } ), "aName", "a['name']"); equal( jsviews.templates( "{{:a['x - _*!']}}" ).render({ a: { "x - _*!": "aName"} } ), "aName", "a['x - _*!']"); equal( jsviews.templates( '{{:a["x - _*!"]}}').render({ a: { "x - _*!": "aName"} }), "aName", 'a["x - _*!"]'); equal( jsviews.templates( "{{:a.b[1].d}}" ).render({ a: { b: [0, { d: "dVal"}]} }), "dVal", "a.b[1].d"); equal( jsviews.templates( "{{:a.b[1].d}}" ).render({ a: { b: {1:{ d: "dVal" }}}}), "dVal", "a.b[1].d" ); equal( jsviews.templates( "{{:a.b[~incr(1-1)].d}}" ).render({ a: { b: {1:{ d: "dVal" }}}}, { incr:function(val){ return val + 1; }}), "dVal", "a.b[~incr(1-1)].d" ); equal( jsviews.templates( "{{:a.b.c.d}}" ).render({ a: { b: {'c':{ d: "dVal" }}}}), "dVal", "a.b.c.d" ); equal( jsviews.templates( "{{:a[0]}}" ).render({ a: [ "bVal" ]}), "bVal", "a[0]" ); equal( jsviews.templates( "{{:a.b[1][0].msg}}" ).render({ a: { b: [22,[{ msg: " yes - that's right. "}]] }}), " yes - that's right. ", "a.b[1][0].msg" ); equal( jsviews.templates( "{{:#data.a}}" ).render({ a: "aVal" }), "aVal", "#data.a" ); equal( jsviews.templates( "{{:#view.data.a}}" ).render({ a: "aVal" }), "aVal", "#view.data.a" ); equal( jsviews.templates( "{{:#index === 0}}" ).render([{ a: "aVal" }]), "true", "#index" ); }); test("types", function() { expect(10); equal( jsviews.templates( "{{:'abc'}}" ).render({}), "abc", "'abc'" ); equal( jsviews.templates( "{{:true}}" ).render({}), "true", "true" ); equal( jsviews.templates( "{{:false}}" ).render({}), "false", "false" ); equal( jsviews.templates( "{{:null}}" ).render({}), "", 'null -> ""' ); equal( jsviews.templates( "{{:199}}" ).render({}), "199", "199" ); equal( jsviews.templates( "{{: 199.9 }}" ).render({}), "199.9", "| 199.9 |" ); equal( jsviews.templates( "{{:-33.33}}" ).render({}), "-33.33", "-33.33" ); equal( jsviews.templates( "{{: -33.33 }}" ).render({}), "-33.33", "| -33.33 |" ); equal( jsviews.templates( "{{:-33.33 - 2.2}}" ).render({}), "-35.53", "-33.33 - 2.2" ); equal( jsviews.templates( "{{:notdefined}}" ).render({}), "", "notdefined" ); }); test("comparisons", function() { expect(22); equal( jsviews.templates( "{{:1<2}}" ).render({}), "true", "1<2" ); equal( jsviews.templates( "{{:2<1}}" ).render({}), "false", "2<1" ); equal( jsviews.templates( "{{:5===5}}" ).render({}), "true", "5===5" ); equal( jsviews.templates( "{{:0==''}}" ).render({}), "true", "0==''" ); equal( jsviews.templates( "{{:'ab'=='ab'}}" ).render({}), "true", "'ab'=='ab'" ); equal( jsviews.templates( "{{:2>1}}" ).render({}), "true", "2>1" ); equal( jsviews.templates( "{{:2 == 2}}" ).render({}), "true", "2 == 2" ); equal( jsviews.templates( "{{:2<=2}}" ).render({}), "true", "2<=2" ); equal( jsviews.templates( "{{:'ab'<'ac'}}" ).render({}), "true", "'ab'<'ac'" ); equal( jsviews.templates( "{{:3>=3}}" ).render({}), "true", "3 =3" ); equal( jsviews.templates( "{{:3>=2}}" ).render({}), "true", "3>=2" ); equal( jsviews.templates( "{{:3>=4}}" ).render({}), "false", "3>=4" ); equal( jsviews.templates( "{{:3 !== 2}}" ).render({}), "true", "3 !== 2" ); equal( jsviews.templates( "{{:3 != 2}}" ).render({}), "true", "3 != 2" ); equal( jsviews.templates( "{{:0 !== null}}" ).render({}), "true", "0 !== null" ); equal( jsviews.templates( "{{:(3 >= 4)}}" ).render({}), "false", "3>=4" ); equal( jsviews.templates( "{{:3 >= 4}}" ).render({}), "false", "3>=4" ); equal( jsviews.templates( "{{:(3>=4)}}" ).render({}), "false", "3>=4" ); equal( jsviews.templates( "{{:(3 < 4)}}" ).render({}), "true", "3>=4" ); equal( jsviews.templates( "{{:3 < 4}}" ).render({}), "true", "3>=4" ); equal( jsviews.templates( "{{:(3<4)}}" ).render({}), "true", "3>=4" ); equal( jsviews.templates( "{{:0 != null}}" ).render({}), "true", "0 != null" ); }); test("array access", function() { equal( jsviews.templates( "{{:a[1]}}" ).render({ a: ["a0","a1"] }), "a1", "a[1]" ); equal( jsviews.templates( "{{:a[1+1]+5}}" ).render({ a: [11,22,33] }), "38", "a[1+1]+5)" ); equal( jsviews.templates( "{{:a[~incr(1)]+5}}" ).render({ a: [11,22,33] }, { incr:function(val){ return val + 1; }}), "38", "a[~incr(1)]+5" ); equal( jsviews.templates( "{{:true && (a[0] || 'default')}}" ).render({ a: [0,22,33] }, { incr:function(val){ return val + 1; }}), "default", "true && (a[0] || 'default')" ); }); test("context", function() { expect(4); equal( jsviews.templates( "{{:~val}}" ).render( 1, { val: "myvalue" }), "myvalue", "~val" ); function format(value, upper) { return value[upper ? "toUpperCase" : "toLowerCase"](); } equal( jsviews.templates( "{{:~format(name) + ~format(name, true)}}" ).render( person, { format: format }), "joJO", "render( data, { format: formatFn }); ... {{:~format(name, true)}}" ); equal( jsviews.templates( "{{for people[0]}}{{:~format(~type) + ~format(name, true)}}{{/for}}" ).render({ people: people}, { format: format, type: "PascalCase" }), "pascalcaseJO", "render( data, { format: formatFn }); ... {{:~format(name, true)}}" ); equal( jsviews.templates( "{{for people ~twn=town}}{{:name}} lives in {{:~format(~twn, true)}}. {{/for}}" ).render({ people: people, town:"Redmond" }, { format: format }), "Jo lives in REDMOND. Bill lives in REDMOND. ", "Passing in context to nested templates: {{for people ~twn=town}}" ); }); test("values", function() { expect(4); equal( jsviews.templates( "{{:a}}" ).render({ a: 0 }), "0", "0" ); equal( jsviews.templates( "{{:b}}" ).render({ a: 0 }), "", "undefined" ); equal( jsviews.templates( "{{:a}}" ).render({ a: "" }), "", "" ); equal( jsviews.templates( "{{:b}}" ).render({ a: null }), "", null ); }); test("expressions", function() { expect(7); equal( compileTmpl( "{{:a++}}" ), "error:Syntax error", "a++" ); equal( compileTmpl( "{{:(a,b)}}" ), "error:Syntax error", "(a,b)" ); equal( jsviews.templates( "{{: a+2}}" ).render({ a: 2, b: false }), "4", "a+2"); equal( jsviews.templates( "{{: b?'yes':'no' }}" ).render({ a: 2, b: false }), "no", "b?'yes':'no'"); equal( jsviews.templates( "{{:(a||-1) + (b||-1) }}" ).render({ a: 2, b: 0 }), "1", "a||-1"); equal( jsviews.templates( "{{:3*b()*!a*4/3}}" ).render({ a: false, b: function () { return 3; }}), "12", "3*b()*!a*4/3"); equal( jsviews.templates( "{{:a%b}}" ).render({ a: 30, b: 16}), "14", "a%b"); }); module( "{{for}}" ); test("{{for}}", function() { expect(10); jsviews.templates( { forTmpl: "header_{{for people}}{{:name}}{{/for}}_footer", layoutTmpl: { markup: "header_{{for #data}}{{:name}}{{/for}}_footer", layout: true }, pageTmpl: '{{for people tmpl="layoutTmpl"/}}', simpleFor: "a{{for people}}Content{{/for}}b", forPrimitiveDataTypes: "a{{for people}}{{:#data}}{{/for}}b" }); equal( jsviews.render.forTmpl({ people: people }), "header_JoBill_footer", '{{for people}}...{{/for}}' ); equal( jsviews.render.layoutTmpl( people ), "header_JoBill_footer", 'layout: true... "header_{{for #data}}{{:name}}{{/for}}_footer"' ); equal( jsviews.render.pageTmpl({ people: people }), "header_JoBill_footer", '{{for people tmpl="layoutTmpl"/}}' ); equal( jsviews.templates( "{{for people towns}}{{:name}}{{/for}}" ).render({ people: people, towns: towns }), "JoBillSeattleParisDelhi", "concatenated targets: {{for people towns}}" ); equal( jsviews.templates( "{{for}}xxx{{/for}}" ).render({}), "", "no parameter - outputs empty string: {{for}}" ); equal( jsviews.render.simpleFor({people:[]}), "ab", 'Empty array renders empty string' ); equal( jsviews.render.simpleFor({people:["",false,null,undefined,1]}), "aContentContentContentContentContentb", 'Empty string, false, null or undefined members of array are also rendered' ); equal( jsviews.render.simpleFor({people:null}), "ab", 'null is rendered as empty string' ); equal( jsviews.render.simpleFor({}), "ab", 'undefined is rendered as empty string' ); equal( jsviews.render.forPrimitiveDataTypes({people:[0,1,"abc","",,true,false]}), "a01abctruefalseb", 'Primitive types render correctly, even if falsey' ); }); module( "api" ); test("templates", function() { expect(14); var tmpl = jsviews.templates( tmplString ); equal( tmpl.render( person ), "A_Jo_B", 'Compile from string: var tmpl = jsviews.templates( tmplString );' ); var fnToString = tmpl.fn.toString(); equal( jsviews.templates( "", tmplString ).fn.toString() === fnToString && jsviews.templates( null, tmplString ).fn.toString() === fnToString && jsviews.templates( undefined, tmplString ).fn.toString() === fnToString, true, 'if name is "", null, or undefined, then jsviews.templates( name, tmplString ) = jsviews.templates( tmplString );' ); jsviews.templates( "myTmpl", tmplString ); equal( jsviews.render.myTmpl( person ), "A_Jo_B", 'Compile and register named template: jsviews.templates( "myTmpl", tmplString );' ); jsviews.templates({ myTmpl2: tmplString, myTmpl3: "X_{{:name}}_Y" }); equal( jsviews.render.myTmpl2( person ) + jsviews.render.myTmpl3( person ), "A_Jo_BX_Jo_Y", 'Compile and register named templates: jsviews.templates({ myTmpl: tmplString, myTmpl2: tmplString2 });' ); jsviews.templates( "!'-#==", "x" ); jsviews.templates({ '&^~>"2': "y" }); equal( jsviews.render["!'-#=="]( person ) + jsviews.render['&^~>"2']( person ), "xy", 'Named templates can have arbitrary names;' ); jsviews.templates({ myTmpl4: "A_B" }); equal( jsviews.render.myTmpl4( person ), "A_B", 'jsviews.templates({ myTmpl: htmlWithNoTags });' ); jsviews.templates({ myTmpl5: { markup: tmplString } }); equal( jsviews.render.myTmpl5( person ), "A_Jo_B", 'jsviews.templates( "myTmpl", tmplObjWithMarkupString );' ); equal( jsviews.templates( "", { markup: tmplString }).render( person ), "A_Jo_B", 'Compile from template object without registering: jsviews.templates( "", tmplObjWithMarkupString );' ); jsviews.templates({ myTmpl6: { markup: tmplString } }); equal( jsviews.render.myTmpl6( person ), "A_Jo_B", 'jsviews.templates( "myTmpl", tmplObjWithMarkupString );' ); jsviews.templates( "myTmpl7", tmpl ); equal( jsviews.render.myTmpl7( person ), "A_Jo_B", 'Cloning a template: jsviews.templates( "newName", tmpl );' ); equal( jsviews.templates( "", tmpl ) === tmpl, true, 'jsviews.templates( tmpl ) returns tmpl' ); equal( jsviews.templates( "" ).render({}), "", 'jsviews.templates( "" ) is a template with empty string as content' ); jsviews.templates( "myEmptyTmpl", "" ); equal( jsviews.templates.myEmptyTmpl.render({}), "", 'jsviews.templates( "myEmptyTmpl", "" ) is a template with empty string as content' ); jsviews.templates( "myTmpl", null ); equal( jsviews.templates.myTmpl, undefined, 'Remove a named template: jsviews.templates( "myTmpl", null );' ); }); test("render", function() { expect(17); var tmpl1 = jsviews.templates( "myTmpl8", tmplString ); jsviews.templates( { simple: "Content", simpleLayout: { markup: "Content", layout: true }, primitiveDataTypes: "{{:#data}}" }); equal( tmpl1.render( person ), "A_Jo_B", 'tmpl1.render( data );' ); equal( jsviews.render.myTmpl8( person ), "A_Jo_B", 'jsviews.render.myTmpl8( data );' ); jsviews.templates( "myTmpl9", "A_{{for #data}}inner{{:name}}content{{/for}}_B" ); equal( jsviews.templates.myTmpl9.tmpls[0].render( person ), "innerJocontent", 'Access nested templates: jsviews.templates["myTmpl9[0]"];' ); jsviews.templates( "myTmpl10", "top index:{{:#index}}|{{for 1}}nested index:{{:#index}}|{{if #index===0}}nested if index:{{:#index}}|{{else}}nested else index:{{:#index}}|{{/if}}{{/for}}" ); equal( jsviews.render.myTmpl10(people), "top index:0|nested index:0|nested if index:0|top index:1|nested index:1|nested else index:1|", '#index gives the integer index even in nested blocks' ); jsviews.templates( "myTmpl11", "top index:{{:#index}}|{{for people}}nested index:{{:#index}}|{{if #index===0}}nested if index:{{:#index}}|{{else}}nested else index:{{:#index}}|{{/if}}{{/for}}" ); equal( jsviews.render.myTmpl11({ people: people }), "top index:|nested index:0|nested if index:0|nested index:1|nested else index:1|", '#index gives the integer index even in nested blocks' ); jsviews.helpers({ myKeyIsCorrect: function() { return this.parent.views[this.key] === this; }}); jsviews.templates( "myTmpl12", "top key:{{:~myKeyIsCorrect()}}|{{for people}}nested {{:~myKeyIsCorrect()}}|{{if #index===0}}nested if {{:~myKeyIsCorrect()}}|{{else}}nested else {{:~myKeyIsCorrect()}}|{{/if}}{{/for}}" ); equal( jsviews.render.myTmpl12({ people: people }), "top key:true|nested true|nested if true|nested true|nested else true|", '#key gives the key of this view in the parent views collection/object' ); equal( jsviews.templates( tmplString ).render( person ), "A_Jo_B", 'Compile from string: var html = jsviews.templates( tmplString ).render( data );' ); equal( jsviews.render.myTmpl8( people ), "A_Jo_BA_Bill_B", 'jsviews.render.myTmpl( array );' ); equal( jsviews.render.simple([]), "", 'Empty array renders empty string' ); equal( jsviews.render.simple(["",false,null,undefined,1]), "ContentContentContentContentContent", 'Empty string, false, null or undefined members of array are also rendered' ); equal( jsviews.render.simple(null), "", 'null renders as empty string' ); equal( jsviews.render.simple(), "", 'Undefined renders as empty string' ); equal( jsviews.render.simpleLayout([null,undefined,1]), "Content", 'Layout renders once, for array' ); equal( jsviews.render.simpleLayout([]), "Content", 'Layout renders once, for empty array' ); equal( jsviews.render.simpleLayout(null), "Content", 'Layout renders once, for null' ); equal( jsviews.render.simpleLayout(), "Content", 'Layout renders once, for undefined' ); equal( jsviews.render.primitiveDataTypes([0,1,"abc","",,true,false]), "01abctruefalse", 'Primitive types render correctly, even if falsey' ); }); test("converters", function() { expect(3); function loc( data ) { switch (data) { case "desktop": return "bureau"; }; } jsviews.converters({ loc2: loc }); equal(jsviews.templates( "{{loc2:#data}}:{{loc2:'desktop'}}" ).render( "desktop" ), "bureau:bureau", "jsviews.converters({ loc: locFunction })" ); var locFn = jsviews.converters("loc", loc); equal(locFn === loc && jsviews.converters.loc === loc && jsviews.converters.loc2 === loc, true, 'locFunction === jsviews.converters.loc === jsviews.converters.loc2' ); jsviews.converters({ loc2: null}); equal(jsviews.converters("loc2"), undefined, 'jsviews.converters({ loc2: null }) to remove registered converter' ); }); test("tags", function() { expect(5); equal(jsviews.templates( "{{sort people reverse=true}}{{:name}}{{/sort}}" ).render({ people: people }), "BillJo", "jsviews.tags({ sort: sortFunction })" ); equal(jsviews.templates( "{{sort people reverse=true towns}}{{:name}}{{/sort}}" ).render({ people: people, towns:towns }), "DelhiParisSeattleBillJo", "Multiple parameters in arbitrary order: {{sort people reverse=true towns}}" ); equal(jsviews.templates( "{{sort reverse=false people reverse=true towns}}{{:name}}{{/sort}}" ).render({ people: people, towns:towns }), "DelhiParisSeattleBillJo", "Duplicate named parameters - last wins: {{sort reverse=false people reverse=true towns}}" ); var sortFn = jsviews.tags("sort2", sort); equal(sortFn === sort && jsviews.tags.sort === sort && jsviews.tags.sort2 === sort, true, 'sortFunction === jsviews.tags.sort === jsviews.tags.sort2' ); jsviews.tags("sort2", null); equal(jsviews.tags("locsort2"), undefined, 'jsviews.tags( "sort2", null ) to remove registered tag' ); }); test("helpers", function() { expect(4); jsviews.helpers({ not: function( value ) { return !value; }, concat: function() { return "".concat.apply( "", arguments ) + "top"; } }) equal( jsviews.templates( "{{:~concat(a, 'b', ~not(false))}}" ).render({ a: "aVal" }), "aValbtruetop", "~concat('a')" ); function toUpperCase(value) { return value.toUpperCase(); } var toUpperCaseFn = jsviews.helpers( "toUpperCase", toUpperCase ); equal( jsviews.templates( "{{:~toUpperCase(name)}} {{:~toUpperCase('Foo')}}" ).render( person ), "JO FOO", 'jsviews.helpers( "toUpperCase", toUpperCaseFn );... {{:~toUpperCase(name)}}' ); jsviews.helpers({ toUpperCase2: toUpperCase }); equal( toUpperCaseFn === toUpperCase && jsviews.helpers.toUpperCase === toUpperCase && jsviews.helpers.toUpperCase2 === toUpperCase, true, 'sortFunction === jsviews.helpers.toUpperCase === jsviews.helpers("toUpperCase")' ); jsviews.helpers("toUpperCase2", null); equal(jsviews.helpers("toUpperCase2"), undefined, 'jsviews.helpers( "toUpperCase2", null ) to remove registered helper' ); }); test("template encapsulation", function() { expect(5); jsviews.helpers({ not: function( value ) { return !value; }, concat: function() { return "".concat.apply( "", arguments ) + "inner"; } }); jsviews.templates({ encapsulate1: { markup: "{{str:~not(true)}} {{sort people reverse=true tmpl='personTmpl'/}} {{str:~not2(false)}}", tags: { sort2: sort }, templates: { personTmpl: "{{upper:name}}" }, helpers: { not2: function( value ) { return "not2:" + !value; } }, converters: { str: function( value ) { return value.toString() + ":tostring"; }, upper: function( value ) { return value.toUpperCase(); } } } }); equal( $.trim( jsviews.render.encapsulate1({ people: people })), "false:tostring BILLJO not2:true:tostring", 'jsviews.templates( "myTmpl", tmplObjWithNestedItems);' ); jsviews.templates({ useLower: "{{lower a/}}", tmplWithNestedResources: { markup: "{{lower a/}} {{:~concat2(a, 'b', ~not2(false))}} {{for #data tmpl='nestedTmpl1'/}} {{for #data tmpl='nestedTmpl2'/}}", helpers: { not2: function( value ) { return !value; }, concat2: function() { return "".concat.apply( "", arguments ) + "%"; } }, converters: { "double": function( value ) { return "(double:" + value + "&" + value + ")"; } }, tags: { lower: function( val ) { return val.toLowerCase() } }, templates: { nestedTmpl1: "{{double:a}}", nestedTmpl2: { markup: "{{double:~upper(a)}}", helpers: { upper: function( value ) { return value.toUpperCase(); } }, converters: { "double": function( value ) { return "(override outer double:" + value + "|" + value + ")"; } } }, templateWithDebug: { markup: "{{double:~upper(a)}}", debug: true } } } }); var context = { upper: function( value ) { return "contextualUpper" + value.toUpperCase(); }, not: function( value ) { return "contextualNot" + !value; }, not2: function( value ) { return "contextualNot2" + !value; } }; equal( jsviews.render.tmplWithNestedResources({ a: "aVal" }), "aval aValbtrue% (double:aVal&aVal) (override outer double:AVAL|AVAL)", 'Access nested resources from template' ); equal( jsviews.render.useLower({ a: "aVal" }), "", 'Cannot access nested resources from a different template' ); equal( jsviews.render.tmplWithNestedResources({ a: "aVal" }, context), "aval aValbcontextualNot2true% (double:aVal&aVal) (override outer double:contextualUpperAVAL|contextualUpperAVAL)", 'Resources passed in with context override nested resources' ); equal( jsviews.templates.tmplWithNestedResources.templates.templateWithDebug.fn.toString().indexOf("debugger;") > 0, true, 'Can set debug=true on nested template' ); });
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/test/unit/jsrender-tests-no-jquery.js
JavaScript
gpl2
23,372
/*! * jQuery Templates Plugin 1.0.0pre * http://github.com/jquery/jquery-tmpl * Requires jQuery 1.4.2 * * Copyright 2011, Software Freedom Conservancy, Inc. * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license */ (function( jQuery, undefined ){ var oldManip = jQuery.fn.domManip, tmplItmAtt = "_tmplitem", htmlExpr = /^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /, newTmplItems = {}, wrappedItems = {}, appendToTmplItems, topTmplItem = { key: 0, data: {} }, itemKey = 0, cloneIndex = 0, stack = []; function newTmplItem( options, parentItem, fn, data ) { // Returns a template item data structure for a new rendered instance of a template (a 'template item'). // The content field is a hierarchical array of strings and nested items (to be // removed and replaced by nodes field of dom elements, once inserted in DOM). var newItem = { data: data || (data === 0 || data === false) ? data : (parentItem ? parentItem.data : {}), _wrap: parentItem ? parentItem._wrap : null, tmpl: null, parent: parentItem || null, nodes: [], calls: tiCalls, nest: tiNest, wrap: tiWrap, html: tiHtml, update: tiUpdate }; if ( options ) { jQuery.extend( newItem, options, { nodes: [], parent: parentItem }); } if ( fn ) { // Build the hierarchical content to be used during insertion into DOM newItem.tmpl = fn; newItem._ctnt = newItem._ctnt || newItem.tmpl( jQuery, newItem ); newItem.key = ++itemKey; // Keep track of new template item, until it is stored as jQuery Data on DOM element (stack.length ? wrappedItems : newTmplItems)[itemKey] = newItem; } return newItem; } // Override appendTo etc., in order to provide support for targeting multiple elements. (This code would disappear if integrated in jquery core). jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var ret = [], insert = jQuery( selector ), elems, i, l, tmplItems, parent = this.length === 1 && this[0].parentNode; appendToTmplItems = newTmplItems || {}; if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { insert[ original ]( this[0] ); ret = this; } else { for ( i = 0, l = insert.length; i < l; i++ ) { cloneIndex = i; elems = (i > 0 ? this.clone(true) : this).get(); jQuery( insert[i] )[ original ]( elems ); ret = ret.concat( elems ); } cloneIndex = 0; ret = this.pushStack( ret, name, insert.selector ); } tmplItems = appendToTmplItems; appendToTmplItems = null; jQuery.tmpl.complete( tmplItems ); return ret; }; }); jQuery.fn.extend({ // Use first wrapped element as template markup. // Return wrapped set of template items, obtained by rendering template against data. tmpl: function( data, options, parentItem ) { return jQuery.tmpl( this[0], data, options, parentItem ); }, // Find which rendered template item the first wrapped DOM element belongs to tmplItem: function() { return jQuery.tmplItem( this[0] ); }, // Consider the first wrapped element as a template declaration, and get the compiled template or store it as a named template. template: function( name ) { return jQuery.template( name, this[0] ); }, domManip: function( args, table, callback, options ) { if ( args[0] && jQuery.isArray( args[0] )) { var dmArgs = jQuery.makeArray( arguments ), elems = args[0], elemsLength = elems.length, i = 0, tmplItem; while ( i < elemsLength && !(tmplItem = jQuery.data( elems[i++], "tmplItem" ))) {} if ( tmplItem && cloneIndex ) { dmArgs[2] = function( fragClone ) { // Handler called by oldManip when rendered template has been inserted into DOM. jQuery.tmpl.afterManip( this, fragClone, callback ); }; } oldManip.apply( this, dmArgs ); } else { oldManip.apply( this, arguments ); } cloneIndex = 0; if ( !appendToTmplItems ) { jQuery.tmpl.complete( newTmplItems ); } return this; } }); jQuery.extend({ // Return wrapped set of template items, obtained by rendering template against data. tmpl: function( tmpl, data, options, parentItem ) { var ret, topLevel = !parentItem; if ( topLevel ) { // This is a top-level tmpl call (not from a nested template using {{tmpl}}) parentItem = topTmplItem; tmpl = jQuery.template[tmpl] || jQuery.template( null, tmpl ); wrappedItems = {}; // Any wrapped items will be rebuilt, since this is top level } else if ( !tmpl ) { // The template item is already associated with DOM - this is a refresh. // Re-evaluate rendered template for the parentItem tmpl = parentItem.tmpl; newTmplItems[parentItem.key] = parentItem; parentItem.nodes = []; if ( parentItem.wrapped ) { updateWrapped( parentItem, parentItem.wrapped ); } // Rebuild, without creating a new template item return jQuery( build( parentItem, null, parentItem.tmpl( jQuery, parentItem ) )); } if ( !tmpl ) { return []; // Could throw... } if ( typeof data === "function" ) { data = data.call( parentItem || {} ); } if ( options && options.wrapped ) { updateWrapped( options, options.wrapped ); } ret = jQuery.isArray( data ) ? jQuery.map( data, function( dataItem ) { return dataItem ? newTmplItem( options, parentItem, tmpl, dataItem ) : null; }) : [ newTmplItem( options, parentItem, tmpl, data ) ]; return topLevel ? jQuery( build( parentItem, null, ret ) ) : ret; }, // Return rendered template item for an element. tmplItem: function( elem ) { var tmplItem; if ( elem instanceof jQuery ) { elem = elem[0]; } while ( elem && elem.nodeType === 1 && !(tmplItem = jQuery.data( elem, "tmplItem" )) && (elem = elem.parentNode) ) {} return tmplItem || topTmplItem; }, // Set: // Use $.template( name, tmpl ) to cache a named template, // where tmpl is a template string, a script element or a jQuery instance wrapping a script element, etc. // Use $( "selector" ).template( name ) to provide access by name to a script block template declaration. // Get: // Use $.template( name ) to access a cached template. // Also $( selectorToScriptBlock ).template(), or $.template( null, templateString ) // will return the compiled template, without adding a name reference. // If templateString includes at least one HTML tag, $.template( templateString ) is equivalent // to $.template( null, templateString ) template: function( name, tmpl ) { if (tmpl) { // Compile template and associate with name if ( typeof tmpl === "string" ) { // This is an HTML string being passed directly in. tmpl = buildTmplFn( tmpl ); } else if ( tmpl instanceof jQuery ) { tmpl = tmpl[0] || {}; } if ( tmpl.nodeType ) { // If this is a template block, use cached copy, or generate tmpl function and cache. tmpl = jQuery.data( tmpl, "tmpl" ) || jQuery.data( tmpl, "tmpl", buildTmplFn( tmpl.innerHTML )); // Issue: In IE, if the container element is not a script block, the innerHTML will remove quotes from attribute values whenever the value does not include white space. // This means that foo="${x}" will not work if the value of x includes white space: foo="${x}" -> foo=value of x. // To correct this, include space in tag: foo="${ x }" -> foo="value of x" } return typeof name === "string" ? (jQuery.template[name] = tmpl) : tmpl; } // Return named compiled template return name ? (typeof name !== "string" ? jQuery.template( null, name ): (jQuery.template[name] || // If not in map, and not containing at least on HTML tag, treat as a selector. // (If integrated with core, use quickExpr.exec) jQuery.template( null, htmlExpr.test( name ) ? name : jQuery( name )))) : null; }, encode: function( text ) { // Do HTML encoding replacing < > & and ' and " by corresponding entities. return ("" + text).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;"); } }); jQuery.extend( jQuery.tmpl, { tag: { "tmpl": { _default: { $2: "null" }, open: "if($notnull_1){__=__.concat($item.nest($1,$2));}" // tmpl target parameter can be of type function, so use $1, not $1a (so not auto detection of functions) // This means that {{tmpl foo}} treats foo as a template (which IS a function). // Explicit parens can be used if foo is a function that returns a template: {{tmpl foo()}}. }, "wrap": { _default: { $2: "null" }, open: "$item.calls(__,$1,$2);__=[];", close: "call=$item.calls();__=call._.concat($item.wrap(call,__));" }, "each": { _default: { $2: "$index, $value" }, open: "if($notnull_1){$.each($1a,function($2){with(this){", close: "}});}" }, "if": { open: "if(($notnull_1) && $1a){", close: "}" }, "else": { _default: { $1: "true" }, open: "}else if(($notnull_1) && $1a){" }, "html": { // Unecoded expression evaluation. open: "if($notnull_1){__.push($1a);}" }, "=": { // Encoded expression evaluation. Abbreviated form is ${}. _default: { $1: "$data" }, open: "if($notnull_1){__.push($.encode($1a));}" }, "!": { // Comment tag. Skipped by parser open: "" } }, // This stub can be overridden, e.g. in jquery.tmplPlus for providing rendered events complete: function( items ) { newTmplItems = {}; }, // Call this from code which overrides domManip, or equivalent // Manage cloning/storing template items etc. afterManip: function afterManip( elem, fragClone, callback ) { // Provides cloned fragment ready for fixup prior to and after insertion into DOM var content = fragClone.nodeType === 11 ? jQuery.makeArray(fragClone.childNodes) : fragClone.nodeType === 1 ? [fragClone] : []; // Return fragment to original caller (e.g. append) for DOM insertion callback.call( elem, fragClone ); // Fragment has been inserted:- Add inserted nodes to tmplItem data structure. Replace inserted element annotations by jQuery.data. storeTmplItems( content ); cloneIndex++; } }); //========================== Private helper functions, used by code above ========================== function build( tmplItem, nested, content ) { // Convert hierarchical content into flat string array // and finally return array of fragments ready for DOM insertion var frag, ret = content ? jQuery.map( content, function( item ) { return (typeof item === "string") ? // Insert template item annotations, to be converted to jQuery.data( "tmplItem" ) when elems are inserted into DOM. (tmplItem.key ? item.replace( /(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g, "$1 " + tmplItmAtt + "=\"" + tmplItem.key + "\" $2" ) : item) : // This is a child template item. Build nested template. build( item, tmplItem, item._ctnt ); }) : // If content is not defined, insert tmplItem directly. Not a template item. May be a string, or a string array, e.g. from {{html $item.html()}}. tmplItem; if ( nested ) { return ret; } // top-level template ret = ret.join(""); // Support templates which have initial or final text nodes, or consist only of text // Also support HTML entities within the HTML markup. ret.replace( /^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/, function( all, before, middle, after) { frag = jQuery( middle ).get(); storeTmplItems( frag ); if ( before ) { frag = unencode( before ).concat(frag); } if ( after ) { frag = frag.concat(unencode( after )); } }); return frag ? frag : unencode( ret ); } function unencode( text ) { // Use createElement, since createTextNode will not render HTML entities correctly var el = document.createElement( "div" ); el.innerHTML = text; return jQuery.makeArray(el.childNodes); } // Generate a reusable function that will serve to render a template against data function buildTmplFn( markup ) { return new Function("jQuery","$item", // Use the variable __ to hold a string array while building the compiled template. (See https://github.com/jquery/jquery-tmpl/issues#issue/10). "var $=jQuery,call,__=[],$data=$item.data;" + // Introduce the data as local variables using with(){} "with($data){__.push('" + // Convert the template into pure JavaScript jQuery.trim(markup) .replace( /([\\'])/g, "\\$1" ) .replace( /[\r\t\n]/g, " " ) .replace( /\$\{([^\}]*)\}/g, "{{= $1}}" ) .replace( /\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g, function( all, slash, type, fnargs, target, parens, args ) { var tag = jQuery.tmpl.tag[ type ], def, expr, exprAutoFnDetect; if ( !tag ) { throw "Unknown template tag: " + type; } def = tag._default || []; if ( parens && !/\w$/.test(target)) { target += parens; parens = ""; } if ( target ) { target = unescape( target ); args = args ? ("," + unescape( args ) + ")") : (parens ? ")" : ""); // Support for target being things like a.toLowerCase(); // In that case don't call with template item as 'this' pointer. Just evaluate... expr = parens ? (target.indexOf(".") > -1 ? target + unescape( parens ) : ("(" + target + ").call($item" + args)) : target; exprAutoFnDetect = parens ? expr : "(typeof(" + target + ")==='function'?(" + target + ").call($item):(" + target + "))"; } else { exprAutoFnDetect = expr = def.$1 || "null"; } fnargs = unescape( fnargs ); return "');" + tag[ slash ? "close" : "open" ] .split( "$notnull_1" ).join( target ? "typeof(" + target + ")!=='undefined' && (" + target + ")!=null" : "true" ) .split( "$1a" ).join( exprAutoFnDetect ) .split( "$1" ).join( expr ) .split( "$2" ).join( fnargs || def.$2 || "" ) + "__.push('"; }) + "');}return __;" ); } function updateWrapped( options, wrapped ) { // Build the wrapped content. options._wrap = build( options, true, // Suport imperative scenario in which options.wrapped can be set to a selector or an HTML string. jQuery.isArray( wrapped ) ? wrapped : [htmlExpr.test( wrapped ) ? wrapped : jQuery( wrapped ).html()] ).join(""); } function unescape( args ) { return args ? args.replace( /\\'/g, "'").replace(/\\\\/g, "\\" ) : null; } function outerHtml( elem ) { var div = document.createElement("div"); div.appendChild( elem.cloneNode(true) ); return div.innerHTML; } // Store template items in jQuery.data(), ensuring a unique tmplItem data data structure for each rendered template instance. function storeTmplItems( content ) { var keySuffix = "_" + cloneIndex, elem, elems, newClonedItems = {}, i, l, m; for ( i = 0, l = content.length; i < l; i++ ) { if ( (elem = content[i]).nodeType !== 1 ) { continue; } elems = elem.getElementsByTagName("*"); for ( m = elems.length - 1; m >= 0; m-- ) { processItemKey( elems[m] ); } processItemKey( elem ); } function processItemKey( el ) { var pntKey, pntNode = el, pntItem, tmplItem, key; // Ensure that each rendered template inserted into the DOM has its own template item, if ( (key = el.getAttribute( tmplItmAtt ))) { while ( pntNode.parentNode && (pntNode = pntNode.parentNode).nodeType === 1 && !(pntKey = pntNode.getAttribute( tmplItmAtt ))) { } if ( pntKey !== key ) { // The next ancestor with a _tmplitem expando is on a different key than this one. // So this is a top-level element within this template item // Set pntNode to the key of the parentNode, or to 0 if pntNode.parentNode is null, or pntNode is a fragment. pntNode = pntNode.parentNode ? (pntNode.nodeType === 11 ? 0 : (pntNode.getAttribute( tmplItmAtt ) || 0)) : 0; if ( !(tmplItem = newTmplItems[key]) ) { // The item is for wrapped content, and was copied from the temporary parent wrappedItem. tmplItem = wrappedItems[key]; tmplItem = newTmplItem( tmplItem, newTmplItems[pntNode]||wrappedItems[pntNode] ); tmplItem.key = ++itemKey; newTmplItems[itemKey] = tmplItem; } if ( cloneIndex ) { cloneTmplItem( key ); } } el.removeAttribute( tmplItmAtt ); } else if ( cloneIndex && (tmplItem = jQuery.data( el, "tmplItem" )) ) { // This was a rendered element, cloned during append or appendTo etc. // TmplItem stored in jQuery data has already been cloned in cloneCopyEvent. We must replace it with a fresh cloned tmplItem. cloneTmplItem( tmplItem.key ); newTmplItems[tmplItem.key] = tmplItem; pntNode = jQuery.data( el.parentNode, "tmplItem" ); pntNode = pntNode ? pntNode.key : 0; } if ( tmplItem ) { pntItem = tmplItem; // Find the template item of the parent element. // (Using !=, not !==, since pntItem.key is number, and pntNode may be a string) while ( pntItem && pntItem.key != pntNode ) { // Add this element as a top-level node for this rendered template item, as well as for any // ancestor items between this item and the item of its parent element pntItem.nodes.push( el ); pntItem = pntItem.parent; } // Delete content built during rendering - reduce API surface area and memory use, and avoid exposing of stale data after rendering... delete tmplItem._ctnt; delete tmplItem._wrap; // Store template item as jQuery data on the element jQuery.data( el, "tmplItem", tmplItem ); } function cloneTmplItem( key ) { key = key + keySuffix; tmplItem = newClonedItems[key] = (newClonedItems[key] || newTmplItem( tmplItem, newTmplItems[tmplItem.parent.key + keySuffix] || tmplItem.parent )); } } } //---- Helper functions for template item ---- function tiCalls( content, tmpl, data, options ) { if ( !content ) { return stack.pop(); } stack.push({ _: content, tmpl: tmpl, item:this, data: data, options: options }); } function tiNest( tmpl, data, options ) { // nested template, using {{tmpl}} tag return jQuery.tmpl( jQuery.template( tmpl ), data, options, this ); } function tiWrap( call, wrapped ) { // nested template, using {{wrap}} tag var options = call.options || {}; options.wrapped = wrapped; // Apply the template, which may incorporate wrapped content, return jQuery.tmpl( jQuery.template( call.tmpl ), call.data, options, call.item ); } function tiHtml( filter, textOnly ) { var wrapped = this._wrap; return jQuery.map( jQuery( jQuery.isArray( wrapped ) ? wrapped.join("") : wrapped ).filter( filter || "*" ), function(e) { return textOnly ? e.innerText || e.textContent : e.outerHTML || outerHtml(e); }); } function tiUpdate() { var coll = this.nodes; jQuery.tmpl( null, null, null, this).insertBefore( coll[0] ); jQuery( coll ).remove(); } })( jQuery );
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/test/resources/jquery.tmpl.js
JavaScript
gpl2
19,092
// lib/handlebars/base.js var Handlebars = {}; Handlebars.VERSION = "1.0.beta.6"; Handlebars.helpers = {}; Handlebars.partials = {}; Handlebars.registerHelper = function(name, fn, inverse) { if(inverse) { fn.not = inverse; } this.helpers[name] = fn; }; Handlebars.registerPartial = function(name, str) { this.partials[name] = str; }; Handlebars.registerHelper('helperMissing', function(arg) { if(arguments.length === 2) { return undefined; } else { throw new Error("Could not find property '" + arg + "'"); } }); var toString = Object.prototype.toString, functionType = "[object Function]"; Handlebars.registerHelper('blockHelperMissing', function(context, options) { var inverse = options.inverse || function() {}, fn = options.fn; var ret = ""; var type = toString.call(context); if(type === functionType) { context = context.call(this); } if(context === true) { return fn(this); } else if(context === false || context == null) { return inverse(this); } else if(type === "[object Array]") { if(context.length > 0) { for(var i=0, j=context.length; i<j; i++) { ret = ret + fn(context[i]); } } else { ret = inverse(this); } return ret; } else { return fn(context); } }); Handlebars.registerHelper('each', function(context, options) { var fn = options.fn, inverse = options.inverse; var ret = ""; if(context && context.length > 0) { for(var i=0, j=context.length; i<j; i++) { ret = ret + fn(context[i]); } } else { ret = inverse(this); } return ret; }); Handlebars.registerHelper('if', function(context, options) { var type = toString.call(context); if(type === functionType) { context = context.call(this); } if(!context || Handlebars.Utils.isEmpty(context)) { return options.inverse(this); } else { return options.fn(this); } }); Handlebars.registerHelper('unless', function(context, options) { var fn = options.fn, inverse = options.inverse; options.fn = inverse; options.inverse = fn; return Handlebars.helpers['if'].call(this, context, options); }); Handlebars.registerHelper('with', function(context, options) { return options.fn(context); }); Handlebars.registerHelper('log', function(context) { Handlebars.log(context); }); ; // lib/handlebars/compiler/parser.js /* Jison generated parser */ var handlebars = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"root":3,"program":4,"EOF":5,"statements":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"params":25,"hash":26,"param":27,"STRING":28,"INTEGER":29,"BOOLEAN":30,"hashSegments":31,"hashSegment":32,"ID":33,"EQUALS":34,"pathSegments":35,"SEP":36,"$accept":0,"$end":1}, terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",29:"INTEGER",30:"BOOLEAN",33:"ID",34:"EQUALS",36:"SEP"}, productions_: [0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]], performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { var $0 = $$.length - 1; switch (yystate) { case 1: return $$[$0-1] break; case 2: this.$ = new yy.ProgramNode($$[$0-2], $$[$0]) break; case 3: this.$ = new yy.ProgramNode($$[$0]) break; case 4: this.$ = new yy.ProgramNode([]) break; case 5: this.$ = [$$[$0]] break; case 6: $$[$0-1].push($$[$0]); this.$ = $$[$0-1] break; case 7: this.$ = new yy.InverseNode($$[$0-2], $$[$0-1], $$[$0]) break; case 8: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0]) break; case 9: this.$ = $$[$0] break; case 10: this.$ = $$[$0] break; case 11: this.$ = new yy.ContentNode($$[$0]) break; case 12: this.$ = new yy.CommentNode($$[$0]) break; case 13: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]) break; case 14: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]) break; case 15: this.$ = $$[$0-1] break; case 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]) break; case 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true) break; case 18: this.$ = new yy.PartialNode($$[$0-1]) break; case 19: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1]) break; case 20: break; case 21: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]] break; case 22: this.$ = [[$$[$0-1]].concat($$[$0]), null] break; case 23: this.$ = [[$$[$0-1]], $$[$0]] break; case 24: this.$ = [[$$[$0]], null] break; case 25: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; break; case 26: this.$ = [$$[$0]] break; case 27: this.$ = $$[$0] break; case 28: this.$ = new yy.StringNode($$[$0]) break; case 29: this.$ = new yy.IntegerNode($$[$0]) break; case 30: this.$ = new yy.BooleanNode($$[$0]) break; case 31: this.$ = new yy.HashNode($$[$0]) break; case 32: $$[$0-1].push($$[$0]); this.$ = $$[$0-1] break; case 33: this.$ = [$$[$0]] break; case 34: this.$ = [$$[$0-2], $$[$0]] break; case 35: this.$ = [$$[$0-2], new yy.StringNode($$[$0])] break; case 36: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])] break; case 37: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])] break; case 38: this.$ = new yy.IdNode($$[$0]) break; case 39: $$[$0-2].push($$[$0]); this.$ = $$[$0-2]; break; case 40: this.$ = [$$[$0]] break; } }, table: [{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}], defaultActions: {16:[2,1],37:[2,23],53:[2,21]}, parseError: function parseError(str, hash) { throw new Error(str); }, parse: function parse(input) { var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; this.lexer.setInput(input); this.lexer.yy = this.yy; this.yy.lexer = this.lexer; if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; var yyloc = this.lexer.yylloc; lstack.push(yyloc); if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = self.lexer.lex() || 1; if (typeof token !== "number") { token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol == null) symbol = lex(); action = table[state] && table[state][symbol]; } if (typeof action === "undefined" || !action.length || !action[0]) { if (!recovering) { expected = []; for (p in table[state]) if (this.terminals_[p] && p > 2) { expected.push("'" + this.terminals_[p] + "'"); } var errStr = ""; if (this.lexer.showPosition) { errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + this.terminals_[symbol] + "'"; } else { errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); } this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); } } if (action[0] instanceof Array && action.length > 1) { throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(this.lexer.yytext); lstack.push(this.lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = this.lexer.yyleng; yytext = this.lexer.yytext; yylineno = this.lexer.yylineno; yyloc = this.lexer.yylloc; if (recovering > 0) recovering--; } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column}; r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); if (typeof r !== "undefined") { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; } };/* Jison generated lexer */ var lexer = (function(){ var lexer = ({EOF:1, parseError:function parseError(str, hash) { if (this.yy.parseError) { this.yy.parseError(str, hash); } else { throw new Error(str); } }, setInput:function (input) { this._input = input; this._more = this._less = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; return this; }, input:function () { var ch = this._input[0]; this.yytext+=ch; this.yyleng++; this.match+=ch; this.matched+=ch; var lines = ch.match(/\n/); if (lines) this.yylineno++; this._input = this._input.slice(1); return ch; }, unput:function (ch) { this._input = ch + this._input; return this; }, more:function () { this._more = true; return this; }, pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); }, showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c+"^"; }, next:function () { if (this.done) { return this.EOF; } if (!this._input) this.done = true; var token, match, col, lines; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i=0;i < rules.length; i++) { match = this._input.match(this.rules[rules[i]]); if (match) { lines = match[0].match(/\n.*/g); if (lines) this.yylineno += lines.length; this.yylloc = {first_line: this.yylloc.last_line, last_line: this.yylineno+1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length} this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; this._more = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]); if (token) return token; else return; } } if (this._input === "") { return this.EOF; } else { this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), {text: "", token: null, line: this.yylineno}); } }, lex:function lex() { var r = this.next(); if (typeof r !== 'undefined') { return r; } else { return this.lex(); } }, begin:function begin(condition) { this.conditionStack.push(condition); }, popState:function popState() { return this.conditionStack.pop(); }, _currentRules:function _currentRules() { return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; }, topState:function () { return this.conditionStack[this.conditionStack.length-2]; }, pushState:function begin(condition) { this.begin(condition); }}); lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START switch($avoiding_name_collisions) { case 0: if(yy_.yytext.slice(-1) !== "\\") this.begin("mu"); if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1), this.begin("emu"); if(yy_.yytext) return 14; break; case 1: return 14; break; case 2: this.popState(); return 14; break; case 3: return 24; break; case 4: return 16; break; case 5: return 20; break; case 6: return 19; break; case 7: return 19; break; case 8: return 23; break; case 9: return 23; break; case 10: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15; break; case 11: return 22; break; case 12: return 34; break; case 13: return 33; break; case 14: return 33; break; case 15: return 36; break; case 16: /*ignore whitespace*/ break; case 17: this.popState(); return 18; break; case 18: this.popState(); return 18; break; case 19: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 28; break; case 20: return 30; break; case 21: return 30; break; case 22: return 29; break; case 23: return 33; break; case 24: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 33; break; case 25: return 'INVALID'; break; case 26: return 5; break; } }; lexer.rules = [/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^[^\x00]{2,}?(?=(\{\{))/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[\/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s\/.])/,/^\[[^\]]*\]/,/^./,/^$/]; lexer.conditions = {"mu":{"rules":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"INITIAL":{"rules":[0,1,26],"inclusive":true}};return lexer;})() parser.lexer = lexer; return parser; })(); if (typeof require !== 'undefined' && typeof exports !== 'undefined') { exports.parser = handlebars; exports.parse = function () { return handlebars.parse.apply(handlebars, arguments); } exports.main = function commonjsMain(args) { if (!args[1]) throw new Error('Usage: '+args[0]+' FILE'); if (typeof process !== 'undefined') { var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8"); } else { var cwd = require("file").path(require("file").cwd()); var source = cwd.join(args[1]).read({charset: "utf-8"}); } return exports.parser.parse(source); } if (typeof module !== 'undefined' && require.main === module) { exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); } }; ; // lib/handlebars/compiler/base.js Handlebars.Parser = handlebars; Handlebars.parse = function(string) { Handlebars.Parser.yy = Handlebars.AST; return Handlebars.Parser.parse(string); }; Handlebars.print = function(ast) { return new Handlebars.PrintVisitor().accept(ast); }; Handlebars.logger = { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3, // override in the host environment log: function(level, str) {} }; Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); }; ; // lib/handlebars/compiler/ast.js (function() { Handlebars.AST = {}; Handlebars.AST.ProgramNode = function(statements, inverse) { this.type = "program"; this.statements = statements; if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); } }; Handlebars.AST.MustacheNode = function(params, hash, unescaped) { this.type = "mustache"; this.id = params[0]; this.params = params.slice(1); this.hash = hash; this.escaped = !unescaped; }; Handlebars.AST.PartialNode = function(id, context) { this.type = "partial"; // TODO: disallow complex IDs this.id = id; this.context = context; }; var verifyMatch = function(open, close) { if(open.original !== close.original) { throw new Handlebars.Exception(open.original + " doesn't match " + close.original); } }; Handlebars.AST.BlockNode = function(mustache, program, close) { verifyMatch(mustache.id, close); this.type = "block"; this.mustache = mustache; this.program = program; }; Handlebars.AST.InverseNode = function(mustache, program, close) { verifyMatch(mustache.id, close); this.type = "inverse"; this.mustache = mustache; this.program = program; }; Handlebars.AST.ContentNode = function(string) { this.type = "content"; this.string = string; }; Handlebars.AST.HashNode = function(pairs) { this.type = "hash"; this.pairs = pairs; }; Handlebars.AST.IdNode = function(parts) { this.type = "ID"; this.original = parts.join("."); var dig = [], depth = 0; for(var i=0,l=parts.length; i<l; i++) { var part = parts[i]; if(part === "..") { depth++; } else if(part === "." || part === "this") { this.isScoped = true; } else { dig.push(part); } } this.parts = dig; this.string = dig.join('.'); this.depth = depth; this.isSimple = (dig.length === 1) && (depth === 0); }; Handlebars.AST.StringNode = function(string) { this.type = "STRING"; this.string = string; }; Handlebars.AST.IntegerNode = function(integer) { this.type = "INTEGER"; this.integer = integer; }; Handlebars.AST.BooleanNode = function(bool) { this.type = "BOOLEAN"; this.bool = bool; }; Handlebars.AST.CommentNode = function(comment) { this.type = "comment"; this.comment = comment; }; })();; // lib/handlebars/utils.js Handlebars.Exception = function(message) { var tmp = Error.prototype.constructor.apply(this, arguments); for (var p in tmp) { if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; } } this.message = tmp.message; }; Handlebars.Exception.prototype = new Error; // Build out our basic SafeString type Handlebars.SafeString = function(string) { this.string = string; }; Handlebars.SafeString.prototype.toString = function() { return this.string.toString(); }; (function() { var escape = { "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" }; var badChars = /&(?!\w+;)|[<>"'`]/g; var possible = /[&<>"'`]/; var escapeChar = function(chr) { return escape[chr] || "&amp;"; }; Handlebars.Utils = { escapeExpression: function(string) { // don't escape SafeStrings, since they're already safe if (string instanceof Handlebars.SafeString) { return string.toString(); } else if (string == null || string === false) { return ""; } if(!possible.test(string)) { return string; } return string.replace(badChars, escapeChar); }, isEmpty: function(value) { if (typeof value === "undefined") { return true; } else if (value === null) { return true; } else if (value === false) { return true; } else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) { return true; } else { return false; } } }; })();; // lib/handlebars/compiler/compiler.js Handlebars.Compiler = function() {}; Handlebars.JavaScriptCompiler = function() {}; (function(Compiler, JavaScriptCompiler) { Compiler.OPCODE_MAP = { appendContent: 1, getContext: 2, lookupWithHelpers: 3, lookup: 4, append: 5, invokeMustache: 6, appendEscaped: 7, pushString: 8, truthyOrFallback: 9, functionOrFallback: 10, invokeProgram: 11, invokePartial: 12, push: 13, assignToHash: 15, pushStringParam: 16 }; Compiler.MULTI_PARAM_OPCODES = { appendContent: 1, getContext: 1, lookupWithHelpers: 2, lookup: 1, invokeMustache: 3, pushString: 1, truthyOrFallback: 1, functionOrFallback: 1, invokeProgram: 3, invokePartial: 1, push: 1, assignToHash: 1, pushStringParam: 1 }; Compiler.DISASSEMBLE_MAP = {}; for(var prop in Compiler.OPCODE_MAP) { var value = Compiler.OPCODE_MAP[prop]; Compiler.DISASSEMBLE_MAP[value] = prop; } Compiler.multiParamSize = function(code) { return Compiler.MULTI_PARAM_OPCODES[Compiler.DISASSEMBLE_MAP[code]]; }; Compiler.prototype = { compiler: Compiler, disassemble: function() { var opcodes = this.opcodes, opcode, nextCode; var out = [], str, name, value; for(var i=0, l=opcodes.length; i<l; i++) { opcode = opcodes[i]; if(opcode === 'DECLARE') { name = opcodes[++i]; value = opcodes[++i]; out.push("DECLARE " + name + " = " + value); } else { str = Compiler.DISASSEMBLE_MAP[opcode]; var extraParams = Compiler.multiParamSize(opcode); var codes = []; for(var j=0; j<extraParams; j++) { nextCode = opcodes[++i]; if(typeof nextCode === "string") { nextCode = "\"" + nextCode.replace("\n", "\\n") + "\""; } codes.push(nextCode); } str = str + " " + codes.join(" "); out.push(str); } } return out.join("\n"); }, guid: 0, compile: function(program, options) { this.children = []; this.depths = {list: []}; this.options = options; // These changes will propagate to the other compiler components var knownHelpers = this.options.knownHelpers; this.options.knownHelpers = { 'helperMissing': true, 'blockHelperMissing': true, 'each': true, 'if': true, 'unless': true, 'with': true, 'log': true }; if (knownHelpers) { for (var name in knownHelpers) { this.options.knownHelpers[name] = knownHelpers[name]; } } return this.program(program); }, accept: function(node) { return this[node.type](node); }, program: function(program) { var statements = program.statements, statement; this.opcodes = []; for(var i=0, l=statements.length; i<l; i++) { statement = statements[i]; this[statement.type](statement); } this.isSimple = l === 1; this.depths.list = this.depths.list.sort(function(a, b) { return a - b; }); return this; }, compileProgram: function(program) { var result = new this.compiler().compile(program, this.options); var guid = this.guid++; this.usePartial = this.usePartial || result.usePartial; this.children[guid] = result; for(var i=0, l=result.depths.list.length; i<l; i++) { depth = result.depths.list[i]; if(depth < 2) { continue; } else { this.addDepth(depth - 1); } } return guid; }, block: function(block) { var mustache = block.mustache; var depth, child, inverse, inverseGuid; var params = this.setupStackForMustache(mustache); var programGuid = this.compileProgram(block.program); if(block.program.inverse) { inverseGuid = this.compileProgram(block.program.inverse); this.declare('inverse', inverseGuid); } this.opcode('invokeProgram', programGuid, params.length, !!mustache.hash); this.declare('inverse', null); this.opcode('append'); }, inverse: function(block) { var params = this.setupStackForMustache(block.mustache); var programGuid = this.compileProgram(block.program); this.declare('inverse', programGuid); this.opcode('invokeProgram', null, params.length, !!block.mustache.hash); this.declare('inverse', null); this.opcode('append'); }, hash: function(hash) { var pairs = hash.pairs, pair, val; this.opcode('push', '{}'); for(var i=0, l=pairs.length; i<l; i++) { pair = pairs[i]; val = pair[1]; this.accept(val); this.opcode('assignToHash', pair[0]); } }, partial: function(partial) { var id = partial.id; this.usePartial = true; if(partial.context) { this.ID(partial.context); } else { this.opcode('push', 'depth0'); } this.opcode('invokePartial', id.original); this.opcode('append'); }, content: function(content) { this.opcode('appendContent', content.string); }, mustache: function(mustache) { var params = this.setupStackForMustache(mustache); this.opcode('invokeMustache', params.length, mustache.id.original, !!mustache.hash); if(mustache.escaped && !this.options.noEscape) { this.opcode('appendEscaped'); } else { this.opcode('append'); } }, ID: function(id) { this.addDepth(id.depth); this.opcode('getContext', id.depth); this.opcode('lookupWithHelpers', id.parts[0] || null, id.isScoped || false); for(var i=1, l=id.parts.length; i<l; i++) { this.opcode('lookup', id.parts[i]); } }, STRING: function(string) { this.opcode('pushString', string.string); }, INTEGER: function(integer) { this.opcode('push', integer.integer); }, BOOLEAN: function(bool) { this.opcode('push', bool.bool); }, comment: function() {}, // HELPERS pushParams: function(params) { var i = params.length, param; while(i--) { param = params[i]; if(this.options.stringParams) { if(param.depth) { this.addDepth(param.depth); } this.opcode('getContext', param.depth || 0); this.opcode('pushStringParam', param.string); } else { this[param.type](param); } } }, opcode: function(name, val1, val2, val3) { this.opcodes.push(Compiler.OPCODE_MAP[name]); if(val1 !== undefined) { this.opcodes.push(val1); } if(val2 !== undefined) { this.opcodes.push(val2); } if(val3 !== undefined) { this.opcodes.push(val3); } }, declare: function(name, value) { this.opcodes.push('DECLARE'); this.opcodes.push(name); this.opcodes.push(value); }, addDepth: function(depth) { if(depth === 0) { return; } if(!this.depths[depth]) { this.depths[depth] = true; this.depths.list.push(depth); } }, setupStackForMustache: function(mustache) { var params = mustache.params; this.pushParams(params); if(mustache.hash) { this.hash(mustache.hash); } this.ID(mustache.id); return params; } }; JavaScriptCompiler.prototype = { // PUBLIC API: You can override these methods in a subclass to provide // alternative compiled forms for name lookup and buffering semantics nameLookup: function(parent, name, type) { if (/^[0-9]+$/.test(name)) { return parent + "[" + name + "]"; } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { return parent + "." + name; } else { return parent + "['" + name + "']"; } }, appendToBuffer: function(string) { if (this.environment.isSimple) { return "return " + string + ";"; } else { return "buffer += " + string + ";"; } }, initializeBuffer: function() { return this.quotedString(""); }, namespace: "Handlebars", // END PUBLIC API compile: function(environment, options, context, asObject) { this.environment = environment; this.options = options || {}; this.name = this.environment.name; this.isChild = !!context; this.context = context || { programs: [], aliases: { self: 'this' }, registers: {list: []} }; this.preamble(); this.stackSlot = 0; this.stackVars = []; this.compileChildren(environment, options); var opcodes = environment.opcodes, opcode; this.i = 0; for(l=opcodes.length; this.i<l; this.i++) { opcode = this.nextOpcode(0); if(opcode[0] === 'DECLARE') { this.i = this.i + 2; this[opcode[1]] = opcode[2]; } else { this.i = this.i + opcode[1].length; this[opcode[0]].apply(this, opcode[1]); } } return this.createFunctionContext(asObject); }, nextOpcode: function(n) { var opcodes = this.environment.opcodes, opcode = opcodes[this.i + n], name, val; var extraParams, codes; if(opcode === 'DECLARE') { name = opcodes[this.i + 1]; val = opcodes[this.i + 2]; return ['DECLARE', name, val]; } else { name = Compiler.DISASSEMBLE_MAP[opcode]; extraParams = Compiler.multiParamSize(opcode); codes = []; for(var j=0; j<extraParams; j++) { codes.push(opcodes[this.i + j + 1 + n]); } return [name, codes]; } }, eat: function(opcode) { this.i = this.i + opcode.length; }, preamble: function() { var out = []; // this register will disambiguate helper lookup from finding a function in // a context. This is necessary for mustache compatibility, which requires // that context functions in blocks are evaluated by blockHelperMissing, and // then proceed as if the resulting value was provided to blockHelperMissing. this.useRegister('foundHelper'); if (!this.isChild) { var namespace = this.namespace; var copies = "helpers = helpers || " + namespace + ".helpers;"; if(this.environment.usePartial) { copies = copies + " partials = partials || " + namespace + ".partials;"; } out.push(copies); } else { out.push(''); } if (!this.environment.isSimple) { out.push(", buffer = " + this.initializeBuffer()); } else { out.push(""); } // track the last context pushed into place to allow skipping the // getContext opcode when it would be a noop this.lastContext = 0; this.source = out; }, createFunctionContext: function(asObject) { var locals = this.stackVars; if (!this.isChild) { locals = locals.concat(this.context.registers.list); } if(locals.length > 0) { this.source[1] = this.source[1] + ", " + locals.join(", "); } // Generate minimizer alias mappings if (!this.isChild) { var aliases = [] for (var alias in this.context.aliases) { this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; } } if (this.source[1]) { this.source[1] = "var " + this.source[1].substring(2) + ";"; } // Merge children if (!this.isChild) { this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; } if (!this.environment.isSimple) { this.source.push("return buffer;"); } var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; for(var i=0, l=this.environment.depths.list.length; i<l; i++) { params.push("depth" + this.environment.depths.list[i]); } if (asObject) { params.push(this.source.join("\n ")); return Function.apply(this, params); } else { var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + this.source.join("\n ") + '}'; Handlebars.log(Handlebars.logger.DEBUG, functionSource + "\n\n"); return functionSource; } }, appendContent: function(content) { this.source.push(this.appendToBuffer(this.quotedString(content))); }, append: function() { var local = this.popStack(); this.source.push("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }"); if (this.environment.isSimple) { this.source.push("else { " + this.appendToBuffer("''") + " }"); } }, appendEscaped: function() { var opcode = this.nextOpcode(1), extra = ""; this.context.aliases.escapeExpression = 'this.escapeExpression'; if(opcode[0] === 'appendContent') { extra = " + " + this.quotedString(opcode[1][0]); this.eat(opcode); } this.source.push(this.appendToBuffer("escapeExpression(" + this.popStack() + ")" + extra)); }, getContext: function(depth) { if(this.lastContext !== depth) { this.lastContext = depth; } }, lookupWithHelpers: function(name, isScoped) { if(name) { var topStack = this.nextStack(); this.usingKnownHelper = false; var toPush; if (!isScoped && this.options.knownHelpers[name]) { toPush = topStack + " = " + this.nameLookup('helpers', name, 'helper'); this.usingKnownHelper = true; } else if (isScoped || this.options.knownHelpersOnly) { toPush = topStack + " = " + this.nameLookup('depth' + this.lastContext, name, 'context'); } else { this.register('foundHelper', this.nameLookup('helpers', name, 'helper')); toPush = topStack + " = foundHelper || " + this.nameLookup('depth' + this.lastContext, name, 'context'); } toPush += ';'; this.source.push(toPush); } else { this.pushStack('depth' + this.lastContext); } }, lookup: function(name) { var topStack = this.topStack(); this.source.push(topStack + " = (" + topStack + " === null || " + topStack + " === undefined || " + topStack + " === false ? " + topStack + " : " + this.nameLookup(topStack, name, 'context') + ");"); }, pushStringParam: function(string) { this.pushStack('depth' + this.lastContext); this.pushString(string); }, pushString: function(string) { this.pushStack(this.quotedString(string)); }, push: function(name) { this.pushStack(name); }, invokeMustache: function(paramSize, original, hasHash) { this.populateParams(paramSize, this.quotedString(original), "{}", null, hasHash, function(nextStack, helperMissingString, id) { if (!this.usingKnownHelper) { this.context.aliases.helperMissing = 'helpers.helperMissing'; this.context.aliases.undef = 'void 0'; this.source.push("else if(" + id + "=== undef) { " + nextStack + " = helperMissing.call(" + helperMissingString + "); }"); if (nextStack !== id) { this.source.push("else { " + nextStack + " = " + id + "; }"); } } }); }, invokeProgram: function(guid, paramSize, hasHash) { var inverse = this.programExpression(this.inverse); var mainProgram = this.programExpression(guid); this.populateParams(paramSize, null, mainProgram, inverse, hasHash, function(nextStack, helperMissingString, id) { if (!this.usingKnownHelper) { this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; this.source.push("else { " + nextStack + " = blockHelperMissing.call(" + helperMissingString + "); }"); } }); }, populateParams: function(paramSize, helperId, program, inverse, hasHash, fn) { var needsRegister = hasHash || this.options.stringParams || inverse || this.options.data; var id = this.popStack(), nextStack; var params = [], param, stringParam, stringOptions; if (needsRegister) { this.register('tmp1', program); stringOptions = 'tmp1'; } else { stringOptions = '{ hash: {} }'; } if (needsRegister) { var hash = (hasHash ? this.popStack() : '{}'); this.source.push('tmp1.hash = ' + hash + ';'); } if(this.options.stringParams) { this.source.push('tmp1.contexts = [];'); } for(var i=0; i<paramSize; i++) { param = this.popStack(); params.push(param); if(this.options.stringParams) { this.source.push('tmp1.contexts.push(' + this.popStack() + ');'); } } if(inverse) { this.source.push('tmp1.fn = tmp1;'); this.source.push('tmp1.inverse = ' + inverse + ';'); } if(this.options.data) { this.source.push('tmp1.data = data;'); } params.push(stringOptions); this.populateCall(params, id, helperId || id, fn, program !== '{}'); }, populateCall: function(params, id, helperId, fn, program) { var paramString = ["depth0"].concat(params).join(", "); var helperMissingString = ["depth0"].concat(helperId).concat(params).join(", "); var nextStack = this.nextStack(); if (this.usingKnownHelper) { this.source.push(nextStack + " = " + id + ".call(" + paramString + ");"); } else { this.context.aliases.functionType = '"function"'; var condition = program ? "foundHelper && " : "" this.source.push("if(" + condition + "typeof " + id + " === functionType) { " + nextStack + " = " + id + ".call(" + paramString + "); }"); } fn.call(this, nextStack, helperMissingString, id); this.usingKnownHelper = false; }, invokePartial: function(context) { params = [this.nameLookup('partials', context, 'partial'), "'" + context + "'", this.popStack(), "helpers", "partials"]; if (this.options.data) { params.push("data"); } this.pushStack("self.invokePartial(" + params.join(", ") + ");"); }, assignToHash: function(key) { var value = this.popStack(); var hash = this.topStack(); this.source.push(hash + "['" + key + "'] = " + value + ";"); }, // HELPERS compiler: JavaScriptCompiler, compileChildren: function(environment, options) { var children = environment.children, child, compiler; for(var i=0, l=children.length; i<l; i++) { child = children[i]; compiler = new this.compiler(); this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children var index = this.context.programs.length; child.index = index; child.name = 'program' + index; this.context.programs[index] = compiler.compile(child, options, this.context); } }, programExpression: function(guid) { if(guid == null) { return "self.noop"; } var child = this.environment.children[guid], depths = child.depths.list; var programParams = [child.index, child.name, "data"]; for(var i=0, l = depths.length; i<l; i++) { depth = depths[i]; if(depth === 1) { programParams.push("depth0"); } else { programParams.push("depth" + (depth - 1)); } } if(depths.length === 0) { return "self.program(" + programParams.join(", ") + ")"; } else { programParams.shift(); return "self.programWithDepth(" + programParams.join(", ") + ")"; } }, register: function(name, val) { this.useRegister(name); this.source.push(name + " = " + val + ";"); }, useRegister: function(name) { if(!this.context.registers[name]) { this.context.registers[name] = true; this.context.registers.list.push(name); } }, pushStack: function(item) { this.source.push(this.nextStack() + " = " + item + ";"); return "stack" + this.stackSlot; }, nextStack: function() { this.stackSlot++; if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } return "stack" + this.stackSlot; }, popStack: function() { return "stack" + this.stackSlot--; }, topStack: function() { return "stack" + this.stackSlot; }, quotedString: function(str) { return '"' + str .replace(/\\/g, '\\\\') .replace(/"/g, '\\"') .replace(/\n/g, '\\n') .replace(/\r/g, '\\r') + '"'; } }; var reservedWords = ( "break else new var" + " case finally return void" + " catch for switch while" + " continue function this with" + " default if throw" + " delete in try" + " do instanceof typeof" + " abstract enum int short" + " boolean export interface static" + " byte extends long super" + " char final native synchronized" + " class float package throws" + " const goto private transient" + " debugger implements protected volatile" + " double import public let yield" ).split(" "); var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; for(var i=0, l=reservedWords.length; i<l; i++) { compilerWords[reservedWords[i]] = true; } JavaScriptCompiler.isValidJavaScriptVariableName = function(name) { if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) { return true; } return false; } })(Handlebars.Compiler, Handlebars.JavaScriptCompiler); Handlebars.precompile = function(string, options) { options = options || {}; var ast = Handlebars.parse(string); var environment = new Handlebars.Compiler().compile(ast, options); return new Handlebars.JavaScriptCompiler().compile(environment, options); }; Handlebars.compile = function(string, options) { options = options || {}; var compiled; function compile() { var ast = Handlebars.parse(string); var environment = new Handlebars.Compiler().compile(ast, options); var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true); return Handlebars.template(templateSpec); } // Template is only compiled on first use and cached after that point. return function(context, options) { if (!compiled) { compiled = compile(); } return compiled.call(this, context, options); }; }; ; // lib/handlebars/runtime.js Handlebars.VM = { template: function(templateSpec) { // Just add water var container = { escapeExpression: Handlebars.Utils.escapeExpression, invokePartial: Handlebars.VM.invokePartial, programs: [], program: function(i, fn, data) { var programWrapper = this.programs[i]; if(data) { return Handlebars.VM.program(fn, data); } else if(programWrapper) { return programWrapper; } else { programWrapper = this.programs[i] = Handlebars.VM.program(fn); return programWrapper; } }, programWithDepth: Handlebars.VM.programWithDepth, noop: Handlebars.VM.noop }; return function(context, options) { options = options || {}; return templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data); }; }, programWithDepth: function(fn, data, $depth) { var args = Array.prototype.slice.call(arguments, 2); return function(context, options) { options = options || {}; return fn.apply(this, [context, options.data || data].concat(args)); }; }, program: function(fn, data) { return function(context, options) { options = options || {}; return fn(context, options.data || data); }; }, noop: function() { return ""; }, invokePartial: function(partial, name, context, helpers, partials, data) { options = { helpers: helpers, partials: partials, data: data }; if(partial === undefined) { throw new Handlebars.Exception("The partial " + name + " could not be found"); } else if(partial instanceof Function) { return partial(context, options); } else if (!Handlebars.compile) { throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode"); } else { partials[name] = Handlebars.compile(partial); return partials[name](context, options); } } }; Handlebars.template = Handlebars.VM.template; ;
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/test/resources/handlebars.js
JavaScript
gpl2
49,698
body { padding: 10px; font-family: Verdana; font-size: small } h4 { font-size: inherit`; font-variant: small-caps; } .height { width: 100%; margin-bottom:10px; float: left; clear: both; } .bottom { height:400px; width: 100%; margin-bottom:10px; float: left; clear: both; } body > button { float: left; clear: right; margin: 3px } .subhead { margin: 15px 0 4px 0; font-weight:bolder; color:#116; font-family:Arial; font-size:10pt } a { color: #55b} .result { text-align:right; }
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/test/resources/perf-compare.css
CSS
gpl2
481
// doT.js // 2011, Laura Doktorova // https://github.com/olado/doT // // doT is a custom blend of templating functions from jQote2.js // (jQuery plugin) by aefxx (http://aefxx.com/jquery-plugins/jqote2/) // and underscore.js (http://documentcloud.github.com/underscore/) // plus extensions. // // Licensed under the MIT license. // (function() { var doT = { version : '0.1.5' }; if (typeof module !== 'undefined' && module.exports) { module.exports = doT; } else { this.doT = doT; } doT.templateSettings = { evaluate: /\{\{([\s\S]+?)\}\}/g, interpolate: /\{\{=([\s\S]+?)\}\}/g, encode: /\{\{!([\s\S]+?)\}\}/g, use: /\{\{#([\s\S]+?)\}\}/g, //compile time evaluation define: /\{\{#\s*([\w$]+)\s*\:([\s\S]+?)#\}\}/g, //compile time defs varname: 'it', strip : true, append: true }; function resolveDefs(define, use, str, defs) { return str.replace(define, function (match, code, value) { if (!(code in defs)) defs[code]=value; return ''; }) .replace(use, function(match, code) { var value; // todo: detect circular use and convert into compiled functions with(defs) {try { value = eval(code);} catch(e) { value='';} } return value ? resolveDefs(define, use, value.toString(), defs) : value; }); } doT.template = function(tmpl, c, defs) { c = c || doT.templateSettings; var cstart = c.append ? "'+(" : "';out+=(", // optimal choice depends on platform/size of templates cend = c.append ? ")+'" : ");out+='"; var str = (c.use || c.define) ? resolveDefs(c.define, c.use, tmpl, defs || {}) : tmpl; str = ("var out='" + ((c.strip) ? str.replace(/\s*<!\[CDATA\[\s*|\s*\]\]>\s*|[\r\n\t]|(\/\*[\s\S]*?\*\/)/g, ''): str) .replace(/\\/g, '\\\\') .replace(/'/g, "\\'") .replace(c.interpolate, function(match, code) { return cstart + code.replace(/\\'/g, "'").replace(/\\\\/g,"\\").replace(/[\r\t\n]/g, ' ') + cend; }) .replace(c.encode, function(match, code) { return cstart + code.replace(/\\'/g, "'").replace(/\\\\/g, "\\").replace(/[\r\t\n]/g, ' ') + ").toString().replace(/&(?!\\w+;)/g, '&#38;').split('<').join('&#60;').split('>').join('&#62;').split('" + '"' + "').join('&#34;').split(" + '"' + "'" + '"' + ").join('&#39;').split('/').join('&#x2F;'" + cend; }) .replace(c.evaluate, function(match, code) { return "';" + code.replace(/\\'/g, "'").replace(/\\\\/g,"\\").replace(/[\r\t\n]/g, ' ') + "out+='"; }) + "';return out;") .replace(/\n/g, '\\n') .replace(/\t/g, '\\t') .replace(/\r/g, '\\r') .split("out+='';").join('') .split("var out='';out+=").join('var out='); try { return new Function(c.varname, str); } catch (e) { if (typeof console !== 'undefined') console.log("Could not create a template function: " + str); throw e; } }; }());
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/test/resources/dot.js
JavaScript
gpl2
2,803
<!DOCTYPE html> <html> <head> <script src="../jsrender.js" type="text/javascript"></script> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <link href="qunit/qunit.css" rel="stylesheet" type="text/css" /> <script src="qunit/qunit.js" type="text/javascript"></script> <script src="unit/jsrender-tests-no-jquery.js" type="text/javascript"></script> </head> <body> <script id="myTmpl" type="text/x-jsrender">A_{{:name}}_B</script> <div id="result"></div> <h1 id="qunit-header">JsRender QUnit Tests</h1> <h2 id="qunit-banner"></h2> <div id="qunit-testrunner-toolbar"></div> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests"></ol> <div id="qunit-fixture">test markup, will be hidden</div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/test/unit-tests-no-jquery.html
HTML
gpl2
747
/** * QUnit v1.3.0pre - A JavaScript Unit Testing Framework * * http://docs.jquery.com/QUnit * * Copyright (c) 2011 John Resig, Jörn Zaefferer * Dual licensed under the MIT (MIT-LICENSE.txt) * or GPL (GPL-LICENSE.txt) licenses. */ /** Font Family and Sizes */ #qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; } #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } #qunit-tests { font-size: smaller; } /** Resets */ #qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult { margin: 0; padding: 0; } /** Header */ #qunit-header { padding: 0.5em 0 0.5em 1em; color: #8699a4; background-color: #0d3349; font-size: 1.5em; line-height: 1em; font-weight: normal; border-radius: 15px 15px 0 0; -moz-border-radius: 15px 15px 0 0; -webkit-border-top-right-radius: 15px; -webkit-border-top-left-radius: 15px; } #qunit-header a { text-decoration: none; color: #c2ccd1; } #qunit-header a:hover, #qunit-header a:focus { color: #fff; } #qunit-banner { height: 5px; } #qunit-testrunner-toolbar { padding: 0.5em 0 0.5em 2em; color: #5E740B; background-color: #eee; } #qunit-userAgent { padding: 0.5em 0 0.5em 2.5em; background-color: #2b81af; color: #fff; text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; } /** Tests: Pass/Fail */ #qunit-tests { list-style-position: inside; } #qunit-tests li { padding: 0.4em 0.5em 0.4em 2.5em; border-bottom: 1px solid #fff; list-style-position: inside; } #qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { display: none; } #qunit-tests li strong { cursor: pointer; } #qunit-tests li a { padding: 0.5em; color: #c2ccd1; text-decoration: none; } #qunit-tests li a:hover, #qunit-tests li a:focus { color: #000; } #qunit-tests ol { margin-top: 0.5em; padding: 0.5em; background-color: #fff; border-radius: 15px; -moz-border-radius: 15px; -webkit-border-radius: 15px; box-shadow: inset 0px 2px 13px #999; -moz-box-shadow: inset 0px 2px 13px #999; -webkit-box-shadow: inset 0px 2px 13px #999; } #qunit-tests table { border-collapse: collapse; margin-top: .2em; } #qunit-tests th { text-align: right; vertical-align: top; padding: 0 .5em 0 0; } #qunit-tests td { vertical-align: top; } #qunit-tests pre { margin: 0; white-space: pre-wrap; word-wrap: break-word; } #qunit-tests del { background-color: #e0f2be; color: #374e0c; text-decoration: none; } #qunit-tests ins { background-color: #ffcaca; color: #500; text-decoration: none; } /*** Test Counts */ #qunit-tests b.counts { color: black; } #qunit-tests b.passed { color: #5E740B; } #qunit-tests b.failed { color: #710909; } #qunit-tests li li { margin: 0.5em; padding: 0.4em 0.5em 0.4em 0.5em; background-color: #fff; border-bottom: none; list-style-position: inside; } /*** Passing Styles */ #qunit-tests li li.pass { color: #5E740B; background-color: #fff; border-left: 26px solid #C6E746; } #qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } #qunit-tests .pass .test-name { color: #366097; } #qunit-tests .pass .test-actual, #qunit-tests .pass .test-expected { color: #999999; } #qunit-banner.qunit-pass { background-color: #C6E746; } /*** Failing Styles */ #qunit-tests li li.fail { color: #710909; background-color: #fff; border-left: 26px solid #EE5757; white-space: pre; } #qunit-tests > li:last-child { border-radius: 0 0 15px 15px; -moz-border-radius: 0 0 15px 15px; -webkit-border-bottom-right-radius: 15px; -webkit-border-bottom-left-radius: 15px; } #qunit-tests .fail { color: #000000; background-color: #EE5757; } #qunit-tests .fail .test-name, #qunit-tests .fail .module-name { color: #000000; } #qunit-tests .fail .test-actual { color: #EE5757; } #qunit-tests .fail .test-expected { color: green; } #qunit-banner.qunit-fail { background-color: #EE5757; } /** Result */ #qunit-testresult { padding: 0.5em 0.5em 0.5em 2.5em; color: #2b81af; background-color: #D2E0E6; border-bottom: 1px solid white; } /** Fixture */ #qunit-fixture { position: absolute; top: -10000px; left: -10000px; }
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/test/qunit/qunit.css
CSS
gpl2
4,520
/** * QUnit v1.3.0pre - A JavaScript Unit Testing Framework * * http://docs.jquery.com/QUnit * * Copyright (c) 2011 John Resig, Jörn Zaefferer * Dual licensed under the MIT (MIT-LICENSE.txt) * or GPL (GPL-LICENSE.txt) licenses. */ (function(window) { var defined = { setTimeout: typeof window.setTimeout !== "undefined", sessionStorage: (function() { try { return !!sessionStorage.getItem; } catch(e) { return false; } })() }; var testId = 0, toString = Object.prototype.toString, hasOwn = Object.prototype.hasOwnProperty; var Test = function(name, testName, expected, testEnvironmentArg, async, callback) { this.name = name; this.testName = testName; this.expected = expected; this.testEnvironmentArg = testEnvironmentArg; this.async = async; this.callback = callback; this.assertions = []; }; Test.prototype = { init: function() { var tests = id("qunit-tests"); if (tests) { var b = document.createElement("strong"); b.innerHTML = "Running " + this.name; var li = document.createElement("li"); li.appendChild( b ); li.className = "running"; li.id = this.id = "test-output" + testId++; tests.appendChild( li ); } }, setup: function() { if (this.module != config.previousModule) { if ( config.previousModule ) { runLoggingCallbacks('moduleDone', QUnit, { name: config.previousModule, failed: config.moduleStats.bad, passed: config.moduleStats.all - config.moduleStats.bad, total: config.moduleStats.all } ); } config.previousModule = this.module; config.moduleStats = { all: 0, bad: 0 }; runLoggingCallbacks( 'moduleStart', QUnit, { name: this.module } ); } config.current = this; this.testEnvironment = extend({ setup: function() {}, teardown: function() {} }, this.moduleTestEnvironment); if (this.testEnvironmentArg) { extend(this.testEnvironment, this.testEnvironmentArg); } runLoggingCallbacks( 'testStart', QUnit, { name: this.testName, module: this.module }); // allow utility functions to access the current test environment // TODO why?? QUnit.current_testEnvironment = this.testEnvironment; try { if ( !config.pollution ) { saveGlobal(); } this.testEnvironment.setup.call(this.testEnvironment); } catch(e) { QUnit.ok( false, "Setup failed on " + this.testName + ": " + e.message ); } }, run: function() { config.current = this; if ( this.async ) { QUnit.stop(); } if ( config.notrycatch ) { this.callback.call(this.testEnvironment); return; } try { this.callback.call(this.testEnvironment); } catch(e) { fail("Test " + this.testName + " died, exception and test follows", e, this.callback); QUnit.ok( false, "Died on test #" + (this.assertions.length + 1) + ": " + e.message + " - " + QUnit.jsDump.parse(e) ); // else next test will carry the responsibility saveGlobal(); // Restart the tests if they're blocking if ( config.blocking ) { QUnit.start(); } } }, teardown: function() { config.current = this; try { this.testEnvironment.teardown.call(this.testEnvironment); checkPollution(); } catch(e) { QUnit.ok( false, "Teardown failed on " + this.testName + ": " + e.message ); } }, finish: function() { config.current = this; if ( this.expected != null && this.expected != this.assertions.length ) { QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" ); } var good = 0, bad = 0, tests = id("qunit-tests"); config.stats.all += this.assertions.length; config.moduleStats.all += this.assertions.length; if ( tests ) { var ol = document.createElement("ol"); for ( var i = 0; i < this.assertions.length; i++ ) { var assertion = this.assertions[i]; var li = document.createElement("li"); li.className = assertion.result ? "pass" : "fail"; li.innerHTML = assertion.message || (assertion.result ? "okay" : "failed"); ol.appendChild( li ); if ( assertion.result ) { good++; } else { bad++; config.stats.bad++; config.moduleStats.bad++; } } // store result when possible if ( QUnit.config.reorder && defined.sessionStorage ) { if (bad) { sessionStorage.setItem("qunit-" + this.module + "-" + this.testName, bad); } else { sessionStorage.removeItem("qunit-" + this.module + "-" + this.testName); } } if (bad == 0) { ol.style.display = "none"; } var b = document.createElement("strong"); b.innerHTML = this.name + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>"; var a = document.createElement("a"); a.innerHTML = "Rerun"; a.href = QUnit.url({ filter: getText([b]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") }); addEvent(b, "click", function() { var next = b.nextSibling.nextSibling, display = next.style.display; next.style.display = display === "none" ? "block" : "none"; }); addEvent(b, "dblclick", function(e) { var target = e && e.target ? e.target : window.event.srcElement; if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) { target = target.parentNode; } if ( window.location && target.nodeName.toLowerCase() === "strong" ) { window.location = QUnit.url({ filter: getText([target]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") }); } }); var li = id(this.id); li.className = bad ? "fail" : "pass"; li.removeChild( li.firstChild ); li.appendChild( b ); li.appendChild( a ); li.appendChild( ol ); } else { for ( var i = 0; i < this.assertions.length; i++ ) { if ( !this.assertions[i].result ) { bad++; config.stats.bad++; config.moduleStats.bad++; } } } try { QUnit.reset(); } catch(e) { fail("reset() failed, following Test " + this.testName + ", exception and reset fn follows", e, QUnit.reset); } runLoggingCallbacks( 'testDone', QUnit, { name: this.testName, module: this.module, failed: bad, passed: this.assertions.length - bad, total: this.assertions.length } ); }, queue: function() { var test = this; synchronize(function() { test.init(); }); function run() { // each of these can by async synchronize(function() { test.setup(); }); synchronize(function() { test.run(); }); synchronize(function() { test.teardown(); }); synchronize(function() { test.finish(); }); } // defer when previous test run passed, if storage is available var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-" + this.module + "-" + this.testName); if (bad) { run(); } else { synchronize(run, true); }; } }; var QUnit = { // call on start of module test to prepend name to all tests module: function(name, testEnvironment) { config.currentModule = name; config.currentModuleTestEnviroment = testEnvironment; }, asyncTest: function(testName, expected, callback) { if ( arguments.length === 2 ) { callback = expected; expected = null; } QUnit.test(testName, expected, callback, true); }, test: function(testName, expected, callback, async) { var name = '<span class="test-name">' + escapeInnerText(testName) + '</span>', testEnvironmentArg; if ( arguments.length === 2 ) { callback = expected; expected = null; } // is 2nd argument a testEnvironment? if ( expected && typeof expected === 'object') { testEnvironmentArg = expected; expected = null; } if ( config.currentModule ) { name = '<span class="module-name">' + config.currentModule + "</span>: " + name; } if ( !validTest(config.currentModule + ": " + testName) ) { return; } var test = new Test(name, testName, expected, testEnvironmentArg, async, callback); test.module = config.currentModule; test.moduleTestEnvironment = config.currentModuleTestEnviroment; test.queue(); }, /** * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. */ expect: function(asserts) { config.current.expected = asserts; }, /** * Asserts true. * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); */ ok: function(a, msg) { a = !!a; var details = { result: a, message: msg }; msg = escapeInnerText(msg); runLoggingCallbacks( 'log', QUnit, details ); config.current.assertions.push({ result: a, message: msg }); }, /** * Checks that the first two arguments are equal, with an optional message. * Prints out both actual and expected values. * * Prefered to ok( actual == expected, message ) * * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." ); * * @param Object actual * @param Object expected * @param String message (optional) */ equal: function(actual, expected, message) { QUnit.push(expected == actual, actual, expected, message); }, notEqual: function(actual, expected, message) { QUnit.push(expected != actual, actual, expected, message); }, deepEqual: function(actual, expected, message) { QUnit.push(QUnit.equiv(actual, expected), actual, expected, message); }, notDeepEqual: function(actual, expected, message) { QUnit.push(!QUnit.equiv(actual, expected), actual, expected, message); }, strictEqual: function(actual, expected, message) { QUnit.push(expected === actual, actual, expected, message); }, notStrictEqual: function(actual, expected, message) { QUnit.push(expected !== actual, actual, expected, message); }, raises: function(block, expected, message) { var actual, ok = false; if (typeof expected === 'string') { message = expected; expected = null; } try { block(); } catch (e) { actual = e; } if (actual) { // we don't want to validate thrown error if (!expected) { ok = true; // expected is a regexp } else if (QUnit.objectType(expected) === "regexp") { ok = expected.test(actual); // expected is a constructor } else if (actual instanceof expected) { ok = true; // expected is a validation function which returns true is validation passed } else if (expected.call({}, actual) === true) { ok = true; } } QUnit.ok(ok, message); }, start: function(count) { config.semaphore -= count || 1; if (config.semaphore > 0) { // don't start until equal number of stop-calls return; } if (config.semaphore < 0) { // ignore if start is called more often then stop config.semaphore = 0; } // A slight delay, to avoid any current callbacks if ( defined.setTimeout ) { window.setTimeout(function() { if (config.semaphore > 0) { return; } if ( config.timeout ) { clearTimeout(config.timeout); } config.blocking = false; process(true); }, 13); } else { config.blocking = false; process(true); } }, stop: function(count) { config.semaphore += count || 1; config.blocking = true; if ( config.testTimeout && defined.setTimeout ) { clearTimeout(config.timeout); config.timeout = window.setTimeout(function() { QUnit.ok( false, "Test timed out" ); config.semaphore = 1; QUnit.start(); }, config.testTimeout); } } }; //We want access to the constructor's prototype (function() { function F(){}; F.prototype = QUnit; QUnit = new F(); //Make F QUnit's constructor so that we can add to the prototype later QUnit.constructor = F; })(); // Backwards compatibility, deprecated QUnit.equals = QUnit.equal; QUnit.same = QUnit.deepEqual; // Maintain internal state var config = { // The queue of tests to run queue: [], // block until document ready blocking: true, // when enabled, show only failing tests // gets persisted through sessionStorage and can be changed in UI via checkbox hidepassed: false, // by default, run previously failed tests first // very useful in combination with "Hide passed tests" checked reorder: true, // by default, modify document.title when suite is done altertitle: true, urlConfig: ['noglobals', 'notrycatch'], //logging callback queues begin: [], done: [], log: [], testStart: [], testDone: [], moduleStart: [], moduleDone: [] }; // Load paramaters (function() { var location = window.location || { search: "", protocol: "file:" }, params = location.search.slice( 1 ).split( "&" ), length = params.length, urlParams = {}, current; if ( params[ 0 ] ) { for ( var i = 0; i < length; i++ ) { current = params[ i ].split( "=" ); current[ 0 ] = decodeURIComponent( current[ 0 ] ); // allow just a key to turn on a flag, e.g., test.html?noglobals current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; urlParams[ current[ 0 ] ] = current[ 1 ]; } } QUnit.urlParams = urlParams; config.filter = urlParams.filter; // Figure out if we're running the tests from a server or not QUnit.isLocal = !!(location.protocol === 'file:'); })(); // Expose the API as global variables, unless an 'exports' // object exists, in that case we assume we're in CommonJS if ( typeof exports === "undefined" || typeof require === "undefined" ) { extend(window, QUnit); window.QUnit = QUnit; } else { extend(exports, QUnit); exports.QUnit = QUnit; } // define these after exposing globals to keep them in these QUnit namespace only extend(QUnit, { config: config, // Initialize the configuration options init: function() { extend(config, { stats: { all: 0, bad: 0 }, moduleStats: { all: 0, bad: 0 }, started: +new Date, updateRate: 1000, blocking: false, autostart: true, autorun: false, filter: "", queue: [], semaphore: 0 }); var tests = id( "qunit-tests" ), banner = id( "qunit-banner" ), result = id( "qunit-testresult" ); if ( tests ) { tests.innerHTML = ""; } if ( banner ) { banner.className = ""; } if ( result ) { result.parentNode.removeChild( result ); } if ( tests ) { result = document.createElement( "p" ); result.id = "qunit-testresult"; result.className = "result"; tests.parentNode.insertBefore( result, tests ); result.innerHTML = 'Running...<br/>&nbsp;'; } }, /** * Resets the test setup. Useful for tests that modify the DOM. * * If jQuery is available, uses jQuery's html(), otherwise just innerHTML. */ reset: function() { if ( window.jQuery ) { jQuery( "#qunit-fixture" ).html( config.fixture ); } else { var main = id( 'qunit-fixture' ); if ( main ) { main.innerHTML = config.fixture; } } }, /** * Trigger an event on an element. * * @example triggerEvent( document.body, "click" ); * * @param DOMElement elem * @param String type */ triggerEvent: function( elem, type, event ) { if ( document.createEvent ) { event = document.createEvent("MouseEvents"); event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, null); elem.dispatchEvent( event ); } else if ( elem.fireEvent ) { elem.fireEvent("on"+type); } }, // Safe object type checking is: function( type, obj ) { return QUnit.objectType( obj ) == type; }, objectType: function( obj ) { if (typeof obj === "undefined") { return "undefined"; // consider: typeof null === object } if (obj === null) { return "null"; } var type = toString.call( obj ).match(/^\[object\s(.*)\]$/)[1] || ''; switch (type) { case 'Number': if (isNaN(obj)) { return "nan"; } else { return "number"; } case 'String': case 'Boolean': case 'Array': case 'Date': case 'RegExp': case 'Function': return type.toLowerCase(); } if (typeof obj === "object") { return "object"; } return undefined; }, push: function(result, actual, expected, message) { var details = { result: result, message: message, actual: actual, expected: expected }; message = escapeInnerText(message) || (result ? "okay" : "failed"); message = '<span class="test-message">' + message + "</span>"; expected = escapeInnerText(QUnit.jsDump.parse(expected)); actual = escapeInnerText(QUnit.jsDump.parse(actual)); var output = message + '<table><tr class="test-expected"><th>Expected: </th><td><pre>' + expected + '</pre></td></tr>'; if (actual != expected) { output += '<tr class="test-actual"><th>Result: </th><td><pre>' + actual + '</pre></td></tr>'; output += '<tr class="test-diff"><th>Diff: </th><td><pre>' + QUnit.diff(expected, actual) +'</pre></td></tr>'; } if (!result) { var source = sourceFromStacktrace(); if (source) { details.source = source; output += '<tr class="test-source"><th>Source: </th><td><pre>' + escapeInnerText(source) + '</pre></td></tr>'; } } output += "</table>"; runLoggingCallbacks( 'log', QUnit, details ); config.current.assertions.push({ result: !!result, message: output }); }, url: function( params ) { params = extend( extend( {}, QUnit.urlParams ), params ); var querystring = "?", key; for ( key in params ) { if ( !hasOwn.call( params, key ) ) { continue; } querystring += encodeURIComponent( key ) + "=" + encodeURIComponent( params[ key ] ) + "&"; } return window.location.pathname + querystring.slice( 0, -1 ); }, extend: extend, id: id, addEvent: addEvent }); //QUnit.constructor is set to the empty F() above so that we can add to it's prototype later //Doing this allows us to tell if the following methods have been overwritten on the actual //QUnit object, which is a deprecated way of using the callbacks. extend(QUnit.constructor.prototype, { // Logging callbacks; all receive a single argument with the listed properties // run test/logs.html for any related changes begin: registerLoggingCallback('begin'), // done: { failed, passed, total, runtime } done: registerLoggingCallback('done'), // log: { result, actual, expected, message } log: registerLoggingCallback('log'), // testStart: { name } testStart: registerLoggingCallback('testStart'), // testDone: { name, failed, passed, total } testDone: registerLoggingCallback('testDone'), // moduleStart: { name } moduleStart: registerLoggingCallback('moduleStart'), // moduleDone: { name, failed, passed, total } moduleDone: registerLoggingCallback('moduleDone') }); if ( typeof document === "undefined" || document.readyState === "complete" ) { config.autorun = true; } QUnit.load = function() { runLoggingCallbacks( 'begin', QUnit, {} ); // Initialize the config, saving the execution queue var oldconfig = extend({}, config); QUnit.init(); extend(config, oldconfig); config.blocking = false; var urlConfigHtml = '', len = config.urlConfig.length; for ( var i = 0, val; i < len, val = config.urlConfig[i]; i++ ) { config[val] = QUnit.urlParams[val]; urlConfigHtml += '<label><input name="' + val + '" type="checkbox"' + ( config[val] ? ' checked="checked"' : '' ) + '>' + val + '</label>'; } var userAgent = id("qunit-userAgent"); if ( userAgent ) { userAgent.innerHTML = navigator.userAgent; } var banner = id("qunit-header"); if ( banner ) { banner.innerHTML = '<a href="' + QUnit.url({ filter: undefined }) + '"> ' + banner.innerHTML + '</a> ' + urlConfigHtml; addEvent( banner, "change", function( event ) { var params = {}; params[ event.target.name ] = event.target.checked ? true : undefined; window.location = QUnit.url( params ); }); } var toolbar = id("qunit-testrunner-toolbar"); if ( toolbar ) { var filter = document.createElement("input"); filter.type = "checkbox"; filter.id = "qunit-filter-pass"; addEvent( filter, "click", function() { var ol = document.getElementById("qunit-tests"); if ( filter.checked ) { ol.className = ol.className + " hidepass"; } else { var tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; ol.className = tmp.replace(/ hidepass /, " "); } if ( defined.sessionStorage ) { if (filter.checked) { sessionStorage.setItem("qunit-filter-passed-tests", "true"); } else { sessionStorage.removeItem("qunit-filter-passed-tests"); } } }); if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) { filter.checked = true; var ol = document.getElementById("qunit-tests"); ol.className = ol.className + " hidepass"; } toolbar.appendChild( filter ); var label = document.createElement("label"); label.setAttribute("for", "qunit-filter-pass"); label.innerHTML = "Hide passed tests"; toolbar.appendChild( label ); } var main = id('qunit-fixture'); if ( main ) { config.fixture = main.innerHTML; } if (config.autostart) { QUnit.start(); } }; addEvent(window, "load", QUnit.load); // addEvent(window, "error") gives us a useless event object window.onerror = function( message, file, line ) { if ( QUnit.config.current ) { ok( false, message + ", " + file + ":" + line ); } else { test( "global failure", function() { ok( false, message + ", " + file + ":" + line ); }); } }; function done() { config.autorun = true; // Log the last module results if ( config.currentModule ) { runLoggingCallbacks( 'moduleDone', QUnit, { name: config.currentModule, failed: config.moduleStats.bad, passed: config.moduleStats.all - config.moduleStats.bad, total: config.moduleStats.all } ); } var banner = id("qunit-banner"), tests = id("qunit-tests"), runtime = +new Date - config.started, passed = config.stats.all - config.stats.bad, html = [ 'Tests completed in ', runtime, ' milliseconds.<br/>', '<span class="passed">', passed, '</span> tests of <span class="total">', config.stats.all, '</span> passed, <span class="failed">', config.stats.bad, '</span> failed.' ].join(''); if ( banner ) { banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass"); } if ( tests ) { id( "qunit-testresult" ).innerHTML = html; } if ( config.altertitle && typeof document !== "undefined" && document.title ) { // show ✖ for good, ✔ for bad suite result in title // use escape sequences in case file gets loaded with non-utf-8-charset document.title = [ (config.stats.bad ? "\u2716" : "\u2714"), document.title.replace(/^[\u2714\u2716] /i, "") ].join(" "); } runLoggingCallbacks( 'done', QUnit, { failed: config.stats.bad, passed: passed, total: config.stats.all, runtime: runtime } ); } function validTest( name ) { var filter = config.filter, run = false; if ( !filter ) { return true; } var not = filter.charAt( 0 ) === "!"; if ( not ) { filter = filter.slice( 1 ); } if ( name.indexOf( filter ) !== -1 ) { return !not; } if ( not ) { run = true; } return run; } // so far supports only Firefox, Chrome and Opera (buggy) // could be extended in the future to use something like https://github.com/csnover/TraceKit function sourceFromStacktrace() { try { throw new Error(); } catch ( e ) { if (e.stacktrace) { // Opera return e.stacktrace.split("\n")[6]; } else if (e.stack) { // Firefox, Chrome return e.stack.split("\n")[4]; } else if (e.sourceURL) { // Safari, PhantomJS // TODO sourceURL points at the 'throw new Error' line above, useless //return e.sourceURL + ":" + e.line; } } } function escapeInnerText(s) { if (!s) { return ""; } s = s + ""; return s.replace(/[\&<>]/g, function(s) { switch(s) { case "&": return "&amp;"; case "<": return "&lt;"; case ">": return "&gt;"; default: return s; } }); } function synchronize( callback, last ) { config.queue.push( callback ); if ( config.autorun && !config.blocking ) { process(last); } } function process( last ) { var start = new Date().getTime(); config.depth = config.depth ? config.depth + 1 : 1; while ( config.queue.length && !config.blocking ) { if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { config.queue.shift()(); } else { window.setTimeout( function(){ process( last ); }, 13 ); break; } } config.depth--; if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { done(); } } function saveGlobal() { config.pollution = []; if ( config.noglobals ) { for ( var key in window ) { if ( !hasOwn.call( window, key ) ) { continue; } config.pollution.push( key ); } } } function checkPollution( name ) { var old = config.pollution; saveGlobal(); var newGlobals = diff( config.pollution, old ); if ( newGlobals.length > 0 ) { ok( false, "Introduced global variable(s): " + newGlobals.join(", ") ); } var deletedGlobals = diff( old, config.pollution ); if ( deletedGlobals.length > 0 ) { ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") ); } } // returns a new Array with the elements that are in a but not in b function diff( a, b ) { var result = a.slice(); for ( var i = 0; i < result.length; i++ ) { for ( var j = 0; j < b.length; j++ ) { if ( result[i] === b[j] ) { result.splice(i, 1); i--; break; } } } return result; } function fail(message, exception, callback) { if ( typeof console !== "undefined" && console.error && console.warn ) { console.error(message); console.error(exception); console.error(exception.stack); console.warn(callback.toString()); } else if ( window.opera && opera.postError ) { opera.postError(message, exception, callback.toString); } } function extend(a, b) { for ( var prop in b ) { if ( b[prop] === undefined ) { delete a[prop]; // Avoid "Member not found" error in IE8 caused by setting window.constructor } else if ( prop !== "constructor" || a !== window ) { a[prop] = b[prop]; } } return a; } function addEvent(elem, type, fn) { if ( elem.addEventListener ) { elem.addEventListener( type, fn, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, fn ); } else { fn(); } } function id(name) { return !!(typeof document !== "undefined" && document && document.getElementById) && document.getElementById( name ); } function registerLoggingCallback(key){ return function(callback){ config[key].push( callback ); }; } // Supports deprecated method of completely overwriting logging callbacks function runLoggingCallbacks(key, scope, args) { //debugger; var callbacks; if ( QUnit.hasOwnProperty(key) ) { QUnit[key].call(scope, args); } else { callbacks = config[key]; for( var i = 0; i < callbacks.length; i++ ) { callbacks[i].call( scope, args ); } } } // Test for equality any JavaScript type. // Author: Philippe Rathé <prathe@gmail.com> QUnit.equiv = function () { var innerEquiv; // the real equiv function var callers = []; // stack to decide between skip/abort functions var parents = []; // stack to avoiding loops from circular referencing // Call the o related callback with the given arguments. function bindCallbacks(o, callbacks, args) { var prop = QUnit.objectType(o); if (prop) { if (QUnit.objectType(callbacks[prop]) === "function") { return callbacks[prop].apply(callbacks, args); } else { return callbacks[prop]; // or undefined } } } var getProto = Object.getPrototypeOf || function (obj) { return obj.__proto__; }; var callbacks = function () { // for string, boolean, number and null function useStrictEquality(b, a) { if (b instanceof a.constructor || a instanceof b.constructor) { // to catch short annotaion VS 'new' annotation of a // declaration // e.g. var i = 1; // var j = new Number(1); return a == b; } else { return a === b; } } return { "string" : useStrictEquality, "boolean" : useStrictEquality, "number" : useStrictEquality, "null" : useStrictEquality, "undefined" : useStrictEquality, "nan" : function(b) { return isNaN(b); }, "date" : function(b, a) { return QUnit.objectType(b) === "date" && a.valueOf() === b.valueOf(); }, "regexp" : function(b, a) { return QUnit.objectType(b) === "regexp" && a.source === b.source && // the regex itself a.global === b.global && // and its modifers // (gmi) ... a.ignoreCase === b.ignoreCase && a.multiline === b.multiline; }, // - skip when the property is a method of an instance (OOP) // - abort otherwise, // initial === would have catch identical references anyway "function" : function() { var caller = callers[callers.length - 1]; return caller !== Object && typeof caller !== "undefined"; }, "array" : function(b, a) { var i, j, loop; var len; // b could be an object literal here if (!(QUnit.objectType(b) === "array")) { return false; } len = a.length; if (len !== b.length) { // safe and faster return false; } // track reference to avoid circular references parents.push(a); for (i = 0; i < len; i++) { loop = false; for (j = 0; j < parents.length; j++) { if (parents[j] === a[i]) { loop = true;// dont rewalk array } } if (!loop && !innerEquiv(a[i], b[i])) { parents.pop(); return false; } } parents.pop(); return true; }, "object" : function(b, a) { var i, j, loop; var eq = true; // unless we can proove it var aProperties = [], bProperties = []; // collection of // strings // comparing constructors is more strict than using // instanceof if (a.constructor !== b.constructor) { // Allow objects with no prototype to be equivalent to // objects with Object as their constructor. if (!((getProto(a) === null && getProto(b) === Object.prototype) || (getProto(b) === null && getProto(a) === Object.prototype))) { return false; } } // stack constructor before traversing properties callers.push(a.constructor); // track reference to avoid circular references parents.push(a); for (i in a) { // be strict: don't ensures hasOwnProperty // and go deep loop = false; for (j = 0; j < parents.length; j++) { if (parents[j] === a[i]) loop = true; // don't go down the same path // twice } aProperties.push(i); // collect a's properties if (!loop && !innerEquiv(a[i], b[i])) { eq = false; break; } } callers.pop(); // unstack, we are done parents.pop(); for (i in b) { bProperties.push(i); // collect b's properties } // Ensures identical properties name return eq && innerEquiv(aProperties.sort(), bProperties .sort()); } }; }(); innerEquiv = function() { // can take multiple arguments var args = Array.prototype.slice.apply(arguments); if (args.length < 2) { return true; // end transition } return (function(a, b) { if (a === b) { return true; // catch the most you can } else if (a === null || b === null || typeof a === "undefined" || typeof b === "undefined" || QUnit.objectType(a) !== QUnit.objectType(b)) { return false; // don't lose time with error prone cases } else { return bindCallbacks(a, callbacks, [ b, a ]); } // apply transition with (1..n) arguments })(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length - 1)); }; return innerEquiv; }(); /** * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | * http://flesler.blogspot.com Licensed under BSD * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 * * @projectDescription Advanced and extensible data dumping for Javascript. * @version 1.0.0 * @author Ariel Flesler * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} */ QUnit.jsDump = (function() { function quote( str ) { return '"' + str.toString().replace(/"/g, '\\"') + '"'; }; function literal( o ) { return o + ''; }; function join( pre, arr, post ) { var s = jsDump.separator(), base = jsDump.indent(), inner = jsDump.indent(1); if ( arr.join ) arr = arr.join( ',' + s + inner ); if ( !arr ) return pre + post; return [ pre, inner + arr, base + post ].join(s); }; function array( arr, stack ) { var i = arr.length, ret = Array(i); this.up(); while ( i-- ) ret[i] = this.parse( arr[i] , undefined , stack); this.down(); return join( '[', ret, ']' ); }; var reName = /^function (\w+)/; var jsDump = { parse:function( obj, type, stack ) { //type is used mostly internally, you can fix a (custom)type in advance stack = stack || [ ]; var parser = this.parsers[ type || this.typeOf(obj) ]; type = typeof parser; var inStack = inArray(obj, stack); if (inStack != -1) { return 'recursion('+(inStack - stack.length)+')'; } //else if (type == 'function') { stack.push(obj); var res = parser.call( this, obj, stack ); stack.pop(); return res; } // else return (type == 'string') ? parser : this.parsers.error; }, typeOf:function( obj ) { var type; if ( obj === null ) { type = "null"; } else if (typeof obj === "undefined") { type = "undefined"; } else if (QUnit.is("RegExp", obj)) { type = "regexp"; } else if (QUnit.is("Date", obj)) { type = "date"; } else if (QUnit.is("Function", obj)) { type = "function"; } else if (typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined") { type = "window"; } else if (obj.nodeType === 9) { type = "document"; } else if (obj.nodeType) { type = "node"; } else if ( // native arrays toString.call( obj ) === "[object Array]" || // NodeList objects ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) ) { type = "array"; } else { type = typeof obj; } return type; }, separator:function() { return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? '&nbsp;' : ' '; }, indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing if ( !this.multiline ) return ''; var chr = this.indentChar; if ( this.HTML ) chr = chr.replace(/\t/g,' ').replace(/ /g,'&nbsp;'); return Array( this._depth_ + (extra||0) ).join(chr); }, up:function( a ) { this._depth_ += a || 1; }, down:function( a ) { this._depth_ -= a || 1; }, setParser:function( name, parser ) { this.parsers[name] = parser; }, // The next 3 are exposed so you can use them quote:quote, literal:literal, join:join, // _depth_: 1, // This is the list of parsers, to modify them, use jsDump.setParser parsers:{ window: '[Window]', document: '[Document]', error:'[ERROR]', //when no parser is found, shouldn't happen unknown: '[Unknown]', 'null':'null', 'undefined':'undefined', 'function':function( fn ) { var ret = 'function', name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE if ( name ) ret += ' ' + name; ret += '('; ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join(''); return join( ret, QUnit.jsDump.parse(fn,'functionCode'), '}' ); }, array: array, nodelist: array, arguments: array, object:function( map, stack ) { var ret = [ ]; QUnit.jsDump.up(); for ( var key in map ) { var val = map[key]; ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(val, undefined, stack)); } QUnit.jsDump.down(); return join( '{', ret, '}' ); }, node:function( node ) { var open = QUnit.jsDump.HTML ? '&lt;' : '<', close = QUnit.jsDump.HTML ? '&gt;' : '>'; var tag = node.nodeName.toLowerCase(), ret = open + tag; for ( var a in QUnit.jsDump.DOMAttrs ) { var val = node[QUnit.jsDump.DOMAttrs[a]]; if ( val ) ret += ' ' + a + '=' + QUnit.jsDump.parse( val, 'attribute' ); } return ret + close + open + '/' + tag + close; }, functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function var l = fn.length; if ( !l ) return ''; var args = Array(l); while ( l-- ) args[l] = String.fromCharCode(97+l);//97 is 'a' return ' ' + args.join(', ') + ' '; }, key:quote, //object calls it internally, the key part of an item in a map functionCode:'[code]', //function calls it internally, it's the content of the function attribute:quote, //node calls it internally, it's an html attribute value string:quote, date:quote, regexp:literal, //regex number:literal, 'boolean':literal }, DOMAttrs:{//attributes to dump from nodes, name=>realName id:'id', name:'name', 'class':'className' }, HTML:false,//if true, entities are escaped ( <, >, \t, space and \n ) indentChar:' ',//indentation unit multiline:true //if true, items in a collection, are separated by a \n, else just a space. }; return jsDump; })(); // from Sizzle.js function getText( elems ) { var ret = "", elem; for ( var i = 0; elems[i]; i++ ) { elem = elems[i]; // Get the text from text nodes and CDATA nodes if ( elem.nodeType === 3 || elem.nodeType === 4 ) { ret += elem.nodeValue; // Traverse everything else, except comment nodes } else if ( elem.nodeType !== 8 ) { ret += getText( elem.childNodes ); } } return ret; }; //from jquery.js function inArray( elem, array ) { if ( array.indexOf ) { return array.indexOf( elem ); } for ( var i = 0, length = array.length; i < length; i++ ) { if ( array[ i ] === elem ) { return i; } } return -1; } /* * Javascript Diff Algorithm * By John Resig (http://ejohn.org/) * Modified by Chu Alan "sprite" * * Released under the MIT license. * * More Info: * http://ejohn.org/projects/javascript-diff-algorithm/ * * Usage: QUnit.diff(expected, actual) * * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over" */ QUnit.diff = (function() { function diff(o, n) { var ns = {}; var os = {}; for (var i = 0; i < n.length; i++) { if (ns[n[i]] == null) ns[n[i]] = { rows: [], o: null }; ns[n[i]].rows.push(i); } for (var i = 0; i < o.length; i++) { if (os[o[i]] == null) os[o[i]] = { rows: [], n: null }; os[o[i]].rows.push(i); } for (var i in ns) { if ( !hasOwn.call( ns, i ) ) { continue; } if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) { n[ns[i].rows[0]] = { text: n[ns[i].rows[0]], row: os[i].rows[0] }; o[os[i].rows[0]] = { text: o[os[i].rows[0]], row: ns[i].rows[0] }; } } for (var i = 0; i < n.length - 1; i++) { if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null && n[i + 1] == o[n[i].row + 1]) { n[i + 1] = { text: n[i + 1], row: n[i].row + 1 }; o[n[i].row + 1] = { text: o[n[i].row + 1], row: i + 1 }; } } for (var i = n.length - 1; i > 0; i--) { if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null && n[i - 1] == o[n[i].row - 1]) { n[i - 1] = { text: n[i - 1], row: n[i].row - 1 }; o[n[i].row - 1] = { text: o[n[i].row - 1], row: i - 1 }; } } return { o: o, n: n }; } return function(o, n) { o = o.replace(/\s+$/, ''); n = n.replace(/\s+$/, ''); var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/)); var str = ""; var oSpace = o.match(/\s+/g); if (oSpace == null) { oSpace = [" "]; } else { oSpace.push(" "); } var nSpace = n.match(/\s+/g); if (nSpace == null) { nSpace = [" "]; } else { nSpace.push(" "); } if (out.n.length == 0) { for (var i = 0; i < out.o.length; i++) { str += '<del>' + out.o[i] + oSpace[i] + "</del>"; } } else { if (out.n[0].text == null) { for (n = 0; n < out.o.length && out.o[n].text == null; n++) { str += '<del>' + out.o[n] + oSpace[n] + "</del>"; } } for (var i = 0; i < out.n.length; i++) { if (out.n[i].text == null) { str += '<ins>' + out.n[i] + nSpace[i] + "</ins>"; } else { var pre = ""; for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++) { pre += '<del>' + out.o[n] + oSpace[n] + "</del>"; } str += " " + out.n[i].text + nSpace[i] + pre; } } } return str; }; })(); })(this);
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/test/qunit/qunit.js
JavaScript
gpl2
41,078
<!DOCTYPE html PUBLIC> <html> <head> <title>Benchmark JsRender</title> <link href="resources/perf-compare.css" rel="stylesheet" type="text/css" /> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../jsrender.js" type="text/javascript"></script> <script src="resources/jquery.tmpl.js" type="text/javascript"></script> <script src="resources/handlebars.js" type="text/javascript"></script> <script src="resources/dot.js" type="text/javascript"></script> </head> <body> <h3>Perf comparison</h3> <em>Rendered content:</em><br /><br /> <table><tbody id="output"></tbody></table> <br /><em>Times in milliseconds:</em> <table><tbody id="results"></tbody></table> <script type="text/javascript"> var times = 250, ret, tmplString, htmlSample, tests = [], movie = { Name: "The <i>Red</i> Violin", ReleaseYear: "1998" }, jqueryTmplTemplate = "<div><b>{{html Name}}</b> ({{html ReleaseYear}})<b>{{html Name}}</b> ({{html ReleaseYear}})<b>{{html Name}}</b> ({{html ReleaseYear}})<b>{{html Name}}</b> ({{html ReleaseYear}})</div>", jqueryTmplTemplateEncode = "<div><b>${Name}</b> (${ReleaseYear})<b>${Name}</b> (${ReleaseYear})<b>${Name}</b> (${ReleaseYear})<b>${Name}</b> (${ReleaseYear})</div>", jsRenderTemplate = "<div><b>{{:Name}}</b> ({{:ReleaseYear}})<b>{{:Name}}</b> ({{:ReleaseYear}})<b>{{:Name}}</b> ({{:ReleaseYear}})<b>{{:Name}}</b> ({{:ReleaseYear}})</div>", jsRenderTemplateEncode = "<div><b>{{>Name}}</b> ({{>ReleaseYear}})<b>{{>Name}}</b> ({{>ReleaseYear}})<b>{{>Name}}</b> ({{>ReleaseYear}})<b>{{>Name}}</b> ({{>ReleaseYear}})</div>", dotTemplate = "<div><b>{{=it.Name}}</b> ({{=it.ReleaseYear}})<b>{{=it.Name}}</b> ({{=it.ReleaseYear}})<b>{{=it.Name}}</b> ({{=it.ReleaseYear}})<b>{{=it.Name}}</b> ({{=it.ReleaseYear}})</div>", dotTemplateEncode = "<div><b>{{!it.Name}}</b> ({{!it.ReleaseYear}})<b>{{!it.Name}}</b> ({{!it.ReleaseYear}})<b>{{!it.Name}}</b> ({{!it.ReleaseYear}})<b>{{!it.Name}}</b> ({{!it.ReleaseYear}})</div>", handlebarsTemplate = "<div><b>{{{Name}}}</b> ({{{ReleaseYear}}})<b>{{{Name}}}</b> ({{{ReleaseYear}}})<b>{{{Name}}}</b> ({{{ReleaseYear}}})<b>{{{Name}}}</b> ({{{ReleaseYear}}})</div>", handlebarsTemplateEncode = "<div><b>{{Name}}</b> ({{ReleaseYear}})<b>{{Name}}</b> ({{ReleaseYear}})<b>{{Name}}</b> ({{ReleaseYear}})<b>{{Name}}</b> ({{ReleaseYear}})</div>", tmpl_doT = doT.template( dotTemplate ), tmpl_doTEncode = doT.template( dotTemplateEncode ), tmpl_jQueryTmpl = $.template( null, jqueryTmplTemplate ), tmpl_JsRender = $.templates( null, jsRenderTemplate ), tmpl_jQueryTmplEncode = $.template( null, jqueryTmplTemplateEncode ), tmpl_JsRenderEncode = $.templates( null, jsRenderTemplateEncode ), tmpl_handlebars = Handlebars.compile( handlebarsTemplate ), tmpl_handlebarsEncode = Handlebars.compile( handlebarsTemplateEncode ); // For Handlebars, make initial rendering call to do first compilation. htmlSample = tmpl_handlebars( movie ); tmpl_handlebarsEncode( movie); $( "#output" ).html( htmlSample ); function test( label, times, places, cb ) { var target = $( "<tr><td>" + label + ": </td></tr>" ).appendTo( "#results" ); tests.push( function() { var endTime, result, count = times, startTime = new Date().getTime(); while (count--) { cb(); } endTime = new Date().getTime(); result = ((( endTime-startTime ) * 1000 ) / times); target.append( "<td class='result'>" + result.toFixed( places ) + "</td>"); runNextTest(); }); } function runNextTest() { var next; if (next = tests.shift()) { setTimeout( next, 0 ); } else { $( "#results" ).append( "<tr><td colspan='2'><em>Tests complete...</em></td></tr>" ); } } // Test render to string perf $( "#results" ).append( "<tr><td colspan='2'>________________________________________________________</td></tr>" ); $( "#results" ).append( "<tr><td colspan='2'><b>Optimized render to string</b></td></tr>"); test( "jQuery Template", times * 500, 1, function() { ret = tmpl_jQueryTmpl($, { data: movie }).join(""); }); test( "doT", times * 500, 1, function() { ret = tmpl_doT(movie); }); test( "Handlebars", times * 500, 1, function() { ret = tmpl_handlebars(movie); }); test( "JsRender <em>(optimized .fn() method - for simple templates)</em>", times * 500, 1, function() { ret = tmpl_JsRender.fn( movie ); }); test( "JsRender <em>(.render() method - full view-hierarchy features)</em>", times * 500, 1, function() { ret = tmpl_JsRender.render( movie ); }); // Test html encoding perf $( "#results" ).append( "<tr><td colspan='2'>________________________________________________________</td></tr>" ); $( "#results" ).append( "<tr><td colspan='2'><b>Render to string, with HTML encoding</b></td></tr>"); test( "jQuery Template", times * 50, 1, function() { ret = tmpl_jQueryTmplEncode($, { data: movie }).join(""); }); test( "doT", times * 50, 1, function() { ret = tmpl_doTEncode( movie ); }); test( "Handlebars", times * 50, 1, function() { ret = tmpl_handlebarsEncode( movie ); }); test( "JsRender <em>(optimized .fn() method)</em>", times * 50, 1, function() { ret = tmpl_JsRenderEncode.fn( movie ); }); // Test full features perf $( "#results" ).append( "<tr><td colspan='2'>________________________________________________________</td></tr>" ); $( "#results" ).append( "<tr><td colspan='2'><b>Full features - view hierarchy etc.</b></td></tr>"); test( "jQuery Template full features - inserted in DOM", times * 5, 0, function() { $( "#output" ).empty(); $.tmpl( tmpl_jQueryTmpl, movie ).appendTo( "#output" ); }); test( "JsRender full features - inserted in DOM", times * 5, 0, function() { $( "#output" ).html( tmpl_JsRender.render( movie )); }); // Test compile perf $( "#results" ).append( "<tr><td colspan='2'>________________________________________________________</td></tr>" ); $( "#results" ).append( "<tr><td colspan='2'><b>Compile</b></td></tr>"); test( "jQuery Template compile", times * 5, 0, function() { tmpl_jQueryTmpl = $.template( jqueryTmplTemplate ); }); test( "doT compile", times * 5, 0, function() { tmpl_doT = doT.template( dotTemplate ); }); test( "Handlebars compile", times * 5, 0, function() { var tmpl = Handlebars.compile( handlebarsTemplateEncode ); // For Handlebars, make initial rendering call to do first compilation. tmpl( movie ); }); test( "JsRender compile", times * 5, 0, function() { tmpl_JsRender = $.templates( "test", jsRenderTemplate ); }); $( "#results" ).append( "<tr><td colspan='2'>________________________________________________________</td></tr>" ); runNextTest(); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/test/perf-compare.html
HTML
gpl2
6,683
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <link href="qunit/qunit.css" rel="stylesheet" type="text/css" /> <script src="qunit/qunit.js" type="text/javascript"></script> <script src="../jsrender.js" type="text/javascript"></script> <script src="unit/jsrender-tests-with-jquery.js" type="text/javascript"></script> </head> <body> <script id="myTmpl" type="text/x-jsrender">A_{{:name}}_B</script> <div id="result"></div> <h1 id="qunit-header">JsRender QUnit Tests</h1> <h2 id="qunit-banner"></h2> <div id="qunit-testrunner-toolbar"></div> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests"></ol> <div id="qunit-fixture">test markup, will be hidden</div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/test/unit-tests-with-jquery.html
HTML
gpl2
749
<!DOCTYPE html> <html> <head> <title>JsRender: Demos</title> <link href="resources/demos.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="subhead"><< <a href="index.html">Index for JsRender and JsViews</a></div> <h2>JsRender: Demos</h2> <h3>JsRender - step-by-step samples</h3> <ul class="indexitems"> <li><a href="step-by-step/01_inserting-data.html">Inserting data values</a></li> <li><a href="step-by-step/02_compiling-templates-from-strings.html">Compiling templates from strings</a></li> <li><a href="step-by-step/03_no-encoding.html">{{: }} and {{> }}</a></li> <li><a href="step-by-step/04_if-else-tag.html">{{if}} and {{else}}</a></li> <li><a href="step-by-step/05_for-tag.html">{{for}}</a></li> <li><a href="step-by-step/06_template-composition.html">Template composition</a></li> <li><a href="step-by-step/07_paths.html">Accessing paths</a></li> <li><a href="step-by-step/08_custom-tags.html">Custom tags</a></li> <li><a href="step-by-step/09_helper-functions.html">'Helper' functions</a></li> <li><a href="step-by-step/10_comparison-tests.html">Comparison tests</a></li> <li><a href="step-by-step/11_layout-templates.html">Layout templates</a></li> <li><a href="step-by-step/20_without-jquery.html">JsRender without jQuery</a></li> </ul> <h3>JsRender - scenario examples</h3> <ul class="indexitems"> <li><a href="scenarios/01_default-values-scenario.html">'Default values' scenario</a></li> <li><a href="scenarios/02_separators-scenario.html">'Separators' scenario</a></li> <li><a href="scenarios/03_iterating-through-fields-scenario.html">'Iterating through fields' scenario</a></li> <li><a href="scenarios/04_assigning-variables-scenario.html">'Assigning variables' scenario</a></li> </ul> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/demos.html
HTML
gpl2
1,762
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Example Scenario: Creating custom helpers to iterate through fields</h3> <!---------------------- First Example ----------------------> <div class="subhead">Using a custom {{fields}} tag:</div> <pre> {{fields details}} &lt;b>{{:~key}}&lt;/b>: {{:#data}} {{/fields}} </pre> <table> <thead><tr><th>Title</th><th>Details</th></tr></thead> <tbody id="movieList1"></tbody> </table> <!---------------------- Second Example ----------------------> <div class="subhead">Using a custom ~getFields() helper function:</div> <pre> {{for ~getFields(details)}} &lt;b>{{:key}}&lt;/b>: {{:value}} {{/for}} </pre> <table> <thead><tr><th>Title</th><th>Details</th></tr></thead> <tbody id="movieList2"></tbody> </table> <!--=================== Demo ===================--> <!------------------ Templates ------------------> <script id="movieTemplate1" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{fields details}} <div> <b>{{:~key}}</b>: {{:#data}} </div> {{/fields}} </td> </tr> </script> <script id="movieTemplate2" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{for ~getFields(details)}} <div> <b>{{:key}}</b>: {{:value}} </div> {{/for}} </td> </tr> </script> <!------------------ Script ------------------> <script type="text/javascript"> $.views.tags({ fields: function( object ) { var key, ret = ""; for ( key in object ) { if ( object.hasOwnProperty( key )) { // For each property/field, render the content of the {{fields object}} tag, with "~key" as template parameter ret += this.renderContent( object[ key ], { key: key }); } } return ret; } }); //Define a custom getFields helper function to iterate over fields and return $.views.helpers({ getFields: function( object ) { var key, value, fieldsArray = []; for ( key in object ) { if ( object.hasOwnProperty( key )) { value = object[ key ]; // For each property/field add an object to the array, with key and value fieldsArray.push({ key: key, value: value }); } } // Return the array, to be rendered using {{for ~fields(object)}} return fieldsArray; } }); var movies = [ { title: "Meet Joe Black", details: { director: "John", date: "1996", language: "English" } }, { title: "Eyes Wide Shut", details: { type: "Comedy", date: "1940" } } ]; $( "#movieList1" ).html( $( "#movieTemplate1" ).render( movies ) ); $( "#movieList2" ).html( $( "#movieTemplate2" ).render( movies ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/scenarios/03_iterating-through-fields-scenario.html
HTML
gpl2
3,015
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Example Scenario: Custom tag and helper for assigning/getting local variables.</h3> <div class="box label"> <b>Note:</b> This scenario implies understanding the processing sequence of template rendering, <br />and is somewhat in contradiction with the 'logicless' and declarative philosophy. <br />However it illustrates the power of the custom tags and helper function extensibility, <br />and is useful in certain advanced scenarios. </div> <div class="subhead">Declare <em>setvar</em> custom tag and <em>getvar</em> custom helper function</div> <pre> var vars = {}; $.views.tags({ setvar: function(key, value) { ... vars[key] = value; ... } }); $.views.helpers({ getvar: function(key) { return vars[key]; } }) </pre> <div class="subhead">Use <em>{{setvar}}</em> to assign values or rendered content to variable</div> <pre> {{setvar "summary" languages/}} </pre> <pre> {{setvar "summary"}} &lt;b>Subtitles only:&lt;/b> {{:subtitles}} {{/setvar}} </pre> <div class="subhead">Use <em>{{:~getvar}}</em> to take values stored in the variable, and render them elsewhere in the template</div> <pre> {{:~getvar('summary')}} </pre> <script id="movieTemplate" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{if languages}} {{setvar "summary" languages/}} Alternative languages: <em>{{:languages}}</em>. {{else}} {{setvar "summary"}} <b>Subtitles only:</b> {{:subtitles}} {{/setvar}} Subtitles only. See summary column: {{/if}} </td> <td> <em>{{:title}}:</em><br/> {{:~getvar('summary')}} </td> </tr> </script> <table> <thead><tr><th>title</th><th>languages</th><th>summary</th></tr></thead> <tbody id="movieList"></tbody> </table> <script type="text/javascript"> var movies = [ { title: "Meet Joe Black", languages: "English and French" }, { title: "Eyes Wide Shut", subtitles: "French and Spanish" }, { title: "City Hunter", languages: "Mandarin and Chinese" } ]; (function() { var vars = {}; $.views.tags({ setvar: function(key, value) { if (value) { vars[key] = value; } else { vars[key] = this.renderContent(this.view); } } }); $.views.helpers({ getvar: function(key) { return vars[key]; } }) })(); $( "#movieList" ).html( $( "#movieTemplate" ).render( movies ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/scenarios/04_assigning-variables-scenario.html
HTML
gpl2
2,817
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> <style> pre { font-size:10pt; font-weight:bold; } </style> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Example Scenario: providing default values for data.</h3> <!---------------------- First Example ----------------------> <div class="subhead">The simplest (and best) way: Javascript expression '||':</div> <pre> {{:languages||'Languages unavailable'}} </pre> <table> <thead><tr><th>Title</th><th>{{:path}}</th></tr></thead> <tbody id="movieList1"></tbody> </table> <!---------------------- Second Example ----------------------> <div class="subhead">Creating a special custom tag:</div> <pre> {{get languages defaultValue="No languages!"/}} $.views.tags({ get: function( value ){ return value || this.props.defaultValue; } }); </pre> <table> <thead><tr><th>Title</th><th>{{get path default="..."}}</th></tr></thead> <tbody id="movieList2"></tbody> </table> <!---------------------- Third Example ----------------------> <div class="subhead">Creating a multi-purpose utility tag:</div> <pre> {{yesNo languages yes="Alternate languages available:" no="No alternate languages"/}} $.views.tags({ yesNo: function( value ){ return value ? this.props.yes : this.props.no; } }); </pre> <table> <thead><tr><th>Title</th><th>{{yesNo path yes="..." no="..."}}</th></tr></thead> <tbody id="movieList3"></tbody> </table> <!--=================== Demo ===================--> <!------------------ Templates ------------------> <script id="movieTemplate1" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{:languages||'Languages unavailable'}} </td> </tr> </script> <script id="movieTemplate2" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{get languages defaultValue="No languages!"/}} </td> </tr> </script> <script id="movieTemplate3" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{yesNo languages yes="Alternate languages available:" no="No alternate languages"/}} <em>{{:languages}}</em> </td> </tr> </script> <!------------------ Script ------------------> <script type="text/javascript"> $.views.tags({ get: function( value ){ return value || this.props.defaultValue; }, yesNo: function( value ){ return value ? this.props.yes : this.props.no; } }); var movies = [ { title: "Meet Joe Black", languages: "English and French" }, { title: "Eyes Wide Shut" }, { title: "The Mighty" }, { title: "City Hunter", languages: "Mandarin and Chinese" } ]; $( "#movieList1" ).html( $( "#movieTemplate1" ).render( movies ) ); $( "#movieList2" ).html( $( "#movieTemplate2" ).render( movies ) ); $( "#movieList3" ).html( $( "#movieTemplate3" ).render( movies ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/scenarios/01_default-values-scenario.html
HTML
gpl2
3,114
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Example Scenario: Inserting "and" and "," separators between words</h3> <!---------------------- First Example ----------------------> <div class="subhead">Example 1: Expressions in tags, and template parameters:</div> <pre> {{for languages ~count=languages.length}} ... {{if #index === ~count-2}} and {{else #index < ~count-2}}, {{/if}} ... {{/for}} </pre> <script id="movieTemplate1" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{for languages ~count=languages.length}} {{:name}}{{if #index === ~count-2}} and {{else #index < ~count-2}}, {{/if}} {{/for}} </td> </tr> </script> <table> <thead><tr><th>Title</th><th>Languages</th></tr></thead> <tbody id="movieList1"></tbody> </table> <!---------------------- Second Example ----------------------> <div class="subhead">Example 2: Custom helper functions:</div> <pre> {{for languages}} ... {{if ~nextToLast()}} and {{else ~notLast()}}, {{/if}} ... {{/for}} </pre> <script id="movieTemplate2" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{for languages}} {{:name}}{{if ~nextToLast()}} and {{else ~notLast()}}, {{/if}} {{/for}} </td> </tr> </script> <table> <thead><tr><th>Title</th><th>Languages</th></tr></thead> <tbody id="movieList2"></tbody> </table> <br /> <!---------------------- Third Example ----------------------> <h3>Using "allowCode"</h3> <div class="box label"> <b>Note:</b> The allowCode feature is powerful, but leads to poor separation of concerns, and poor maintainability. <br />It is therefore only available as an opt-in feature on a per template basis. <br /><br />The following two examples illustrate its use, but are not the recommended approach. The built-in expression support, <br />custom tags, helper functions etc. provide a better solution for almost all scenarios, as in the two examples above.</div> <div class="subhead">Example 3: allowCode, for program flow:</div> <pre> $.templates( "movieTmpl", { markup: "#movieTemplate", allowCode: true }); {{* if ( myexpression ) { }} ... {{* } }} </pre> <script id="movieTemplate3" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{for languages}} {{:name}}{{* if ( view.index === view.parent.data.length - 2 ) { }} and {{* } else if ( view.index < view.parent.data.length - 2 ) { }}, {{* } }} {{/for}} </td> </tr> </script> <table> <thead><tr><th>Title</th><th>Languages</th></tr></thead> <tbody id="movieList3"></tbody> </table> <!---------------------- Fourth Example ----------------------> <div class="subhead">Example 4: allowCode, for returning content:</div> <pre> $.templates( "movieTmpl", { markup: "#movieTemplate", allowCode: true }); {{* if ( myexpression ) { ret += ...; ... } }} </pre> <script id="movieTemplate4" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{for languages}} {{:name}}{{* if ( view.index === view.parent.data.length - 2 ) { ret += " and"; } else if ( view.index < view.parent.data.length - 2 ) { ret+= ","; } }} {{/for}} </td> </tr> </script> <table> <thead><tr><th>Title</th><th>Languages</th></tr></thead> <tbody id="movieList4"></tbody> </table> <script type="text/javascript"> $.views.helpers({ nextToLast: function() { var view = this; return view.index === view.parent.data.length - 2; }, notLast: function() { var view = this; return view.index !== view.parent.data.length - 1; } }); var movies = [ { title: "Meet Joe Black", languages: [ { name: "English" }, { name: "French" } ], subtitles: [ { name: "English" }, { name: "French" }, { name: "Chinese" } ] }, { title: "Eyes Wide Shut", languages: [ { name: "French" }, { name: "German" }, { name: "Spanish" } ], subtitles: [ { name: "English" } ] } ]; $.templates({ movieTmpl1: "#movieTemplate1", movieTmpl2: "#movieTemplate2", movieTmpl3: { markup: "#movieTemplate3", allowCode: true }, movieTmpl4: { markup: "#movieTemplate4", allowCode: true } }); $( "#movieList1" ).html( $.render.movieTmpl1( movies ) ); $( "#movieList2" ).html( $.render.movieTmpl2( movies ) ); $( "#movieList3" ).html( $.render.movieTmpl3( movies ) ); $( "#movieList4" ).html( $.render.movieTmpl4( movies ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/scenarios/02_separators-scenario.html
HTML
gpl2
4,890
table { border-collapse: collapse; } table tr { color: blue; height: 25px; } thead tr { color: #009; border-bottom: solid #77c 2px; background-color: #E8E8F7; } thead th { padding:5px; border: 1px solid #77c; } #movieList tr td:first-child { width: 130px; } table { border: 2px solid blue; width: 520px; margin: 4px 0 24px 4px; padding: 2px; background-color: #f8f8f8; } table td { padding: 3px; margin: 3px; border: solid #77c 1px; }
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/resources/movielist.css
CSS
gpl2
438
body { padding: 10px; font-family: Verdana; font-size: small } h4 { font-size: inherit`; font-variant: small-caps; } .height { width: 100%; margin-bottom:10px; float: left; clear: both; } .bottom { height:400px; width: 100%; margin-bottom:10px; float: left; clear: both; } body > button { float: left; clear: right; margin: 3px } .subhead { margin: 3px 0 5px 0; font-weight:bolder; color:#116; font-family:Arial; font-size:10pt } a { color: #55b; } pre { font-size:10pt; font-weight:bold; } .inset { padding-left: 18px; } .box { border: 1px solid #777; padding: 5px; margin: 5px 0 30px; } .box div { margin: 3px 0 10px 0; } .box .label { margin: 0; padding: 10px 0 0 0; font-style:italic; color: #55b; } .box.label { font-style:italic; color: #55b; } .desc { font-style:italic; margin: 0 0 15px; color:#116; } pre { border-left: 3px solid #aaa; padding:10px; margin-bottom: 30px; } .indexitems { list-style-type:none; padding-left:10px; margin: 0 0 20px;} h3 { margin-bottom: 10px; font-size: 11pt;}
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/resources/demos.css
CSS
gpl2
1,004
<!DOCTYPE html> <html> <head> <title>JsRender: Demos</title> <link href="resources/demos.css" rel="stylesheet" type="text/css" /> </head> <body> <h2>JsRender: Next-generation jQuery Templates</h2> <div class="subhead"><em>JsRender</em>:</div> <div class="box"> <div class="desc">JsRender templates are optimized for high-performance pure string-based rendering, without DOM or jQuery dependency</div> <div class="subhead"><b><a href="demos.html">JsRender: Demos</a></b></div> <div class="label">Source code:</div> <div><a href="https://github.com/BorisMoore/jsrender">https://github.com/BorisMoore/jsrender</a></div> </div> <div class="subhead"><em>Tests</em>:</div> <div class="box"> <div class="subhead"><b><a href="../test/unit-tests-with-jquery.html">JsRender unit tests - with jQuery</a></b></div> <div class="subhead"><b><a href="../test/unit-tests-no-jquery.html">JsRender unit tests - without jQuery</a></b></div> <div><a href="../test/perf-compare.html">Perf comparison</a></div> </div> <div class="subhead">See also on <em>JsViews</em> site:</div> <div class="box"> <div class="desc">JsViews are interactive data-driven views, built on top of JsRender templates</div> <div class="subhead"><b><a href="http://borismoore.github.com/jsviews/demos/index.html">JsViews: Demos</a></b></div> <div class="label">JsViews and JsRender Overview:</div> <div class="subhead"><b><a href="http://borismoore.github.com/jsviews/demos/jQueryConfDemosOct2011/index.html" >Demo sequence from jQuery Conference October 2011</a></b></div> </div> <div class="subhead">Other links:</div> <div class="box"> <div><a href="http://www.slideshare.net/BorisMoore/jsviews-next-generation-jquery-templates" >Slide deck: jQuery Conference October 2011</a></div> <div><a href="http://msdn.microsoft.com/en-us/magazine/hh882454.aspx" >MSDN 'Client Insight' article on JsRender</a></div> <div>Training course: <a href="http://johnpapa.net/new-course-on-jsrender-templating-fundamentals-with-javascript" >JsRender Fundamentals</a> from John Papa on <a href="http://pluralsight.net/" >Pluralsight</a> (3 hours of video)</div> </div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/index.html
HTML
gpl2
2,149
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Using layout templates to render arrays along with headers or footers.</h3> <div class="subhead">Top-level layout:</div> <pre> $.templates( "moviesLayout", { markup: "#movieTemplate", layout: true }); $( "#movieList" ).html( $.render.moviesLayout( movies ) ); header {{for #data}} item {{/for}} footer </pre> <div class="subhead">Nested layout:</div> <pre> {{for languages layout=true}} header {{for #data}} item {{/for}} footer {{/for}} </pre> <!--================ Demo ================--> <script id="movieTemplate" type="text/x-jsrender"> <thead> <tr><th colspan="2">{{:length}} movies available:</th></tr> <tr><th>Title</th><th>Languages</th></tr> </thead> <tbody> {{for #data}} <tr> <td>{{:title}}</td> <td> {{for languages layout=true}} <div> {{if #data}} <strong>{{:length}}</strong> languages available: {{else}} Original version only {{/if}} {{for #data}} <em>{{:name}}</em> {{/for}} </div> <div> {{if #data}} Additional languages also in stock {{/if}} </div> {{/for}} </td> </tr> {{/for}} <tbody> </script> <table id="movieList"></table> <script type="text/javascript"> var movies = [ { title: "Meet Joe Black" }, { title: "Eyes Wide Shut", languages: [ { name: "French" }, { name: "Mandarin" }, { name: "Spanish" } ] }, { title: "The Inheritance", languages: [ { name: "English" }, { name: "Russian" } ] } ]; $.templates( "moviesLayout", { markup: "#movieTemplate", layout: true }); $( "#movieList" ).html( $.render.moviesLayout( movies ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/step-by-step/11_layout-templates.html
HTML
gpl2
2,117
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Using {{for}} to render hierarchical data - inline nested template.</h3> <script id="movieTemplate" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{for languages}} <div> <em>{{:name}}</em> </div> {{/for}} </td> </tr> </script> <table> <thead><tr><th>Title</th><th>Languages</th></tr></thead> <tbody id="movieList"></tbody> </table> <script type="text/javascript"> var movies = [ { title: "Meet Joe Black", languages: [ { name: "English" }, { name: "French" } ] }, { title: "Eyes Wide Shut", languages: [ { name: "French" }, { name: "Mandarin" }, { name: "Spanish" } ] }, { title: "The Inheritance", languages: [ { name: "English" }, { name: "German" } ] } ]; $( "#movieList" ).html( $( "#movieTemplate" ).render( movies ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/step-by-step/05_for-tag.html
HTML
gpl2
1,270
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> <style type="text/css"> .role { font-weight: bold; font-style: italic; background-color: Yellow; } .synopsis { background-color: white; padding: 15px; } .director { font-weight: bold; font-style: italic; color: red; } </style> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Using {{: }} or {{> }} to render data values with optional conversion or HTML encoding</h3> <ul> <li>{{:value}} does not convert. Used to render values that include html markup</li> <li>{{loc:value}} Uses custom converter.</li> <li>{{html:value}} Converts using built-in HTML encoder. (Better security, but slight perf cost)</li> <li>{{>value}} Alternative syntax for built-in HTML encoder.</li> </ul><br /> <script id="movieTemplate" type="text/x-jsrender"> <tr> <td>{{loc:title}}</td> <td class="synopsis">{{:synopsis}}</td> <td class="synopsis">{{>synopsis}}</td> </tr> </script> <table> <thead><tr><th>title</th><th>No Convert</th><th>HTML Encode</th></tr></thead> <tbody id="movieList"></tbody> </table> <script type="text/javascript"> var movies = [ { title: "Meet Joe Black", synopsis: "The <span class='role'>grim reaper</span> (<a href='http://www.netflix.com/RoleDisplay/Brad_Pitt/73919'>Brad Pitt</a>) visits <span class='role'>Bill Parrish</span> (<a href='http://www.netflix.com/RoleDisplay/Anthony_Hopkins/43014'>Anthony Hopkins</a>)..." }, { title: "Eyes Wide Shut", synopsis: "Director <span class='director'>Stanley Kubrick's</span> final film: <br/><br/><img src='http://cdn-4.nflximg.com/US/boxshots/large/5670434.jpg'/>" } ]; $.views.converters({ loc: function (value) { switch (value) { case "Meet Joe Black": return "Rencontrez Joe Black"; break; case "Eyes Wide Shut": return "Les Yeux Grand Fermés"; break; default: return value||""; } } }); $( "#movieList" ).html( $( "#movieTemplate" ).render( movies ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/step-by-step/03_no-encoding.html
HTML
gpl2
2,290
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Custom tags</h3> <pre> &lt;td>{{sort languages reverse=true}}...{{/sort}}&lt;/td> $.views.tags({ // Tag to reverse-sort an array sort: function( array ){ var ret = ""; if ( this.props.reverse ) { // Render in reverse order for ( var i = array.length; i; i-- ) { ret += this.renderContent( array[ i - 1 ] ); } } else { // Render in original order ret += this.renderContent( array ); } return ret; } }); </pre> <!--================ Demo ================--> <script id="movieTemplate" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td>{{sort languages tmpl="#sortedTemplate"/}}</td> <td> {{sort languages reverse=true}} <div> <b>{{:name}}</b> </div> {{/sort}} </td> </tr> </script> <script id="sortedTemplate" type="text/x-jsrender"> <div>{{:name}}</div> </script> <table> <thead><tr><th>Title</th><th>Languages</th><th>Reverse order</th></tr></thead> <tbody id="movieList"></tbody> </table> <script type="text/javascript"> $.views.tags({ // Tag to reverse-sort an array sort: function( array ){ var ret = ""; if ( this.props.reverse ) { // Render in reverse order for ( var i = array.length; i; i-- ) { ret += this.renderContent( array[ i - 1 ] ); } } else { // Render in original order ret += this.renderContent( array ); } return ret; } }); var movies = [ { title: "Meet Joe Black", languages: [ { name: "English" }, { name: "French" } ] }, { title: "Eyes Wide Shut", languages: [ { name: "French" }, { name: "German" }, { name: "Spanish" } ] } ]; $( "#movieList" ).html( $( "#movieTemplate" ).render( movies ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/step-by-step/08_custom-tags.html
HTML
gpl2
2,221
<!DOCTYPE html> <html> <head> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>JsRender without jQuery</h3> <pre> jsviews.templates({ movieTemplate: document.getElementById( "movieTemplate" ).innerHTML, ... }); document.getElementById( "movieList" ).innerHTML = jsviews.render.movieTemplate( movies ); </pre> <script id="movieTemplate" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td>{{sort languages tmpl="sortedTemplate"/}}</td> <td>{{sort languages reverse=true}} <div> <b>{{:name}}</b> </div> {{/sort}} </td> </tr> </script> <script id="sortedTemplate" type="text/x-jsrender"> <div>{{:name}}</div> </script> <div id="movieList"></div> <script type="text/javascript"> jsviews.tags({ sort: function( array ){ var ret = ""; if ( this.props.reverse ) { // Render in reverse order for ( var i = array.length; i; i-- ) { ret += this.tmpl.render( array[ i - 1 ] ); } } else { // Render in original order ret += this.tmpl.render( array ); } return ret; } }); var movies = [ { title: "Meet Joe Black", languages: [ { name: "English" }, { name: "French" } ] }, { title: "Eyes Wide Shut", languages: [ { name: "French" }, { name: "German" }, { name: "Spanish" } ] } ]; jsviews.templates({ movieTemplate: document.getElementById( "movieTemplate" ).innerHTML, sortedTemplate: document.getElementById( "sortedTemplate" ).innerHTML }); document.getElementById( "movieList" ).innerHTML = "<table><thead><tr><th>Title</th><th>Original order</th><th>Reverse order</th></tr></thead><tbody>" + jsviews.render.movieTemplate( movies ) + "</tbody></table>"; </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/step-by-step/20_without-jquery.html
HTML
gpl2
1,981
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Accessing paths</h3> <script id="peopleTemplate" type="text/x-jsrender"> <b>{{:#index+1}}:</b> {{:firstName}} {{:lastName}}: <br/> {{for address tmpl="#addressTemplate"/}} {{if phones cells}} <div> Phones: {{for phones cells}} <b>{{:#data}}</b> ({{:#parent.parent.data.firstName}}'s){{/for}} </div> {{/if}} <br/> <i> {{:firstName}} {{if address.street}} lives in {{:address.street}}. {{else}} has no street address... {{/if}} </i> <hr/> </script> <script id="addressTemplate" type="text/x-jsrender"> <div> {{if street}} {{:street}} {{else}} <i>Somewhere</i> in {{/if}} {{:city}} </div> </script> <div id="peopleList"></div> <script type="text/javascript"> var people = [ { firstName: "Pete", lastName: "Ruffles", address: { street: "1 1st Ave NE", city: "Bellevue" }, cells: ["425 666 3455", "425 222 1111"] }, { firstName: "Xavier", lastName: "NoStreet", address: { city: "Redmond" }, phones: "222 666 3455", cells: ["444 666 3455", "999 222 1111"] }, { firstName: "Christie", lastName: "Sutherland", address: { street: "222 2nd Ave NE", city: "Redmond" } } ]; $.views.tags({ notLast: function( content ) { var array = this.parent.data; return array[ array.length - 1 ] === this.data ? "" : content( this ); } }); $( "#peopleList" ).html( $( "#peopleTemplate" ).render( people ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/step-by-step/07_paths.html
HTML
gpl2
1,763
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Template composition. Using external templates for block tags, such as {{for}} and {{if}}.</h3> <script id="movieTemplate" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{for languages tmpl="#columnTemplate"/}} </td> <td> {{for languages tmpl=tmpl/}} </td> <td> {{for languages tmpl='#conditionalTemplate'/}} </td> </tr> </script> <script id="columnTemplate" type="text/x-jsrender"> <div> <em>{{:name}}</em> </div> </script> <script id="rowTemplate" type="text/x-jsrender"> <span> <b>{{:name}}</b> </span> </script> <script id="conditionalTemplate" type="text/x-jsrender"> {{if name.charAt(0)==='E' tmpl='#rowTemplate'}} {{else tmpl='#columnTemplate'}} {{/if}} </script> <table> <thead><tr><th>Synopsis</th><th>Fixed Template</th><th>Template specified in data</th><th>Conditional Template</th></tr></thead> <tbody id="movieList"></tbody> </table> <script type="text/javascript"> var movies = [ { title: "Meet Joe Black", languages: [ { name: "English" }, { name: "French" } ], tmpl: "#columnTemplate" }, { title: "Eyes Wide Shut", languages: [ { name: "French" }, { name: "Esperanto" }, { name: "Spanish" } ], tmpl: "#rowTemplate" }, { title: "The Inheritance", languages: [ { name: "English" }, { name: "German" } ], tmpl: "#columnTemplate" } ]; $( "#movieList" ).html( $( "#movieTemplate" ).render( movies ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/step-by-step/06_template-composition.html
HTML
gpl2
1,877
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Render template against local data</h3> <script id="movieTemplate" type="text/x-jsrender"> <div> {{:#index+1}}: <b>{{:name}}</b> ({{:releaseYear}}) </div> </script> <div id="movieList"></div> <script type="text/javascript"> var movies = [ { name: "The Red Violin", releaseYear: "1998" }, { name: "Eyes Wide Shut", releaseYear: "1999" }, { name: "The Inheritance", releaseYear: "1976" } ]; // Render the template with the movies data and insert // the rendered HTML under the "movieList" element $( "#movieList" ).html( $( "#movieTemplate" ).render( movies ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/step-by-step/01_inserting-data.html
HTML
gpl2
933
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Comparison tests</h3> <pre> {{if !(languages && languages.length)}}...{{/if}} {{if languages==null}}...{{/if}} </pre> <!--================ Demo ================--> <script id="movieTemplate" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{if !(languages && languages.length) tmpl="#messageTmpl"/}} </td> <td> {{if languages==null tmpl="#messageTmpl"/}} </td> </tr> </script> <script id="messageTmpl" type="text/x-jsrender"> <b>Warning:</b> <em>No alternate languages</em> </script> <table> <thead><tr><th>Title</th><th>{{if !(languages && languages.length)}}</th><th>{{if a==null}}</th></tr></thead> <tbody id="movieList"></tbody> </table> <script type="text/javascript"> var movies = [ { title: "Meet Joe Black", languages: null }, { title: "The Mighty", languages: [] }, { title: "Eyes Wide Shut", languages: [ { name: "French" }, { name: "German" }, { name: "Spanish" } ] } ]; $( "#movieList" ).html( $( "#movieTemplate" ).render( movies ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/step-by-step/10_comparison-tests.html
HTML
gpl2
1,462
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Using {{if}} and {{else}} to render conditional sections.</h3> <script id="movieTemplate" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td> {{if languages}} Alternative languages: <em>{{:languages}}</em>. {{else subtitles}} Original language only... <br/>subtitles in <em>{{:subtitles}}</em>. {{else}} Original version only, without subtitles. {{/if}} </td> </tr> </script> <table> <thead><tr><th>title</th><th>languages</th></tr></thead> <tbody id="movieList"></tbody> </table> <script type="text/javascript"> var movies = [ { title: "Meet Joe Black", languages: "English and French", subtitles: "English" }, { title: "Eyes Wide Shut", subtitles: "French and Spanish" }, { title: "The Mighty" }, { title: "City Hunter", languages: "Mandarin and Chinese" } ]; $( "#movieList" ).html( $( "#movieTemplate" ).render( movies ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/step-by-step/04_if-else-tag.html
HTML
gpl2
1,343
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="../demos.html">JsRender Demos</a><br /> <h3>Helper functions</h3> <pre> {{:~format(name, "upper")}} $.views.helpers({ format: function( val, format ){ ... return val.toUpperCase(); ... }, ... }); </pre> <!--=================== Demo ===================--> <!------------------ Templates ------------------> <script id="movieTemplate" type="text/x-jsrender"> <tr> <td>{{:~format(title, "upper")}}</td> <td> {{for languages}} {{:~format(name, "lower")}} {{/for}} </td> </tr> </script> <table> <thead><tr><th>Title</th><th>Languages</th></tr></thead> <tbody id="movieList"></tbody> </table> <!------------------ Script ------------------> <script type="text/javascript"> $.views.helpers({ format: function( val, format ) { var ret; switch( format ) { case "upper": return val.toUpperCase(); case "lower": return val.toLowerCase(); } } }); var movie = { title: "Eyes Wide Shut", languages: [ { name: "French" }, { name: "German" }, { name: "Spanish" } ] }; $( "#movieList" ).html( $( "#movieTemplate" ).render( movie ) ); </script> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/demos/step-by-step/09_helper-functions.html
HTML
gpl2
1,531
/*! JsRender v1.0pre: http://github.com/BorisMoore/jsrender */ /* * Optimized version of jQuery Templates, for rendering to string. * Does not require jQuery, or HTML DOM * Integrates with JsViews (http://github.com/BorisMoore/jsviews) * Copyright 2012, Boris Moore * Released under the MIT License. */ // informal pre beta commit counter: 8 this.jsviews || this.jQuery && jQuery.views || (function( window, undefined ) { //========================== Top-level vars ========================== var versionNumber = "v1.0pre", $, rTag, rTmplString, extend, sub = {}, FALSE = false, TRUE = true, jQuery = window.jQuery, rPath = /^(?:null|true|false|\d[\d.]*|([\w$]+|~([\w$]+)|#(view|([\w$]+))?)([\w$.]*?)(?:[.[]([\w$]+)\]?)?|(['"]).*\8)$/g, // nil object helper view viewProperty pathTokens leafToken string rParams = /(\()(?=|\s*\()|(?:([([])\s*)?(?:([#~]?[\w$.]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*!:?\/]|(=))\s*|([#~]?[\w$.]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*([)\]])([([]?))|(\s+)/g, // lftPrn lftPrn2 path operator err eq path2 prn comma lftPrn2 apos quot rtPrn prn2 space // (left paren? followed by (path? followed by operator) or (path followed by paren?)) or comma or apos or quot or right paren or space rNewLine = /\r?\n/g, rUnescapeQuotes = /\\(['"])/g, rEscapeQuotes = /\\?(['"])/g, rBuildHash = /\x08(~)?([^\x08]+)\x08/g, autoViewKey = 0, autoTmplName = 0, escapeMapForHtml = { "&": "&amp;", "<": "&lt;", ">": "&gt;" }, tmplAttr = "data-jsv-tmpl", fnDeclStr = "var j=j||" + (jQuery ? "jQuery." : "js") + "views,", htmlSpecialChar = /[\x00"&'<>]/g, slice = Array.prototype.slice, render = {}, // jsviews object ($.views if jQuery is loaded) jsv = { jsviews: versionNumber, sub: sub, // subscription, e.g. JsViews integration debugMode: TRUE, err: function( e ) { return jsv.debugMode ? ("<br/><b>Error:</b> <em> " + (e.message || e) + ". </em>") : '""'; }, tmplFn: tmplFn, render: render, templates: templates, tags: tags, helpers: helpers, converters: converters, View: View, convert: convert, delimiters: setDelimiters, tag: renderTag }; //========================== Top-level functions ========================== //=================== // jsviews.delimiters //=================== function setDelimiters( openChars, closeChars ) { // Set the tag opening and closing delimiters. Default is "{{" and "}}" // openChar, closeChars: opening and closing strings, each with two characters var firstOpenChar = "\\" + openChars.charAt( 0 ), // Escape the characters - since they could be regex special characters secondOpenChar = "\\" + openChars.charAt( 1 ), firstCloseChar = "\\" + closeChars.charAt( 0 ), secondCloseChar = "\\" + closeChars.charAt( 1 ); // Build regex with new delimiters jsv.rTag = rTag // make rTag available to JsViews (or other components) for parsing binding expressions = secondOpenChar // tag (followed by / space or }) or cvtr+colon or html or code + "(?:(?:(\\w+(?=[\\/\\s" + firstCloseChar + "]))|(?:(\\w+)?(:)|(>)|(\\*)))" // params + "\\s*((?:[^" + firstCloseChar + "]|" + firstCloseChar + "(?!" + secondCloseChar + "))*?)"; // slash or closeBlock }} rTag = new RegExp( firstOpenChar + rTag + "(\\/)?|(?:\\/(\\w+)))" + firstCloseChar + secondCloseChar, "g" ); // Default rTag: tag converter colon html code params slash closeBlock // /{{(?:(?:(\w+(?=[\/\s}]))|(?:(\w+)?(:)|(>)|(\*)))\s*((?:[^}]|}(?!}))*?)(\/)?|(?:\/(\w+)))}} rTmplString = new RegExp( "<.*>|" + openChars + ".*" + closeChars ); return this; } //================= // View.hlp //================= function getHelper( helper ) { // Helper method called as view.hlp() from compiled template, for helper functions or template parameters ~foo var view = this, tmplHelpers = view.tmpl.helpers || {}; helper = (view.ctx[ helper ] !== undefined ? view.ctx : tmplHelpers[ helper ] !== undefined ? tmplHelpers : helpers[ helper ] !== undefined ? helpers : {})[ helper ]; return typeof helper !== "function" ? helper : function() { return helper.apply(view, arguments); }; } //================= // jsviews.convert //================= function convert( converter, view, text ) { var tmplConverters = view.tmpl.converters; converter = tmplConverters && tmplConverters[ converter ] || converters[ converter ]; return converter ? converter.call( view, text ) : text; } //================= // jsviews.tag //================= function renderTag( tag, parentView, converter, content, tagObject ) { // Called from within compiled template function, to render a nested tag // Returns the rendered tag var ret, tmpl = tagObject.props && tagObject.props.tmpl, tmplTags = parentView.tmpl.tags, nestedTemplates = parentView.tmpl.templates, args = arguments, tagFn = tmplTags && tmplTags[ tag ] || tags[ tag ]; if ( !tagFn ) { return ""; } // Set the tmpl property to the content of the block tag, unless set as an override property on the tag content = content && parentView.tmpl.tmpls[ content - 1 ]; tmpl = tmpl || content || undefined; tagObject.tmpl = "" + tmpl === tmpl // if a string ? nestedTemplates && nestedTemplates[ tmpl ] || templates[ tmpl ] || templates( tmpl ) : tmpl; tagObject.isTag = TRUE; tagObject.converter = converter; tagObject.view = parentView; tagObject.renderContent = renderContent; ret = tagFn.apply( tagObject, args.length > 5 ? slice.call( args, 5 ) : [] ); return ret || ( ret == undefined ? "" : ret.toString()); // (If ret is the value 0 or false, will render to string) } //================= // View constructor //================= function View( context, path, parentView, data, template, key ) { // Constructor for view object in view hierarchy. (Augmented by JsViews if JsViews is loaded) var views = parentView.views, // TODO: add this, as part of smart re-linking on existing content ($.link method), or remove completely // self = parentView.views[ key ]; // if ( !self ) { ... } self = { tmpl: template, path: path, parent: parentView, data: data, ctx: context, // If the data is an array, this is an 'Array View' with a views array for each child 'Instance View' // If the data is not an array, this is an 'Instance View' with a views 'map' object for any child nested views views: $.isArray( data ) ? [] : {}, hlp: getHelper }; if ( $.isArray( views ) ) { // Parent is an 'Array View'. Add this view to its views array views.splice( // self.key = self.key - the index in the parent view array self.key = self.index = key !== undefined ? key : views.length, 0, self); } else { // Parent is an 'Instance View'. Add this view to its views object // self.key = is the key in the parent view map views[ self.key = "_" + autoViewKey++ ] = self; // self.index = is index of the parent self.index = parentView.index; } return self; } //================= // Registration //================= function addToStore( self, store, name, item, process ) { // Add item to named store such as templates, helpers, converters... var key, onStore; if ( name && typeof name === "object" && !name.nodeType ) { // If name is a map, iterate over map and call store for key for ( key in name ) { store( key, name[ key ]); } return self; } if ( !name || item === undefined ) { if ( process ) { item = process( undefined, item || name ); } } else if ( "" + name === name ) { // name must be a string if ( item === null ) { // If item is null, delete this entry delete store[name]; } else if ( item = process ? process( name, item ) : item ) { store[ name ] = item; } } if ( onStore = sub.onStoreItem ) { // e.g. JsViews integration onStore( store, name, item, process ); } return item; } function templates( name, tmpl ) { // Register templates // Setter: Use $.view.tags( name, tagFn ) or $.view.tags({ name: tagFn, ... }) to add additional tags to the registered tags collection. // Getter: Use var tagFn = $.views.tags( name ) or $.views.tags[name] or $.views.tags.name to return the function for the registered tag. // Remove: Use $.view.tags( name, null ) to remove a registered tag from $.view.tags. // When registering for {{foo a b c==d e=f}}, tagFn should be a function with the signature: // function(a,b). The 'this' pointer will be a hash with properties c and e. return addToStore( this, templates, name, tmpl, compile ); } function tags( name, tagFn ) { // Register template tags // Setter: Use $.view.tags( name, tagFn ) or $.view.tags({ name: tagFn, ... }) to add additional tags to the registered tags collection. // Getter: Use var tagFn = $.views.tags( name ) or $.views.tags[name] or $.views.tags.name to return the function for the registered tag. // Remove: Use $.view.tags( name, null ) to remove a registered tag from $.view.tags. // When registering for {{foo a b c==d e=f}}, tagFn should be a function with the signature: // function(a,b). The 'this' pointer will be a hash with properties c and e. return addToStore( this, tags, name, tagFn ); } function helpers( name, helperFn ) { // Register helper functions for use in templates (or in data-link expressions if JsViews is loaded) // Setter: Use $.view.helpers( name, helperFn ) or $.view.helpers({ name: helperFn, ... }) to add additional helpers to the registered helpers collection. // Getter: Use var helperFn = $.views.helpers( name ) or $.views.helpers[name] or $.views.helpers.name to return the function. // Remove: Use $.view.helpers( name, null ) to remove a registered helper function from $.view.helpers. // Within a template, access the helper using the syntax: {{... ~myHelper(...) ...}}. return addToStore( this, helpers, name, helperFn ); } function converters( name, converterFn ) { // Register converter functions for use in templates (or in data-link expressions if JsViews is loaded) // Setter: Use $.view.converters( name, converterFn ) or $.view.converters({ name: converterFn, ... }) to add additional converters to the registered converters collection. // Getter: Use var converterFn = $.views.converters( name ) or $.views.converters[name] or $.views.converters.name to return the converter function. // Remove: Use $.view.converters( name, null ) to remove a registered converter from $.view.converters. // Within a template, access the converter using the syntax: {{myConverter:...}}. return addToStore( this, converters, name, converterFn ); } //================= // renderContent //================= function renderContent( data, context, path, key, parentView ) { // Render template against data as a tree of subviews (nested template), or as a string (top-level template). // tagName parameter for internal use only. Used for rendering templates registered as tags (which may have associated presenter objects) var i, l, dataItem, newView, itemWrap, itemsWrap, itemResult, parentContext, tmpl, layout, onRender, props, swapContent = key === TRUE, self = this, result = ""; if ( self.isTag ) { // This is a call from renderTag tmpl = self.tmpl; if ( self.props && self.ctx ) { extend( self.ctx, self.props ); } if ( self.ctx && context ) { context = extend( self.ctx, context ); } context = self.ctx || context; parentView = parentView || self.view; path = path || self.path; key = key || self.key; props = self.props; } else { tmpl = self.jquery && self[0] // This is a call $.fn.render || self; // This is a call from tmpl.render } parentView = parentView || jsv.topView; parentContext = parentView.ctx; if ( tmpl ) { layout = tmpl.layout; if ( data === parentView ) { // Inherit the data from the parent view. // This may be the contents of an {{if}} block data = parentView.data; layout = TRUE; } // Set additional context on views created here, (as modified context inherited from the parent, and be inherited by child views) // Note: If no jQuery, extend does not support chained copies - so limit extend() to two parameters // TODO make this reusable also for use in JsViews, for adding context passed in with the link() method. context = (context && context === parentContext) ? parentContext : context // if context, make copy // If context, merge context with copied parentContext ? extend( extend( {}, parentContext ), context ) : parentContext; if ( context.link === FALSE ) { // Override inherited value of link by an explicit setting in props: link=false // The child views of an unlinked view are also unlinked. So setting child back to true will not have any effect. context.onRender = FALSE; } if ( !tmpl.fn ) { tmpl = templates[ tmpl ] || templates( tmpl ); } onRender = context.onRender; if ( tmpl ) { if ( $.isArray( data ) && !layout ) { // Create a view for the array, whose child views correspond to each data item. // (Note: if key and parentView are passed in along with parent view, treat as // insert -e.g. from view.addViews - so parentView is already the view item for array) newView = swapContent ? parentView : (key !== undefined && parentView) || View( context, path, parentView, data, tmpl, key ); for ( i = 0, l = data.length; i < l; i++ ) { // Create a view for each data item. dataItem = data[ i ]; itemResult = tmpl.fn( dataItem, View( context, path, newView, dataItem, tmpl, (key||0) + i ), jsv ); result += onRender ? onRender( itemResult, tmpl, props ) : itemResult; } } else { // Create a view for singleton data object. newView = swapContent ? parentView : View( context, path, parentView, data, tmpl, key ); result += (data || layout) ? tmpl.fn( data, newView, jsv ) : ""; } parentView.topKey = newView.key; return onRender ? onRender( result, tmpl, props, newView.key, path ) : result; } } return ""; // No tmpl. Could throw... } //=========================== // Build and compile template //=========================== // Generate a reusable function that will serve to render a template against data // (Compile AST then build template function) function syntaxError( message, e ) { throw (e ? (e.name + ': "' + e.message + '"') : "Syntax error") + (message ? (" \n" + message) : ""); } function tmplFn( markup, tmpl, bind ) { // Compile markup to AST (abtract syntax tree) then build the template function code from the AST nodes // Used for compiling templates, and also by JsViews to build functions for data link expressions var newNode, node, i, l, code, hasTag, hasEncoder, getsValue, hasConverter, hasViewPath, tag, converter, params, hash, nestedTmpl, allowCode, tmplOptions = tmpl ? { allowCode: allowCode = tmpl.allowCode, debug: tmpl.debug } : {}, nested = tmpl && tmpl.tmpls, astTop = [], loc = 0, stack = [], content = astTop, current = [,,,astTop], nestedIndex = 0; //==== nested functions ==== function pushPreceedingContent( shift ) { shift -= loc; if ( shift ) { content.push( markup.substr( loc, shift ).replace( rNewLine, "\\n" )); } } function parseTag( all, tagName, converter, colon, html, code, params, slash, closeBlock, index ) { // tag converter colon html code params slash closeBlock // /{{(?:(?:(\w+(?=[\/!\s\}!]))|(?:(\w+)?(:)|(?:(>)|(\*)))((?:[^\}]|}(?!}))*?)(\/)?|(?:\/(\w+)))}}/g; // Build abstract syntax tree (AST): [ tagName, converter, params, content, hash, contentMarkup ] if ( html ) { colon = ":"; converter = "html"; } var hash = "", passedCtx = "", // Block tag if not self-closing and not {{:}} or {{>}} (special case) and not a data-link expression (has bind parameter) block = !slash && !colon && !bind; //==== nested helper function ==== tagName = tagName || colon; pushPreceedingContent( index ); loc = index + all.length; // location marker - parsed up to here if ( code ) { if ( allowCode ) { content.push([ "*", params.replace( rUnescapeQuotes, "$1" ) ]); } } else if ( tagName ) { if ( tagName === "else" ) { current[ 5 ] = markup.substring( current[ 5 ], index ); // contentMarkup for block tag current = stack.pop(); content = current[ 3 ]; block = TRUE; } params = (params ? parseParams( params, bind ) .replace( rBuildHash, function( all, isCtx, keyValue ) { if ( isCtx ) { passedCtx += keyValue + ","; } else { hash += keyValue + ","; } return ""; }) : ""); hash = hash.slice( 0, -1 ); params = params.slice( 0, -1 ); newNode = [ tagName, converter || "", params, block && [], "{" + (hash ? ("props:{" + hash + "},"): "") + "path:'" + params + "'" + (passedCtx ? ",ctx:{" + passedCtx.slice( 0, -1 ) + "}" : "") + "}" ]; if ( block ) { stack.push( current ); current = newNode; current[ 5 ] = loc; // Store current location of open tag, to be able to add contentMarkup when we reach closing tag } content.push( newNode ); } else if ( closeBlock ) { //if ( closeBlock !== current[ 0 ]) { // throw "unmatched close tag: /" + closeBlock + ". Expected /" + current[ 0 ]; //} current[ 5 ] = markup.substring( current[ 5 ], index ); // contentMarkup for block tag current = stack.pop(); } if ( !current ) { throw "Expected block tag"; } content = current[ 3 ]; } //==== /end of nested functions ==== markup = markup.replace( rEscapeQuotes, "\\$1" ); // Build the AST (abstract syntax tree) under astTop markup.replace( rTag, parseTag ); pushPreceedingContent( markup.length ); // Use the AST (astTop) to build the template function l = astTop.length; code = (l ? "" : '"";'); for ( i = 0; i < l; i++ ) { // AST nodes: [ tagName, converter, params, content, hash, contentMarkup ] node = astTop[ i ]; if ( "" + node === node ) { // type string code += '"' + node + '"+'; } else if ( node[ 0 ] === "*" ) { code = code.slice( 0, i ? -1 : -3 ) + ";" + node[ 1 ] + (i + 1 < l ? "ret+=" : ""); } else { tag = node[ 0 ]; converter = node[ 1 ]; params = node[ 2 ]; content = node[ 3 ]; hash = node[ 4 ]; markup = node[ 5 ]; if ( content ) { // Create template object for nested template nestedTmpl = TmplObject( markup, tmplOptions, tmpl, nestedIndex++ ); // Compile to AST and then to compiled function tmplFn( markup, nestedTmpl); nested.push( nestedTmpl ); } hasViewPath = hasViewPath || hash.indexOf( "view" ) > -1; code += (tag === ":" ? (converter === "html" ? (hasEncoder = TRUE, "e(" + params) : converter ? (hasConverter = TRUE, 'c("' + converter + '",view,' + params) : (getsValue = TRUE, "((v=" + params + ')!=u?v:""') ) : (hasTag = TRUE, 't("' + tag + '",view,"' + (converter || "") + '",' + (content ? nested.length : '""') // For block tags, pass in the key (nested.length) to the nested content template + "," + hash + (params ? "," : "") + params)) + ")+"; } } code = fnDeclStr + (getsValue ? "v," : "") + (hasTag ? "t=j.tag," : "") + (hasConverter ? "c=j.convert," : "") + (hasEncoder ? "e=j.converters.html," : "") + "ret; try{\n\n" + (tmplOptions.debug ? "debugger;" : "") + (allowCode ? 'ret=' : 'return ') + code.slice( 0, -1 ) + ";\n\n" + (allowCode ? "return ret;" : "") + "}catch(e){return j.err(e);}"; try { code = new Function( "data, view, j, b, u", code ); } catch(e) { syntaxError( "Error in compiled template code:\n" + code, e ); } // Include only the var references that are needed in the code if ( tmpl ) { tmpl.fn = code; tmpl.useVw = hasConverter || hasViewPath || hasTag; } return code; } function parseParams( params, bind ) { var named, fnCall = {}, parenDepth = 0, quoted = FALSE, // boolean for string content in double quotes aposed = FALSE; // or in single quotes function parseTokens( all, lftPrn0, lftPrn, path, operator, err, eq, path2, prn, comma, lftPrn2, apos, quot, rtPrn, prn2, space ) { // rParams = /(?:([([])\s*)?(?:([#~]?[\w$.]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*!:?\/]|(=))\s*|([#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*([)\]])([([]?))|(\s+)/g, // lftPrn path operator err eq path2 prn comma lftPrn3 apos quot rtPrn prn2 space // (left paren? followed by (path? followed by operator) or (path followed by paren?)) or comma or apos or quot or right paren or space operator = operator || ""; lftPrn = lftPrn || lftPrn0 || lftPrn2; path = path || path2; prn = prn || prn2 || ""; operator = operator || ""; var bindParam = bind && prn !== "("; function parsePath( all, object, helper, view, viewProperty, pathTokens, leafToken ) { // rPath = /^(?:null|true|false|\d[\d.]*|([\w$]+|~([\w$]+)|#(view|([\w$]+))?)([\w$.]*?)(?:[.[]([\w$]+)\]?)?|(['"]).*\8)$/g, // object helper view viewProperty pathTokens leafToken string if ( object ) { var leaf, ret = (helper ? 'view.hlp("' + helper + '")' : view ? "view" : "data") + (leafToken ? (viewProperty ? "." + viewProperty : helper ? "" : (view ? "" : "." + object) ) + (pathTokens || "") : (leafToken = helper ? "" : view ? viewProperty || "" : object, "")); leaf = (leafToken ? "." + leafToken : "") if ( !bindParam) { ret = ret + leaf; } ret = ret.slice( 0,9 ) === "view.data" ? ret.slice(5) // convert #view.data... to data... : ret; if ( bindParam ) { ret = "b(" + ret + ',"' + leafToken + '")' + leaf; } return ret; } return all; } if ( err ) { syntaxError(); } else { return (aposed // within single-quoted string ? (aposed = !apos, (aposed ? all : '"')) : quoted // within double-quoted string ? (quoted = !quot, (quoted ? all : '"')) : ( (lftPrn ? (parenDepth++, lftPrn) : "") + (space ? (parenDepth ? "" : named ? (named = FALSE, "\b") : "," ) : eq // named param ? (parenDepth && syntaxError(), named = TRUE, '\b' + path + ':') : path // path ? (path.replace( rPath, parsePath ) + (prn ? (fnCall[ ++parenDepth ] = TRUE, prn) : operator) ) : operator ? all : rtPrn // function ? ((fnCall[ parenDepth-- ] = FALSE, rtPrn) + (prn ? (fnCall[ ++parenDepth ] = TRUE, prn) : "") ) : comma ? (fnCall[ parenDepth ] || syntaxError(), ",") // We don't allow top-level literal arrays or objects : lftPrn0 ? "" : (aposed = apos, quoted = quot, '"') )) ); } } params = (params + " " ).replace( rParams, parseTokens ); return params; } function compile( name, tmpl, parent, options ) { // tmpl is either a template object, a selector for a template script block, the name of a compiled template, or a template object // options is the set of template properties, c var tmplOrMarkup, elem, key, nested, nestedItem; //==== nested functions ==== function tmplOrMarkupFromStr( value ) { // If value is of type string - treat as selector, or name of compiled template // Return the template object, if already compiled, or the markup string if ( ("" + value === value) || value.nodeType > 0 ) { try { elem = value.nodeType > 0 ? value : !rTmplString.test( value ) // If value is a string and does not contain HTML or tag content, then test as selector && jQuery && jQuery( value )[0]; // If selector is valid and returns at least one element, get first element // If invalid, jQuery will throw. We will stay with the original string. } catch(e) {} if ( elem && elem.type ) { // It is a script element // Create a name for data linking if none provided value = templates[ elem.getAttribute( tmplAttr )]; if ( !value ) { // Not already compiled and cached, so compile and cache the name name = name || "_" + autoTmplName++; elem.setAttribute( tmplAttr, name ); value = compile( name, elem.innerHTML, parent, options ); // Use tmpl as options templates[ name ] = value; } } return value; } // If value is not a string or dom element, return undefined } //==== Compile the template ==== tmpl = tmpl || ""; tmplOrMarkup = tmplOrMarkupFromStr( tmpl ); // If tmpl is a template object, use it for options options = options || (tmpl.markup ? tmpl : {}); options.name = name; nested = options.templates; // If tmpl is not a markup string or a selector string, then it must be a template object // In that case, get it from the markup property of the object if ( !tmplOrMarkup && tmpl.markup && (tmplOrMarkup = tmplOrMarkupFromStr( tmpl.markup ))) { if ( tmplOrMarkup.fn && (tmplOrMarkup.debug !== tmpl.debug || tmplOrMarkup.allowCode !== tmpl.allowCode )) { // if the string references a compiled template object, but the debug or allowCode props are different, need to recompile tmplOrMarkup = tmplOrMarkup.markup; } } if ( tmplOrMarkup !== undefined ) { if ( name && !parent ) { render[ name ] = function() { return tmpl.render.apply( tmpl, arguments ); }; } if ( tmplOrMarkup.fn || tmpl.fn ) { // tmpl is already compiled, so use it, or if different name is provided, clone it if ( tmplOrMarkup.fn ) { if ( name && name !== tmplOrMarkup.name ) { tmpl = extend( extend( {}, tmplOrMarkup ), options); } else { tmpl = tmplOrMarkup; } } } else { // tmplOrMarkup is a markup string, not a compiled template // Create template object tmpl = TmplObject( tmplOrMarkup, options, parent, 0 ); // Compile to AST and then to compiled function tmplFn( tmplOrMarkup, tmpl ); } for ( key in nested ) { // compile nested template declarations nestedItem = nested[ key ]; if ( nestedItem.name !== key ) { nested[ key ] = compile( key, nestedItem, tmpl ); } } return tmpl; } } //==== /end of function compile ==== function TmplObject( markup, options, parent, key ) { // Template object constructor // nested helper function function extendStore( storeName ) { if ( parent[ storeName ]) { // Include parent items except if overridden by item of same name in options tmpl[ storeName ] = extend( extend( {}, parent[ storeName ] ), options[ storeName ] ); } } options = options || {}; var tmpl = { markup: markup, tmpls: [], links: [], render: renderContent }; if ( parent ) { if ( parent.templates ) { tmpl.templates = extend( extend( {}, parent.templates ), options.templates ); } tmpl.parent = parent; tmpl.name = parent.name + "[" + key + "]"; tmpl.key = key; } extend( tmpl, options ); if ( parent ) { extendStore( "templates" ); extendStore( "tags" ); extendStore( "helpers" ); extendStore( "converters" ); } return tmpl; } //========================== Initialize ========================== if ( jQuery ) { //////////////////////////////////////////////////////////////////////////////////////////////// // jQuery is loaded, so make $ the jQuery object $ = jQuery; $.templates = templates; $.render = render; $.views = jsv; $.fn.render = renderContent; } else { //////////////////////////////////////////////////////////////////////////////////////////////// // jQuery is not loaded. $ = window.jsviews = jsv; $.extend = function( target, source ) { var name; target = target || {}; for ( name in source ) { target[ name ] = source[ name ]; } return target; }; $.isArray = Array && Array.isArray || function( obj ) { return Object.prototype.toString.call( obj ) === "[object Array]"; }; } extend = $.extend; jsv.topView = { views: {}, tmpl: {}, hlp: getHelper, ctx: jsv.helpers }; function replacerForHtml( ch ) { // Original code from Mike Samuel <msamuel@google.com> return escapeMapForHtml[ ch ] // Intentional assignment that caches the result of encoding ch. || (escapeMapForHtml[ ch ] = "&#" + ch.charCodeAt( 0 ) + ";"); } //========================== Register tags ========================== tags({ "if": function() { var ifTag = this, view = ifTag.view; view.onElse = function( tagObject, args ) { var i = 0, l = args.length; while ( l && !args[ i++ ]) { // Only render content if args.length === 0 (i.e. this is an else with no condition) or if a condition argument is truey if ( i === l ) { return ""; } } view.onElse = undefined; // If condition satisfied, so won't run 'else'. tagObject.path = ""; return tagObject.renderContent( view ); // Test is satisfied, so render content, while remaining in current data context // By passing the view, we inherit data context from the parent view, and the content is treated as a layout template // (so if the data is an array, it will not iterate over the data }; return view.onElse( this, arguments ); }, "else": function() { var view = this.view; return view.onElse ? view.onElse( this, arguments ) : ""; }, "for": function() { var i, self = this, result = "", args = arguments, l = args.length; if ( self.props && self.props.layout ) { self.tmpl.layout = TRUE; } for ( i = 0; i < l; i++ ) { result += self.renderContent( args[ i ]); } return result; }, "=": function( value ) { return value; }, "*": function( value ) { return value; } }); //========================== Register global helpers ========================== // helpers({ // Global helper functions // // TODO add any useful built-in helper functions // }); //========================== Register converters ========================== converters({ html: function( text ) { // HTML encoding helper: Replace < > & and ' and " by corresponding entities. // inspired by Mike Samuel <msamuel@google.com> return text != undefined ? String( text ).replace( htmlSpecialChar, replacerForHtml ) : ""; } }); //========================== Define default delimiters ========================== setDelimiters( "{{", "}}" ); })( this );
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsrender/jsrender.js
JavaScript
gpl2
30,667
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <link rel='stylesheet' type='text/css' href='cupertino/theme.css' /> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' /> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' /> <script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script> <script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script> <script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script> <script type='text/javascript'> $(document).ready(function() { var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); $('#calendar').fullCalendar({ theme: true, header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, editable: true, events: [ { title: 'All Day Event', start: new Date(y, m, 1) }, { title: 'Long Event', start: new Date(y, m, d-5), end: new Date(y, m, d-2) }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d-3, 16, 0), allDay: false }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d+4, 16, 0), allDay: false }, { title: 'Meeting', start: new Date(y, m, d, 10, 30), allDay: false }, { title: 'Lunch', start: new Date(y, m, d, 12, 0), end: new Date(y, m, d, 14, 0), allDay: false }, { title: 'Birthday Party', start: new Date(y, m, d+1, 19, 0), end: new Date(y, m, d+1, 22, 30), allDay: false }, { title: 'Click for Google', start: new Date(y, m, 28), end: new Date(y, m, 29), url: 'http://google.com/' } ] }); }); </script> <style type='text/css'> body { margin-top: 40px; text-align: center; font-size: 13px; font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; } #calendar { width: 900px; margin: 0 auto; } </style> </head> <body> <div id='calendar'></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/demos/theme.html
HTML
gpl2
2,213
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' /> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' /> <script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script> <script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script> <script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script> <script type='text/javascript'> $(document).ready(function() { var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,basicWeek,basicDay' }, editable: true, events: [ { title: 'All Day Event', start: new Date(y, m, 1) }, { title: 'Long Event', start: new Date(y, m, d-5), end: new Date(y, m, d-2) }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d-3, 16, 0), allDay: false }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d+4, 16, 0), allDay: false }, { title: 'Meeting', start: new Date(y, m, d, 10, 30), allDay: false }, { title: 'Lunch', start: new Date(y, m, d, 12, 0), end: new Date(y, m, d, 14, 0), allDay: false }, { title: 'Birthday Party', start: new Date(y, m, d+1, 19, 0), end: new Date(y, m, d+1, 22, 30), allDay: false }, { title: 'Click for Google', start: new Date(y, m, 28), end: new Date(y, m, 29), url: 'http://google.com/' } ] }); }); </script> <style type='text/css'> body { margin-top: 40px; text-align: center; font-size: 14px; font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; } #calendar { width: 900px; margin: 0 auto; } </style> </head> <body> <div id='calendar'></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/demos/basic-views.html
HTML
gpl2
2,126
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' /> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' /> <script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script> <script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script> <script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script> <script type='text/javascript'> $(document).ready(function() { /* initialize the external events -----------------------------------------------------------------*/ $('#external-events div.external-event').each(function() { // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/) // it doesn't need to have a start or end var eventObject = { title: $.trim($(this).text()) // use the element's text as the event title }; // store the Event Object in the DOM element so we can get to it later $(this).data('eventObject', eventObject); // make the event draggable using jQuery UI $(this).draggable({ zIndex: 999, revert: true, // will cause the event to go back to its revertDuration: 0 // original position after the drag }); }); /* initialize the calendar -----------------------------------------------------------------*/ $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, editable: true, droppable: true, // this allows things to be dropped onto the calendar !!! drop: function(date, allDay) { // this function is called when something is dropped // retrieve the dropped element's stored Event Object var originalEventObject = $(this).data('eventObject'); // we need to copy it, so that multiple events don't have a reference to the same object var copiedEventObject = $.extend({}, originalEventObject); // assign it the date that was reported copiedEventObject.start = date; copiedEventObject.allDay = allDay; // render the event on the calendar // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/) $('#calendar').fullCalendar('renderEvent', copiedEventObject, true); // is the "remove after drop" checkbox checked? if ($('#drop-remove').is(':checked')) { // if so, remove the element from the "Draggable Events" list $(this).remove(); } } }); }); </script> <style type='text/css'> body { margin-top: 40px; text-align: center; font-size: 14px; font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; } #wrap { width: 1100px; margin: 0 auto; } #external-events { float: left; width: 150px; padding: 0 10px; border: 1px solid #ccc; background: #eee; text-align: left; } #external-events h4 { font-size: 16px; margin-top: 0; padding-top: 1em; } .external-event { /* try to mimick the look of a real event */ margin: 10px 0; padding: 2px 4px; background: #3366CC; color: #fff; font-size: .85em; cursor: pointer; } #external-events p { margin: 1.5em 0; font-size: 11px; color: #666; } #external-events p input { margin: 0; vertical-align: middle; } #calendar { float: right; width: 900px; } </style> </head> <body> <div id='wrap'> <div id='external-events'> <h4>Draggable Events</h4> <div class='external-event'>My Event 1</div> <div class='external-event'>My Event 2</div> <div class='external-event'>My Event 3</div> <div class='external-event'>My Event 4</div> <div class='external-event'>My Event 5</div> <p> <input type='checkbox' id='drop-remove' /> <label for='drop-remove'>remove after drop</label> </p> </div> <div id='calendar'></div> <div style='clear:both'></div> </div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/demos/external-dragging.html
HTML
gpl2
4,223
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' /> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' /> <script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script> <script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script> <script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script> <script type='text/javascript'> $(document).ready(function() { var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, editable: true, events: [ { title: 'All Day Event', start: new Date(y, m, 1) }, { title: 'Long Event', start: new Date(y, m, d-5), end: new Date(y, m, d-2) }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d-3, 16, 0), allDay: false }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d+4, 16, 0), allDay: false }, { title: 'Meeting', start: new Date(y, m, d, 10, 30), allDay: false }, { title: 'Lunch', start: new Date(y, m, d, 12, 0), end: new Date(y, m, d, 14, 0), allDay: false }, { title: 'Birthday Party', start: new Date(y, m, d+1, 19, 0), end: new Date(y, m, d+1, 22, 30), allDay: false }, { title: 'Click for Google', start: new Date(y, m, 28), end: new Date(y, m, 29), url: 'http://google.com/' } ] }); }); </script> <style type='text/css'> body { margin-top: 40px; text-align: center; font-size: 14px; font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; } #calendar { width: 900px; margin: 0 auto; } </style> </head> <body> <div id='calendar'></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/demos/agenda-views.html
HTML
gpl2
2,223
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' /> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' /> <script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script> <script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script> <script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script> <script type='text/javascript'> $(document).ready(function() { var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); var calendar = $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, selectable: true, selectHelper: true, select: function(start, end, allDay) { var title = prompt('Event Title:'); if (title) { calendar.fullCalendar('renderEvent', { title: title, start: start, end: end, allDay: allDay }, true // make the event "stick" ); } calendar.fullCalendar('unselect'); }, editable: true, events: [ { title: 'All Day Event', start: new Date(y, m, 1) }, { title: 'Long Event', start: new Date(y, m, d-5), end: new Date(y, m, d-2) }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d-3, 16, 0), allDay: false }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d+4, 16, 0), allDay: false }, { title: 'Meeting', start: new Date(y, m, d, 10, 30), allDay: false }, { title: 'Lunch', start: new Date(y, m, d, 12, 0), end: new Date(y, m, d, 14, 0), allDay: false }, { title: 'Birthday Party', start: new Date(y, m, d+1, 19, 0), end: new Date(y, m, d+1, 22, 30), allDay: false }, { title: 'Click for Google', start: new Date(y, m, 28), end: new Date(y, m, 29), url: 'http://google.com/' } ] }); }); </script> <style type='text/css'> body { margin-top: 40px; text-align: center; font-size: 14px; font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; } #calendar { width: 900px; margin: 0 auto; } </style> </head> <body> <div id='calendar'></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/demos/selectable.html
HTML
gpl2
2,634
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' /> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' /> <script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script> <script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script> <script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script> <script type='text/javascript'> $(document).ready(function() { $('#calendar').fullCalendar({ editable: true, events: "json-events.php", eventDrop: function(event, delta) { alert(event.title + ' was moved ' + delta + ' days\n' + '(should probably update your database)'); }, loading: function(bool) { if (bool) $('#loading').show(); else $('#loading').hide(); } }); }); </script> <style type='text/css'> body { margin-top: 40px; text-align: center; font-size: 14px; font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; } #loading { position: absolute; top: 5px; right: 5px; } #calendar { width: 900px; margin: 0 auto; } </style> </head> <body> <div id='loading' style='display:none'>loading...</div> <div id='calendar'></div> <p>json-events.php needs to be running in the same directory.</p> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/demos/json.html
HTML
gpl2
1,475
/* * jQuery UI CSS Framework 1.8.11 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI/Theming/API */ /* Layout helpers ----------------------------------*/ .ui-helper-hidden { display: none; } .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .ui-helper-clearfix { display: inline-block; } /* required comment for clearfix to work in Opera \*/ * html .ui-helper-clearfix { height:1%; } .ui-helper-clearfix { display:block; } /* end clearfix */ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } /* Interaction Cues ----------------------------------*/ .ui-state-disabled { cursor: default !important; } /* Icons ----------------------------------*/ /* states and images */ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } /* Misc visuals ----------------------------------*/ /* Overlays */ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } /* * jQuery UI CSS Framework 1.8.11 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI/Theming/API * * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=deedf7&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=100&borderColorHeader=aed0ea&fcHeader=222222&iconColorHeader=72a7cf&bgColorContent=f2f5f7&bgTextureContent=04_highlight_hard.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=362b36&iconColorContent=72a7cf&bgColorDefault=d7ebf9&bgTextureDefault=02_glass.png&bgImgOpacityDefault=80&borderColorDefault=aed0ea&fcDefault=2779aa&iconColorDefault=3d80b3&bgColorHover=e4f1fb&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=74b2e2&fcHover=0070a3&iconColorHover=2694e8&bgColorActive=3baae3&bgTextureActive=02_glass.png&bgImgOpacityActive=50&borderColorActive=2694e8&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=ffef8f&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=25&borderColorHighlight=f9dd34&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=cd0a0a&bgTextureError=01_flat.png&bgImgOpacityError=15&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffffff&bgColorOverlay=eeeeee&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=90&opacityOverlay=80&bgColorShadow=000000&bgTextureShadow=04_highlight_hard.png&bgImgOpacityShadow=70&opacityShadow=30&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px */ /* Component containers ----------------------------------*/ .ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; } .ui-widget .ui-widget { font-size: 1em; } .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; } .ui-widget-content { border: 1px solid #dddddd; background: #f2f5f7 url(images/ui-bg_highlight-hard_100_f2f5f7_1x100.png) 50% top repeat-x; color: #362b36; } .ui-widget-content a { color: #362b36; } .ui-widget-header { border: 1px solid #aed0ea; background: #deedf7 url(images/ui-bg_highlight-soft_100_deedf7_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } .ui-widget-header a { color: #222222; } /* Interaction states ----------------------------------*/ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #aed0ea; background: #d7ebf9 url(images/ui-bg_glass_80_d7ebf9_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2779aa; } .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2779aa; text-decoration: none; } .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #74b2e2; background: #e4f1fb url(images/ui-bg_glass_100_e4f1fb_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #0070a3; } .ui-state-hover a, .ui-state-hover a:hover { color: #0070a3; text-decoration: none; } .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #2694e8; background: #3baae3 url(images/ui-bg_glass_50_3baae3_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #ffffff; } .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #ffffff; text-decoration: none; } .ui-widget :active { outline: none; } /* Interaction Cues ----------------------------------*/ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #f9dd34; background: #ffef8f url(images/ui-bg_highlight-soft_25_ffef8f_1x100.png) 50% top repeat-x; color: #363636; } .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #cd0a0a url(images/ui-bg_flat_15_cd0a0a_40x100.png) 50% 50% repeat-x; color: #ffffff; } .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; } .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; } .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } /* Icons ----------------------------------*/ /* states and images */ .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_72a7cf_256x240.png); } .ui-widget-content .ui-icon {background-image: url(images/ui-icons_72a7cf_256x240.png); } .ui-widget-header .ui-icon {background-image: url(images/ui-icons_72a7cf_256x240.png); } .ui-state-default .ui-icon { background-image: url(images/ui-icons_3d80b3_256x240.png); } .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_2694e8_256x240.png); } .ui-state-active .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } /* positioning */ .ui-icon-carat-1-n { background-position: 0 0; } .ui-icon-carat-1-ne { background-position: -16px 0; } .ui-icon-carat-1-e { background-position: -32px 0; } .ui-icon-carat-1-se { background-position: -48px 0; } .ui-icon-carat-1-s { background-position: -64px 0; } .ui-icon-carat-1-sw { background-position: -80px 0; } .ui-icon-carat-1-w { background-position: -96px 0; } .ui-icon-carat-1-nw { background-position: -112px 0; } .ui-icon-carat-2-n-s { background-position: -128px 0; } .ui-icon-carat-2-e-w { background-position: -144px 0; } .ui-icon-triangle-1-n { background-position: 0 -16px; } .ui-icon-triangle-1-ne { background-position: -16px -16px; } .ui-icon-triangle-1-e { background-position: -32px -16px; } .ui-icon-triangle-1-se { background-position: -48px -16px; } .ui-icon-triangle-1-s { background-position: -64px -16px; } .ui-icon-triangle-1-sw { background-position: -80px -16px; } .ui-icon-triangle-1-w { background-position: -96px -16px; } .ui-icon-triangle-1-nw { background-position: -112px -16px; } .ui-icon-triangle-2-n-s { background-position: -128px -16px; } .ui-icon-triangle-2-e-w { background-position: -144px -16px; } .ui-icon-arrow-1-n { background-position: 0 -32px; } .ui-icon-arrow-1-ne { background-position: -16px -32px; } .ui-icon-arrow-1-e { background-position: -32px -32px; } .ui-icon-arrow-1-se { background-position: -48px -32px; } .ui-icon-arrow-1-s { background-position: -64px -32px; } .ui-icon-arrow-1-sw { background-position: -80px -32px; } .ui-icon-arrow-1-w { background-position: -96px -32px; } .ui-icon-arrow-1-nw { background-position: -112px -32px; } .ui-icon-arrow-2-n-s { background-position: -128px -32px; } .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } .ui-icon-arrow-2-e-w { background-position: -160px -32px; } .ui-icon-arrow-2-se-nw { background-position: -176px -32px; } .ui-icon-arrowstop-1-n { background-position: -192px -32px; } .ui-icon-arrowstop-1-e { background-position: -208px -32px; } .ui-icon-arrowstop-1-s { background-position: -224px -32px; } .ui-icon-arrowstop-1-w { background-position: -240px -32px; } .ui-icon-arrowthick-1-n { background-position: 0 -48px; } .ui-icon-arrowthick-1-ne { background-position: -16px -48px; } .ui-icon-arrowthick-1-e { background-position: -32px -48px; } .ui-icon-arrowthick-1-se { background-position: -48px -48px; } .ui-icon-arrowthick-1-s { background-position: -64px -48px; } .ui-icon-arrowthick-1-sw { background-position: -80px -48px; } .ui-icon-arrowthick-1-w { background-position: -96px -48px; } .ui-icon-arrowthick-1-nw { background-position: -112px -48px; } .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } .ui-icon-arrowreturn-1-w { background-position: -64px -64px; } .ui-icon-arrowreturn-1-n { background-position: -80px -64px; } .ui-icon-arrowreturn-1-e { background-position: -96px -64px; } .ui-icon-arrowreturn-1-s { background-position: -112px -64px; } .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } .ui-icon-arrow-4 { background-position: 0 -80px; } .ui-icon-arrow-4-diag { background-position: -16px -80px; } .ui-icon-extlink { background-position: -32px -80px; } .ui-icon-newwin { background-position: -48px -80px; } .ui-icon-refresh { background-position: -64px -80px; } .ui-icon-shuffle { background-position: -80px -80px; } .ui-icon-transfer-e-w { background-position: -96px -80px; } .ui-icon-transferthick-e-w { background-position: -112px -80px; } .ui-icon-folder-collapsed { background-position: 0 -96px; } .ui-icon-folder-open { background-position: -16px -96px; } .ui-icon-document { background-position: -32px -96px; } .ui-icon-document-b { background-position: -48px -96px; } .ui-icon-note { background-position: -64px -96px; } .ui-icon-mail-closed { background-position: -80px -96px; } .ui-icon-mail-open { background-position: -96px -96px; } .ui-icon-suitcase { background-position: -112px -96px; } .ui-icon-comment { background-position: -128px -96px; } .ui-icon-person { background-position: -144px -96px; } .ui-icon-print { background-position: -160px -96px; } .ui-icon-trash { background-position: -176px -96px; } .ui-icon-locked { background-position: -192px -96px; } .ui-icon-unlocked { background-position: -208px -96px; } .ui-icon-bookmark { background-position: -224px -96px; } .ui-icon-tag { background-position: -240px -96px; } .ui-icon-home { background-position: 0 -112px; } .ui-icon-flag { background-position: -16px -112px; } .ui-icon-calendar { background-position: -32px -112px; } .ui-icon-cart { background-position: -48px -112px; } .ui-icon-pencil { background-position: -64px -112px; } .ui-icon-clock { background-position: -80px -112px; } .ui-icon-disk { background-position: -96px -112px; } .ui-icon-calculator { background-position: -112px -112px; } .ui-icon-zoomin { background-position: -128px -112px; } .ui-icon-zoomout { background-position: -144px -112px; } .ui-icon-search { background-position: -160px -112px; } .ui-icon-wrench { background-position: -176px -112px; } .ui-icon-gear { background-position: -192px -112px; } .ui-icon-heart { background-position: -208px -112px; } .ui-icon-star { background-position: -224px -112px; } .ui-icon-link { background-position: -240px -112px; } .ui-icon-cancel { background-position: 0 -128px; } .ui-icon-plus { background-position: -16px -128px; } .ui-icon-plusthick { background-position: -32px -128px; } .ui-icon-minus { background-position: -48px -128px; } .ui-icon-minusthick { background-position: -64px -128px; } .ui-icon-close { background-position: -80px -128px; } .ui-icon-closethick { background-position: -96px -128px; } .ui-icon-key { background-position: -112px -128px; } .ui-icon-lightbulb { background-position: -128px -128px; } .ui-icon-scissors { background-position: -144px -128px; } .ui-icon-clipboard { background-position: -160px -128px; } .ui-icon-copy { background-position: -176px -128px; } .ui-icon-contact { background-position: -192px -128px; } .ui-icon-image { background-position: -208px -128px; } .ui-icon-video { background-position: -224px -128px; } .ui-icon-script { background-position: -240px -128px; } .ui-icon-alert { background-position: 0 -144px; } .ui-icon-info { background-position: -16px -144px; } .ui-icon-notice { background-position: -32px -144px; } .ui-icon-help { background-position: -48px -144px; } .ui-icon-check { background-position: -64px -144px; } .ui-icon-bullet { background-position: -80px -144px; } .ui-icon-radio-off { background-position: -96px -144px; } .ui-icon-radio-on { background-position: -112px -144px; } .ui-icon-pin-w { background-position: -128px -144px; } .ui-icon-pin-s { background-position: -144px -144px; } .ui-icon-play { background-position: 0 -160px; } .ui-icon-pause { background-position: -16px -160px; } .ui-icon-seek-next { background-position: -32px -160px; } .ui-icon-seek-prev { background-position: -48px -160px; } .ui-icon-seek-end { background-position: -64px -160px; } .ui-icon-seek-start { background-position: -80px -160px; } /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ .ui-icon-seek-first { background-position: -80px -160px; } .ui-icon-stop { background-position: -96px -160px; } .ui-icon-eject { background-position: -112px -160px; } .ui-icon-volume-off { background-position: -128px -160px; } .ui-icon-volume-on { background-position: -144px -160px; } .ui-icon-power { background-position: 0 -176px; } .ui-icon-signal-diag { background-position: -16px -176px; } .ui-icon-signal { background-position: -32px -176px; } .ui-icon-battery-0 { background-position: -48px -176px; } .ui-icon-battery-1 { background-position: -64px -176px; } .ui-icon-battery-2 { background-position: -80px -176px; } .ui-icon-battery-3 { background-position: -96px -176px; } .ui-icon-circle-plus { background-position: 0 -192px; } .ui-icon-circle-minus { background-position: -16px -192px; } .ui-icon-circle-close { background-position: -32px -192px; } .ui-icon-circle-triangle-e { background-position: -48px -192px; } .ui-icon-circle-triangle-s { background-position: -64px -192px; } .ui-icon-circle-triangle-w { background-position: -80px -192px; } .ui-icon-circle-triangle-n { background-position: -96px -192px; } .ui-icon-circle-arrow-e { background-position: -112px -192px; } .ui-icon-circle-arrow-s { background-position: -128px -192px; } .ui-icon-circle-arrow-w { background-position: -144px -192px; } .ui-icon-circle-arrow-n { background-position: -160px -192px; } .ui-icon-circle-zoomin { background-position: -176px -192px; } .ui-icon-circle-zoomout { background-position: -192px -192px; } .ui-icon-circle-check { background-position: -208px -192px; } .ui-icon-circlesmall-plus { background-position: 0 -208px; } .ui-icon-circlesmall-minus { background-position: -16px -208px; } .ui-icon-circlesmall-close { background-position: -32px -208px; } .ui-icon-squaresmall-plus { background-position: -48px -208px; } .ui-icon-squaresmall-minus { background-position: -64px -208px; } .ui-icon-squaresmall-close { background-position: -80px -208px; } .ui-icon-grip-dotted-vertical { background-position: 0 -224px; } .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } .ui-icon-grip-solid-vertical { background-position: -32px -224px; } .ui-icon-grip-solid-horizontal { background-position: -48px -224px; } .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } .ui-icon-grip-diagonal-se { background-position: -80px -224px; } /* Misc visuals ----------------------------------*/ /* Corner radius */ .ui-corner-tl { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; } .ui-corner-tr { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } .ui-corner-bl { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } .ui-corner-br { -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } .ui-corner-top { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } .ui-corner-bottom { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } .ui-corner-right { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } .ui-corner-left { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } .ui-corner-all { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; } /* Overlays */ .ui-widget-overlay { background: #eeeeee url(images/ui-bg_diagonals-thick_90_eeeeee_40x40.png) 50% 50% repeat; opacity: .80;filter:Alpha(Opacity=80); } .ui-widget-shadow { margin: -7px 0 0 -7px; padding: 7px; background: #000000 url(images/ui-bg_highlight-hard_70_000000_1x100.png) 50% top repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* * jQuery UI Resizable 1.8.11 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI/Resizable#theming */ .ui-resizable { position: relative;} .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* * jQuery UI Tabs 1.8.11 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI/Tabs#theming */ .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } .ui-tabs .ui-tabs-hide { display: none !important; }
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/demos/cupertino/theme.css
CSS
gpl2
22,274
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' /> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' /> <script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script> <script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script> <script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script> <script type='text/javascript' src='../fullcalendar/gcal.js'></script> <script type='text/javascript'> $(document).ready(function() { $('#calendar').fullCalendar({ // US Holidays events: 'http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic', eventClick: function(event) { // opens events in a popup window window.open(event.url, 'gcalevent', 'width=700,height=600'); return false; }, loading: function(bool) { if (bool) { $('#loading').show(); }else{ $('#loading').hide(); } } }); }); </script> <style type='text/css'> body { margin-top: 40px; text-align: center; font-size: 14px; font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; } #loading { position: absolute; top: 5px; right: 5px; } #calendar { width: 900px; margin: 0 auto; } </style> </head> <body> <div id='loading' style='display:none'>loading...</div> <div id='calendar'></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/demos/gcal.html
HTML
gpl2
1,574
<?php $year = date('Y'); $month = date('m'); echo json_encode(array( array( 'id' => 111, 'title' => "Event1", 'start' => "$year-$month-10", 'url' => "http://yahoo.com/" ), array( 'id' => 222, 'title' => "Event2", 'start' => "$year-$month-20", 'end' => "$year-$month-22", 'url' => "http://yahoo.com/" ) )); ?>
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/demos/json-events.php
PHP
gpl2
358
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' /> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' /> <script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script> <script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script> <script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script> <script type='text/javascript'> $(document).ready(function() { var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); $('#calendar').fullCalendar({ editable: true, events: [ { title: 'All Day Event', start: new Date(y, m, 1) }, { title: 'Long Event', start: new Date(y, m, d-5), end: new Date(y, m, d-2) }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d-3, 16, 0), allDay: false }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d+4, 16, 0), allDay: false }, { title: 'Meeting', start: new Date(y, m, d, 10, 30), allDay: false }, { title: 'Lunch', start: new Date(y, m, d, 12, 0), end: new Date(y, m, d, 14, 0), allDay: false }, { title: 'Birthday Party', start: new Date(y, m, d+1, 19, 0), end: new Date(y, m, d+1, 22, 30), allDay: false }, { title: 'Click for Google', start: new Date(y, m, 28), end: new Date(y, m, 29), url: 'http://google.com/' } ] }); }); </script> <style type='text/css'> body { margin-top: 40px; text-align: center; font-size: 14px; font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; } #calendar { width: 900px; margin: 0 auto; } </style> </head> <body> <div id='calendar'></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/demos/default.html
HTML
gpl2
2,109
/* * FullCalendar v1.5.3 Print Stylesheet * * Include this stylesheet on your page to get a more printer-friendly calendar. * When including this stylesheet, use the media='print' attribute of the <link> tag. * Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css. * * Copyright (c) 2011 Adam Shaw * Dual licensed under the MIT and GPL licenses, located in * MIT-LICENSE.txt and GPL-LICENSE.txt respectively. * * Date: Mon Feb 6 22:40:40 2012 -0800 * */ /* Events -----------------------------------------------------*/ .fc-event-skin { background: none !important; color: #000 !important; } /* horizontal events */ .fc-event-hori { border-width: 0 0 1px 0 !important; border-bottom-style: dotted !important; border-bottom-color: #000 !important; padding: 1px 0 0 0 !important; } .fc-event-hori .fc-event-inner { border-width: 0 !important; padding: 0 1px !important; } /* vertical events */ .fc-event-vert { border-width: 0 0 0 1px !important; border-left-style: dotted !important; border-left-color: #000 !important; padding: 0 1px 0 0 !important; } .fc-event-vert .fc-event-inner { border-width: 0 !important; padding: 1px 0 !important; } .fc-event-bg { display: none !important; } .fc-event .ui-resizable-handle { display: none !important; }
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/fullcalendar/fullcalendar.print.css
CSS
gpl2
1,337
/* * FullCalendar v1.5.3 Google Calendar Plugin * * Copyright (c) 2011 Adam Shaw * Dual licensed under the MIT and GPL licenses, located in * MIT-LICENSE.txt and GPL-LICENSE.txt respectively. * * Date: Mon Feb 6 22:40:40 2012 -0800 * */ (function($) { var fc = $.fullCalendar; var formatDate = fc.formatDate; var parseISO8601 = fc.parseISO8601; var addDays = fc.addDays; var applyAll = fc.applyAll; fc.sourceNormalizers.push(function(sourceOptions) { if (sourceOptions.dataType == 'gcal' || sourceOptions.dataType === undefined && (sourceOptions.url || '').match(/^(http|https):\/\/www.google.com\/calendar\/feeds\//)) { sourceOptions.dataType = 'gcal'; if (sourceOptions.editable === undefined) { sourceOptions.editable = false; } } }); fc.sourceFetchers.push(function(sourceOptions, start, end) { if (sourceOptions.dataType == 'gcal') { return transformOptions(sourceOptions, start, end); } }); function transformOptions(sourceOptions, start, end) { var success = sourceOptions.success; var data = $.extend({}, sourceOptions.data || {}, { 'start-min': formatDate(start, 'u'), 'start-max': formatDate(end, 'u'), 'singleevents': true, 'max-results': 9999 }); var ctz = sourceOptions.currentTimezone; if (ctz) { data.ctz = ctz = ctz.replace(' ', '_'); } return $.extend({}, sourceOptions, { url: sourceOptions.url.replace(/\/basic$/, '/full') + '?alt=json-in-script&callback=?', dataType: 'jsonp', data: data, startParam: false, endParam: false, success: function(data) { var events = []; if (data.feed.entry) { $.each(data.feed.entry, function(i, entry) { var startStr = entry['gd$when'][0]['startTime']; var start = parseISO8601(startStr, true); var end = parseISO8601(entry['gd$when'][0]['endTime'], true); var allDay = startStr.indexOf('T') == -1; var url; $.each(entry.link, function(i, link) { if (link.type == 'text/html') { url = link.href; if (ctz) { url += (url.indexOf('?') == -1 ? '?' : '&') + 'ctz=' + ctz; } } }); if (allDay) { addDays(end, -1); // make inclusive } events.push({ id: entry['gCal$uid']['value'], title: entry['title']['$t'], url: url, start: start, end: end, allDay: allDay, location: entry['gd$where'][0]['valueString'], description: entry['content']['$t'] }); }); } var args = [events].concat(Array.prototype.slice.call(arguments, 1)); var res = applyAll(success, this, args); if ($.isArray(res)) { return res; } return events; } }); } // legacy fc.gcalFeed = function(url, sourceOptions) { return $.extend({}, sourceOptions, { url: url, dataType: 'gcal' }); }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/fullcalendar/gcal.js
JavaScript
gpl2
2,777
/* * FullCalendar v1.5.3 Stylesheet * * Copyright (c) 2011 Adam Shaw * Dual licensed under the MIT and GPL licenses, located in * MIT-LICENSE.txt and GPL-LICENSE.txt respectively. * * Date: Mon Feb 6 22:40:40 2012 -0800 * */ .fc { direction: ltr; text-align: left; } .fc table { border-collapse: collapse; border-spacing: 0; } html .fc, .fc table { font-size: 1em; } .fc td, .fc th { padding: 0; vertical-align: top; } /* Header ------------------------------------------------------------------------*/ .fc-header td { white-space: nowrap; } .fc-header-left { width: 25%; text-align: left; } .fc-header-center { text-align: center; } .fc-header-right { width: 25%; text-align: right; } .fc-header-title { display: inline-block; vertical-align: top; } .fc-header-title h2 { margin-top: 0; white-space: nowrap; } .fc .fc-header-space { padding-left: 10px; } .fc-header .fc-button { margin-bottom: 1em; vertical-align: top; } /* buttons edges butting together */ .fc-header .fc-button { margin-right: -1px; } .fc-header .fc-corner-right { margin-right: 1px; /* back to normal */ } .fc-header .ui-corner-right { margin-right: 0; /* back to normal */ } /* button layering (for border precedence) */ .fc-header .fc-state-hover, .fc-header .ui-state-hover { z-index: 2; } .fc-header .fc-state-down { z-index: 3; } .fc-header .fc-state-active, .fc-header .ui-state-active { z-index: 4; } /* Content ------------------------------------------------------------------------*/ .fc-content { clear: both; } .fc-view { width: 100%; /* needed for view switching (when view is absolute) */ overflow: hidden; } /* Cell Styles ------------------------------------------------------------------------*/ .fc-widget-header, /* <th>, usually */ .fc-widget-content { /* <td>, usually */ border: 1px solid #ccc; } .fc-state-highlight { /* <td> today cell */ /* TODO: add .fc-today to <th> */ background: #ffc; } .fc-cell-overlay { /* semi-transparent rectangle while dragging */ background: #9cf; opacity: .2; filter: alpha(opacity=20); /* for IE */ } /* Buttons ------------------------------------------------------------------------*/ .fc-button { position: relative; display: inline-block; cursor: pointer; } .fc-state-default { /* non-theme */ border-style: solid; border-width: 1px 0; } .fc-button-inner { position: relative; float: left; overflow: hidden; } .fc-state-default .fc-button-inner { /* non-theme */ border-style: solid; border-width: 0 1px; } .fc-button-content { position: relative; float: left; height: 1.9em; line-height: 1.9em; padding: 0 .6em; white-space: nowrap; } /* icon (for jquery ui) */ .fc-button-content .fc-icon-wrap { position: relative; float: left; top: 50%; } .fc-button-content .ui-icon { position: relative; float: left; margin-top: -50%; *margin-top: 0; *top: -50%; } /* gloss effect */ .fc-state-default .fc-button-effect { position: absolute; top: 50%; left: 0; } .fc-state-default .fc-button-effect span { position: absolute; top: -100px; left: 0; width: 500px; height: 100px; border-width: 100px 0 0 1px; border-style: solid; border-color: #fff; background: #444; opacity: .09; filter: alpha(opacity=9); } /* button states (determines colors) */ .fc-state-default, .fc-state-default .fc-button-inner { border-style: solid; border-color: #ccc #bbb #aaa; background: #F3F3F3; color: #000; } .fc-state-hover, .fc-state-hover .fc-button-inner { border-color: #999; } .fc-state-down, .fc-state-down .fc-button-inner { border-color: #555; background: #777; } .fc-state-active, .fc-state-active .fc-button-inner { border-color: #555; background: #777; color: #fff; } .fc-state-disabled, .fc-state-disabled .fc-button-inner { color: #999; border-color: #ddd; } .fc-state-disabled { cursor: default; } .fc-state-disabled .fc-button-effect { display: none; } /* Global Event Styles ------------------------------------------------------------------------*/ .fc-event { border-style: solid; border-width: 0; font-size: .85em; cursor: default; } a.fc-event, .fc-event-draggable { cursor: pointer; } a.fc-event { text-decoration: none; } .fc-rtl .fc-event { text-align: right; } .fc-event-skin { border-color: #36c; /* default BORDER color */ background-color: #36c; /* default BACKGROUND color */ color: #fff; /* default TEXT color */ } .fc-event-inner { position: relative; width: 100%; height: 100%; border-style: solid; border-width: 0; overflow: hidden; } .fc-event-time, .fc-event-title { padding: 0 1px; } .fc .ui-resizable-handle { /*** TODO: don't use ui-resizable anymore, change class ***/ display: block; position: absolute; z-index: 99999; overflow: hidden; /* hacky spaces (IE6/7) */ font-size: 300%; /* */ line-height: 50%; /* */ } /* Horizontal Events ------------------------------------------------------------------------*/ .fc-event-hori { border-width: 1px 0; margin-bottom: 1px; } /* resizable */ .fc-event-hori .ui-resizable-e { top: 0 !important; /* importants override pre jquery ui 1.7 styles */ right: -3px !important; width: 7px !important; height: 100% !important; cursor: e-resize; } .fc-event-hori .ui-resizable-w { top: 0 !important; left: -3px !important; width: 7px !important; height: 100% !important; cursor: w-resize; } .fc-event-hori .ui-resizable-handle { _padding-bottom: 14px; /* IE6 had 0 height */ } /* Fake Rounded Corners (for buttons and events) ------------------------------------------------------------*/ .fc-corner-left { margin-left: 1px; } .fc-corner-left .fc-button-inner, .fc-corner-left .fc-event-inner { margin-left: -1px; } .fc-corner-right { margin-right: 1px; } .fc-corner-right .fc-button-inner, .fc-corner-right .fc-event-inner { margin-right: -1px; } .fc-corner-top { margin-top: 1px; } .fc-corner-top .fc-event-inner { margin-top: -1px; } .fc-corner-bottom { margin-bottom: 1px; } .fc-corner-bottom .fc-event-inner { margin-bottom: -1px; } /* Fake Rounded Corners SPECIFICALLY FOR EVENTS -----------------------------------------------------------------*/ .fc-corner-left .fc-event-inner { border-left-width: 1px; } .fc-corner-right .fc-event-inner { border-right-width: 1px; } .fc-corner-top .fc-event-inner { border-top-width: 1px; } .fc-corner-bottom .fc-event-inner { border-bottom-width: 1px; } /* Reusable Separate-border Table ------------------------------------------------------------*/ table.fc-border-separate { border-collapse: separate; } .fc-border-separate th, .fc-border-separate td { border-width: 1px 0 0 1px; } .fc-border-separate th.fc-last, .fc-border-separate td.fc-last { border-right-width: 1px; } .fc-border-separate tr.fc-last th, .fc-border-separate tr.fc-last td { border-bottom-width: 1px; } .fc-border-separate tbody tr.fc-first td, .fc-border-separate tbody tr.fc-first th { border-top-width: 0; } /* Month View, Basic Week View, Basic Day View ------------------------------------------------------------------------*/ .fc-grid th { text-align: center; } .fc-grid .fc-day-number { float: right; padding: 0 2px; } .fc-grid .fc-other-month .fc-day-number { opacity: 0.3; filter: alpha(opacity=30); /* for IE */ /* opacity with small font can sometimes look too faded might want to set the 'color' property instead making day-numbers bold also fixes the problem */ } .fc-grid .fc-day-content { clear: both; padding: 2px 2px 1px; /* distance between events and day edges */ } /* event styles */ .fc-grid .fc-event-time { font-weight: bold; } /* right-to-left */ .fc-rtl .fc-grid .fc-day-number { float: left; } .fc-rtl .fc-grid .fc-event-time { float: right; } /* Agenda Week View, Agenda Day View ------------------------------------------------------------------------*/ .fc-agenda table { border-collapse: separate; } .fc-agenda-days th { text-align: center; } .fc-agenda .fc-agenda-axis { width: 50px; padding: 0 4px; vertical-align: middle; text-align: right; white-space: nowrap; font-weight: normal; } .fc-agenda .fc-day-content { padding: 2px 2px 1px; } /* make axis border take precedence */ .fc-agenda-days .fc-agenda-axis { border-right-width: 1px; } .fc-agenda-days .fc-col0 { border-left-width: 0; } /* all-day area */ .fc-agenda-allday th { border-width: 0 1px; } .fc-agenda-allday .fc-day-content { min-height: 34px; /* TODO: doesnt work well in quirksmode */ _height: 34px; } /* divider (between all-day and slots) */ .fc-agenda-divider-inner { height: 2px; overflow: hidden; } .fc-widget-header .fc-agenda-divider-inner { background: #eee; } /* slot rows */ .fc-agenda-slots th { border-width: 1px 1px 0; } .fc-agenda-slots td { border-width: 1px 0 0; background: none; } .fc-agenda-slots td div { height: 20px; } .fc-agenda-slots tr.fc-slot0 th, .fc-agenda-slots tr.fc-slot0 td { border-top-width: 0; } .fc-agenda-slots tr.fc-minor th, .fc-agenda-slots tr.fc-minor td { border-top-style: dotted; } .fc-agenda-slots tr.fc-minor th.ui-widget-header { *border-top-style: solid; /* doesn't work with background in IE6/7 */ } /* Vertical Events ------------------------------------------------------------------------*/ .fc-event-vert { border-width: 0 1px; } .fc-event-vert .fc-event-head, .fc-event-vert .fc-event-content { position: relative; z-index: 2; width: 100%; overflow: hidden; } .fc-event-vert .fc-event-time { white-space: nowrap; font-size: 10px; } .fc-event-vert .fc-event-bg { /* makes the event lighter w/ a semi-transparent overlay */ position: absolute; z-index: 1; top: 0; left: 0; width: 100%; height: 100%; background: #fff; opacity: .3; filter: alpha(opacity=30); } .fc .ui-draggable-dragging .fc-event-bg, /* TODO: something nicer like .fc-opacity */ .fc-select-helper .fc-event-bg { display: none\9; /* for IE6/7/8. nested opacity filters while dragging don't work */ } /* resizable */ .fc-event-vert .ui-resizable-s { bottom: 0 !important; /* importants override pre jquery ui 1.7 styles */ width: 100% !important; height: 8px !important; overflow: hidden !important; line-height: 8px !important; font-size: 11px !important; font-family: monospace; text-align: center; cursor: s-resize; } .fc-agenda .ui-resizable-resizing { /* TODO: better selector */ _overflow: hidden; }
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/fullcalendar/fullcalendar.css
CSS
gpl2
10,699
/** * @preserve * FullCalendar v1.5.3 * http://arshaw.com/fullcalendar/ * * Use fullcalendar.css for basic styling. * For event drag & drop, requires jQuery UI draggable. * For event resizing, requires jQuery UI resizable. * * Copyright (c) 2011 Adam Shaw * Dual licensed under the MIT and GPL licenses, located in * MIT-LICENSE.txt and GPL-LICENSE.txt respectively. * * Date: Mon Feb 6 22:40:40 2012 -0800 * */ (function($, undefined) { var defaults = { // display defaultView: 'month', aspectRatio: 1.35, header: { left: 'title', center: '', right: 'today prev,next' }, weekends: true, // editing //editable: false, //disableDragging: false, //disableResizing: false, allDayDefault: true, ignoreTimezone: true, // event ajax lazyFetching: true, startParam: 'start', endParam: 'end', // time formats titleFormat: { month: 'MMMM yyyy', week: "MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}", day: 'dddd, MMM d, yyyy' }, columnFormat: { month: 'ddd', week: 'ddd M/d', day: 'dddd M/d' }, timeFormat: { // for event elements '': 'h(:mm)t' // default }, // locale isRTL: false, firstDay: 0, monthNames: ['January','February','March','April','May','June','July','August','September','October','November','December'], monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'], dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'], buttonText: { prev: '&nbsp;&#9668;&nbsp;', next: '&nbsp;&#9658;&nbsp;', prevYear: '&nbsp;&lt;&lt;&nbsp;', nextYear: '&nbsp;&gt;&gt;&nbsp;', today: 'today', month: 'month', week: 'week', day: 'day' }, // jquery-ui theming theme: false, buttonIcons: { prev: 'circle-triangle-w', next: 'circle-triangle-e' }, //selectable: false, unselectAuto: true, dropAccept: '*' }; // right-to-left defaults var rtlDefaults = { header: { left: 'next,prev today', center: '', right: 'title' }, buttonText: { prev: '&nbsp;&#9658;&nbsp;', next: '&nbsp;&#9668;&nbsp;', prevYear: '&nbsp;&gt;&gt;&nbsp;', nextYear: '&nbsp;&lt;&lt;&nbsp;' }, buttonIcons: { prev: 'circle-triangle-e', next: 'circle-triangle-w' } }; var fc = $.fullCalendar = { version: "1.5.3" }; var fcViews = fc.views = {}; $.fn.fullCalendar = function(options) { // method calling if (typeof options == 'string') { var args = Array.prototype.slice.call(arguments, 1); var res; this.each(function() { var calendar = $.data(this, 'fullCalendar'); if (calendar && $.isFunction(calendar[options])) { var r = calendar[options].apply(calendar, args); if (res === undefined) { res = r; } if (options == 'destroy') { $.removeData(this, 'fullCalendar'); } } }); if (res !== undefined) { return res; } return this; } // would like to have this logic in EventManager, but needs to happen before options are recursively extended var eventSources = options.eventSources || []; delete options.eventSources; if (options.events) { eventSources.push(options.events); delete options.events; } options = $.extend(true, {}, defaults, (options.isRTL || options.isRTL===undefined && defaults.isRTL) ? rtlDefaults : {}, options ); this.each(function(i, _element) { var element = $(_element); var calendar = new Calendar(element, options, eventSources); element.data('fullCalendar', calendar); // TODO: look into memory leak implications calendar.render(); }); return this; }; // function for adding/overriding defaults function setDefaults(d) { $.extend(true, defaults, d); } function Calendar(element, options, eventSources) { var t = this; // exports t.options = options; t.render = render; t.destroy = destroy; t.refetchEvents = refetchEvents; t.reportEvents = reportEvents; t.reportEventChange = reportEventChange; t.rerenderEvents = rerenderEvents; t.changeView = changeView; t.select = select; t.unselect = unselect; t.prev = prev; t.next = next; t.prevYear = prevYear; t.nextYear = nextYear; t.today = today; t.gotoDate = gotoDate; t.incrementDate = incrementDate; t.formatDate = function(format, date) { return formatDate(format, date, options) }; t.formatDates = function(format, date1, date2) { return formatDates(format, date1, date2, options) }; t.getDate = getDate; t.getView = getView; t.option = option; t.trigger = trigger; // imports EventManager.call(t, options, eventSources); var isFetchNeeded = t.isFetchNeeded; var fetchEvents = t.fetchEvents; // locals var _element = element[0]; var header; var headerElement; var content; var tm; // for making theme classes var currentView; var viewInstances = {}; var elementOuterWidth; var suggestedViewHeight; var absoluteViewElement; var resizeUID = 0; var ignoreWindowResize = 0; var date = new Date(); var events = []; var _dragElement; /* Main Rendering -----------------------------------------------------------------------------*/ setYMD(date, options.year, options.month, options.date); function render(inc) { if (!content) { initialRender(); }else{ calcSize(); markSizesDirty(); markEventsDirty(); renderView(inc); } } function initialRender() { tm = options.theme ? 'ui' : 'fc'; element.addClass('fc'); if (options.isRTL) { element.addClass('fc-rtl'); } if (options.theme) { element.addClass('ui-widget'); } content = $("<div class='fc-content' style='position:relative'/>") .prependTo(element); header = new Header(t, options); headerElement = header.render(); if (headerElement) { element.prepend(headerElement); } changeView(options.defaultView); $(window).resize(windowResize); // needed for IE in a 0x0 iframe, b/c when it is resized, never triggers a windowResize if (!bodyVisible()) { lateRender(); } } // called when we know the calendar couldn't be rendered when it was initialized, // but we think it's ready now function lateRender() { setTimeout(function() { // IE7 needs this so dimensions are calculated correctly if (!currentView.start && bodyVisible()) { // !currentView.start makes sure this never happens more than once renderView(); } },0); } function destroy() { $(window).unbind('resize', windowResize); header.destroy(); content.remove(); element.removeClass('fc fc-rtl ui-widget'); } function elementVisible() { return _element.offsetWidth !== 0; } function bodyVisible() { return $('body')[0].offsetWidth !== 0; } /* View Rendering -----------------------------------------------------------------------------*/ // TODO: improve view switching (still weird transition in IE, and FF has whiteout problem) function changeView(newViewName) { if (!currentView || newViewName != currentView.name) { ignoreWindowResize++; // because setMinHeight might change the height before render (and subsequently setSize) is reached unselect(); var oldView = currentView; var newViewElement; if (oldView) { (oldView.beforeHide || noop)(); // called before changing min-height. if called after, scroll state is reset (in Opera) setMinHeight(content, content.height()); oldView.element.hide(); }else{ setMinHeight(content, 1); // needs to be 1 (not 0) for IE7, or else view dimensions miscalculated } content.css('overflow', 'hidden'); currentView = viewInstances[newViewName]; if (currentView) { currentView.element.show(); }else{ currentView = viewInstances[newViewName] = new fcViews[newViewName]( newViewElement = absoluteViewElement = $("<div class='fc-view fc-view-" + newViewName + "' style='position:absolute'/>") .appendTo(content), t // the calendar object ); } if (oldView) { header.deactivateButton(oldView.name); } header.activateButton(newViewName); renderView(); // after height has been set, will make absoluteViewElement's position=relative, then set to null content.css('overflow', ''); if (oldView) { setMinHeight(content, 1); } if (!newViewElement) { (currentView.afterShow || noop)(); // called after setting min-height/overflow, so in final scroll state (for Opera) } ignoreWindowResize--; } } function renderView(inc) { if (elementVisible()) { ignoreWindowResize++; // because renderEvents might temporarily change the height before setSize is reached unselect(); if (suggestedViewHeight === undefined) { calcSize(); } var forceEventRender = false; if (!currentView.start || inc || date < currentView.start || date >= currentView.end) { // view must render an entire new date range (and refetch/render events) currentView.render(date, inc || 0); // responsible for clearing events setSize(true); forceEventRender = true; } else if (currentView.sizeDirty) { // view must resize (and rerender events) currentView.clearEvents(); setSize(); forceEventRender = true; } else if (currentView.eventsDirty) { currentView.clearEvents(); forceEventRender = true; } currentView.sizeDirty = false; currentView.eventsDirty = false; updateEvents(forceEventRender); elementOuterWidth = element.outerWidth(); header.updateTitle(currentView.title); var today = new Date(); if (today >= currentView.start && today < currentView.end) { header.disableButton('today'); }else{ header.enableButton('today'); } ignoreWindowResize--; currentView.trigger('viewDisplay', _element); } } /* Resizing -----------------------------------------------------------------------------*/ function updateSize() { markSizesDirty(); if (elementVisible()) { calcSize(); setSize(); unselect(); currentView.clearEvents(); currentView.renderEvents(events); currentView.sizeDirty = false; } } function markSizesDirty() { $.each(viewInstances, function(i, inst) { inst.sizeDirty = true; }); } function calcSize() { if (options.contentHeight) { suggestedViewHeight = options.contentHeight; } else if (options.height) { suggestedViewHeight = options.height - (headerElement ? headerElement.height() : 0) - vsides(content); } else { suggestedViewHeight = Math.round(content.width() / Math.max(options.aspectRatio, .5)); } } function setSize(dateChanged) { // todo: dateChanged? ignoreWindowResize++; currentView.setHeight(suggestedViewHeight, dateChanged); if (absoluteViewElement) { absoluteViewElement.css('position', 'relative'); absoluteViewElement = null; } currentView.setWidth(content.width(), dateChanged); ignoreWindowResize--; } function windowResize() { if (!ignoreWindowResize) { if (currentView.start) { // view has already been rendered var uid = ++resizeUID; setTimeout(function() { // add a delay if (uid == resizeUID && !ignoreWindowResize && elementVisible()) { if (elementOuterWidth != (elementOuterWidth = element.outerWidth())) { ignoreWindowResize++; // in case the windowResize callback changes the height updateSize(); currentView.trigger('windowResize', _element); ignoreWindowResize--; } } }, 200); }else{ // calendar must have been initialized in a 0x0 iframe that has just been resized lateRender(); } } } /* Event Fetching/Rendering -----------------------------------------------------------------------------*/ // fetches events if necessary, rerenders events if necessary (or if forced) function updateEvents(forceRender) { if (!options.lazyFetching || isFetchNeeded(currentView.visStart, currentView.visEnd)) { refetchEvents(); } else if (forceRender) { rerenderEvents(); } } function refetchEvents() { fetchEvents(currentView.visStart, currentView.visEnd); // will call reportEvents } // called when event data arrives function reportEvents(_events) { events = _events; rerenderEvents(); } // called when a single event's data has been changed function reportEventChange(eventID) { rerenderEvents(eventID); } // attempts to rerenderEvents function rerenderEvents(modifiedEventID) { markEventsDirty(); if (elementVisible()) { currentView.clearEvents(); currentView.renderEvents(events, modifiedEventID); currentView.eventsDirty = false; } } function markEventsDirty() { $.each(viewInstances, function(i, inst) { inst.eventsDirty = true; }); } /* Selection -----------------------------------------------------------------------------*/ function select(start, end, allDay) { currentView.select(start, end, allDay===undefined ? true : allDay); } function unselect() { // safe to be called before renderView if (currentView) { currentView.unselect(); } } /* Date -----------------------------------------------------------------------------*/ function prev() { renderView(-1); } function next() { renderView(1); } function prevYear() { addYears(date, -1); renderView(); } function nextYear() { addYears(date, 1); renderView(); } function today() { date = new Date(); renderView(); } function gotoDate(year, month, dateOfMonth) { if (year instanceof Date) { date = cloneDate(year); // provided 1 argument, a Date }else{ setYMD(date, year, month, dateOfMonth); } renderView(); } function incrementDate(years, months, days) { if (years !== undefined) { addYears(date, years); } if (months !== undefined) { addMonths(date, months); } if (days !== undefined) { addDays(date, days); } renderView(); } function getDate() { return cloneDate(date); } /* Misc -----------------------------------------------------------------------------*/ function getView() { return currentView; } function option(name, value) { if (value === undefined) { return options[name]; } if (name == 'height' || name == 'contentHeight' || name == 'aspectRatio') { options[name] = value; updateSize(); } } function trigger(name, thisObj) { if (options[name]) { return options[name].apply( thisObj || _element, Array.prototype.slice.call(arguments, 2) ); } } /* External Dragging ------------------------------------------------------------------------*/ if (options.droppable) { $(document) .bind('dragstart', function(ev, ui) { var _e = ev.target; var e = $(_e); if (!e.parents('.fc').length) { // not already inside a calendar var accept = options.dropAccept; if ($.isFunction(accept) ? accept.call(_e, e) : e.is(accept)) { _dragElement = _e; currentView.dragStart(_dragElement, ev, ui); } } }) .bind('dragstop', function(ev, ui) { if (_dragElement) { currentView.dragStop(_dragElement, ev, ui); _dragElement = null; } }); } } function Header(calendar, options) { var t = this; // exports t.render = render; t.destroy = destroy; t.updateTitle = updateTitle; t.activateButton = activateButton; t.deactivateButton = deactivateButton; t.disableButton = disableButton; t.enableButton = enableButton; // locals var element = $([]); var tm; function render() { tm = options.theme ? 'ui' : 'fc'; var sections = options.header; if (sections) { element = $("<table class='fc-header' style='width:100%'/>") .append( $("<tr/>") .append(renderSection('left')) .append(renderSection('center')) .append(renderSection('right')) ); return element; } } function destroy() { element.remove(); } function renderSection(position) { var e = $("<td class='fc-header-" + position + "'/>"); var buttonStr = options.header[position]; if (buttonStr) { $.each(buttonStr.split(' '), function(i) { if (i > 0) { e.append("<span class='fc-header-space'/>"); } var prevButton; $.each(this.split(','), function(j, buttonName) { if (buttonName == 'title') { e.append("<span class='fc-header-title'><h2>&nbsp;</h2></span>"); if (prevButton) { prevButton.addClass(tm + '-corner-right'); } prevButton = null; }else{ var buttonClick; if (calendar[buttonName]) { buttonClick = calendar[buttonName]; // calendar method } else if (fcViews[buttonName]) { buttonClick = function() { button.removeClass(tm + '-state-hover'); // forget why calendar.changeView(buttonName); }; } if (buttonClick) { var icon = options.theme ? smartProperty(options.buttonIcons, buttonName) : null; // why are we using smartProperty here? var text = smartProperty(options.buttonText, buttonName); // why are we using smartProperty here? var button = $( "<span class='fc-button fc-button-" + buttonName + " " + tm + "-state-default'>" + "<span class='fc-button-inner'>" + "<span class='fc-button-content'>" + (icon ? "<span class='fc-icon-wrap'>" + "<span class='ui-icon ui-icon-" + icon + "'/>" + "</span>" : text ) + "</span>" + "<span class='fc-button-effect'><span></span></span>" + "</span>" + "</span>" ); if (button) { button .click(function() { if (!button.hasClass(tm + '-state-disabled')) { buttonClick(); } }) .mousedown(function() { button .not('.' + tm + '-state-active') .not('.' + tm + '-state-disabled') .addClass(tm + '-state-down'); }) .mouseup(function() { button.removeClass(tm + '-state-down'); }) .hover( function() { button .not('.' + tm + '-state-active') .not('.' + tm + '-state-disabled') .addClass(tm + '-state-hover'); }, function() { button .removeClass(tm + '-state-hover') .removeClass(tm + '-state-down'); } ) .appendTo(e); if (!prevButton) { button.addClass(tm + '-corner-left'); } prevButton = button; } } } }); if (prevButton) { prevButton.addClass(tm + '-corner-right'); } }); } return e; } function updateTitle(html) { element.find('h2') .html(html); } function activateButton(buttonName) { element.find('span.fc-button-' + buttonName) .addClass(tm + '-state-active'); } function deactivateButton(buttonName) { element.find('span.fc-button-' + buttonName) .removeClass(tm + '-state-active'); } function disableButton(buttonName) { element.find('span.fc-button-' + buttonName) .addClass(tm + '-state-disabled'); } function enableButton(buttonName) { element.find('span.fc-button-' + buttonName) .removeClass(tm + '-state-disabled'); } } fc.sourceNormalizers = []; fc.sourceFetchers = []; var ajaxDefaults = { dataType: 'json', cache: false }; var eventGUID = 1; function EventManager(options, _sources) { var t = this; // exports t.isFetchNeeded = isFetchNeeded; t.fetchEvents = fetchEvents; t.addEventSource = addEventSource; t.removeEventSource = removeEventSource; t.updateEvent = updateEvent; t.renderEvent = renderEvent; t.removeEvents = removeEvents; t.clientEvents = clientEvents; t.normalizeEvent = normalizeEvent; // imports var trigger = t.trigger; var getView = t.getView; var reportEvents = t.reportEvents; // locals var stickySource = { events: [] }; var sources = [ stickySource ]; var rangeStart, rangeEnd; var currentFetchID = 0; var pendingSourceCnt = 0; var loadingLevel = 0; var cache = []; for (var i=0; i<_sources.length; i++) { _addEventSource(_sources[i]); } /* Fetching -----------------------------------------------------------------------------*/ function isFetchNeeded(start, end) { return !rangeStart || start < rangeStart || end > rangeEnd; } function fetchEvents(start, end) { rangeStart = start; rangeEnd = end; cache = []; var fetchID = ++currentFetchID; var len = sources.length; pendingSourceCnt = len; for (var i=0; i<len; i++) { fetchEventSource(sources[i], fetchID); } } function fetchEventSource(source, fetchID) { _fetchEventSource(source, function(events) { if (fetchID == currentFetchID) { if (events) { for (var i=0; i<events.length; i++) { events[i].source = source; normalizeEvent(events[i]); } cache = cache.concat(events); } pendingSourceCnt--; if (!pendingSourceCnt) { reportEvents(cache); } } }); } function _fetchEventSource(source, callback) { var i; var fetchers = fc.sourceFetchers; var res; for (i=0; i<fetchers.length; i++) { res = fetchers[i](source, rangeStart, rangeEnd, callback); if (res === true) { // the fetcher is in charge. made its own async request return; } else if (typeof res == 'object') { // the fetcher returned a new source. process it _fetchEventSource(res, callback); return; } } var events = source.events; if (events) { if ($.isFunction(events)) { pushLoading(); events(cloneDate(rangeStart), cloneDate(rangeEnd), function(events) { callback(events); popLoading(); }); } else if ($.isArray(events)) { callback(events); } else { callback(); } }else{ var url = source.url; if (url) { var success = source.success; var error = source.error; var complete = source.complete; var data = $.extend({}, source.data || {}); var startParam = firstDefined(source.startParam, options.startParam); var endParam = firstDefined(source.endParam, options.endParam); if (startParam) { data[startParam] = Math.round(+rangeStart / 1000); } if (endParam) { data[endParam] = Math.round(+rangeEnd / 1000); } pushLoading(); $.ajax($.extend({}, ajaxDefaults, source, { data: data, success: function(events) { events = events || []; var res = applyAll(success, this, arguments); if ($.isArray(res)) { events = res; } callback(events); }, error: function() { applyAll(error, this, arguments); callback(); }, complete: function() { applyAll(complete, this, arguments); popLoading(); } })); }else{ callback(); } } } /* Sources -----------------------------------------------------------------------------*/ function addEventSource(source) { source = _addEventSource(source); if (source) { pendingSourceCnt++; fetchEventSource(source, currentFetchID); // will eventually call reportEvents } } function _addEventSource(source) { if ($.isFunction(source) || $.isArray(source)) { source = { events: source }; } else if (typeof source == 'string') { source = { url: source }; } if (typeof source == 'object') { normalizeSource(source); sources.push(source); return source; } } function removeEventSource(source) { sources = $.grep(sources, function(src) { return !isSourcesEqual(src, source); }); // remove all client events from that source cache = $.grep(cache, function(e) { return !isSourcesEqual(e.source, source); }); reportEvents(cache); } /* Manipulation -----------------------------------------------------------------------------*/ function updateEvent(event) { // update an existing event var i, len = cache.length, e, defaultEventEnd = getView().defaultEventEnd, // getView??? startDelta = event.start - event._start, endDelta = event.end ? (event.end - (event._end || defaultEventEnd(event))) // event._end would be null if event.end : 0; // was null and event was just resized for (i=0; i<len; i++) { e = cache[i]; if (e._id == event._id && e != event) { e.start = new Date(+e.start + startDelta); if (event.end) { if (e.end) { e.end = new Date(+e.end + endDelta); }else{ e.end = new Date(+defaultEventEnd(e) + endDelta); } }else{ e.end = null; } e.title = event.title; e.url = event.url; e.allDay = event.allDay; e.className = event.className; e.editable = event.editable; e.color = event.color; e.backgroudColor = event.backgroudColor; e.borderColor = event.borderColor; e.textColor = event.textColor; normalizeEvent(e); } } normalizeEvent(event); reportEvents(cache); } function renderEvent(event, stick) { normalizeEvent(event); if (!event.source) { if (stick) { stickySource.events.push(event); event.source = stickySource; } cache.push(event); } reportEvents(cache); } function removeEvents(filter) { if (!filter) { // remove all cache = []; // clear all array sources for (var i=0; i<sources.length; i++) { if ($.isArray(sources[i].events)) { sources[i].events = []; } } }else{ if (!$.isFunction(filter)) { // an event ID var id = filter + ''; filter = function(e) { return e._id == id; }; } cache = $.grep(cache, filter, true); // remove events from array sources for (var i=0; i<sources.length; i++) { if ($.isArray(sources[i].events)) { sources[i].events = $.grep(sources[i].events, filter, true); } } } reportEvents(cache); } function clientEvents(filter) { if ($.isFunction(filter)) { return $.grep(cache, filter); } else if (filter) { // an event ID filter += ''; return $.grep(cache, function(e) { return e._id == filter; }); } return cache; // else, return all } /* Loading State -----------------------------------------------------------------------------*/ function pushLoading() { if (!loadingLevel++) { trigger('loading', null, true); } } function popLoading() { if (!--loadingLevel) { trigger('loading', null, false); } } /* Event Normalization -----------------------------------------------------------------------------*/ function normalizeEvent(event) { var source = event.source || {}; var ignoreTimezone = firstDefined(source.ignoreTimezone, options.ignoreTimezone); event._id = event._id || (event.id === undefined ? '_fc' + eventGUID++ : event.id + ''); if (event.date) { if (!event.start) { event.start = event.date; } delete event.date; } event._start = cloneDate(event.start = parseDate(event.start, ignoreTimezone)); event.end = parseDate(event.end, ignoreTimezone); if (event.end && event.end <= event.start) { event.end = null; } event._end = event.end ? cloneDate(event.end) : null; if (event.allDay === undefined) { event.allDay = firstDefined(source.allDayDefault, options.allDayDefault); } if (event.className) { if (typeof event.className == 'string') { event.className = event.className.split(/\s+/); } }else{ event.className = []; } // TODO: if there is no start date, return false to indicate an invalid event } /* Utils ------------------------------------------------------------------------------*/ function normalizeSource(source) { if (source.className) { // TODO: repeat code, same code for event classNames if (typeof source.className == 'string') { source.className = source.className.split(/\s+/); } }else{ source.className = []; } var normalizers = fc.sourceNormalizers; for (var i=0; i<normalizers.length; i++) { normalizers[i](source); } } function isSourcesEqual(source1, source2) { return source1 && source2 && getSourcePrimitive(source1) == getSourcePrimitive(source2); } function getSourcePrimitive(source) { return ((typeof source == 'object') ? (source.events || source.url) : '') || source; } } fc.addDays = addDays; fc.cloneDate = cloneDate; fc.parseDate = parseDate; fc.parseISO8601 = parseISO8601; fc.parseTime = parseTime; fc.formatDate = formatDate; fc.formatDates = formatDates; /* Date Math -----------------------------------------------------------------------------*/ var dayIDs = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'], DAY_MS = 86400000, HOUR_MS = 3600000, MINUTE_MS = 60000; function addYears(d, n, keepTime) { d.setFullYear(d.getFullYear() + n); if (!keepTime) { clearTime(d); } return d; } function addMonths(d, n, keepTime) { // prevents day overflow/underflow if (+d) { // prevent infinite looping on invalid dates var m = d.getMonth() + n, check = cloneDate(d); check.setDate(1); check.setMonth(m); d.setMonth(m); if (!keepTime) { clearTime(d); } while (d.getMonth() != check.getMonth()) { d.setDate(d.getDate() + (d < check ? 1 : -1)); } } return d; } function addDays(d, n, keepTime) { // deals with daylight savings if (+d) { var dd = d.getDate() + n, check = cloneDate(d); check.setHours(9); // set to middle of day check.setDate(dd); d.setDate(dd); if (!keepTime) { clearTime(d); } fixDate(d, check); } return d; } function fixDate(d, check) { // force d to be on check's YMD, for daylight savings purposes if (+d) { // prevent infinite looping on invalid dates while (d.getDate() != check.getDate()) { d.setTime(+d + (d < check ? 1 : -1) * HOUR_MS); } } } function addMinutes(d, n) { d.setMinutes(d.getMinutes() + n); return d; } function clearTime(d) { d.setHours(0); d.setMinutes(0); d.setSeconds(0); d.setMilliseconds(0); return d; } function cloneDate(d, dontKeepTime) { if (dontKeepTime) { return clearTime(new Date(+d)); } return new Date(+d); } function zeroDate() { // returns a Date with time 00:00:00 and dateOfMonth=1 var i=0, d; do { d = new Date(1970, i++, 1); } while (d.getHours()); // != 0 return d; } function skipWeekend(date, inc, excl) { inc = inc || 1; while (!date.getDay() || (excl && date.getDay()==1 || !excl && date.getDay()==6)) { addDays(date, inc); } return date; } function dayDiff(d1, d2) { // d1 - d2 return Math.round((cloneDate(d1, true) - cloneDate(d2, true)) / DAY_MS); } function setYMD(date, y, m, d) { if (y !== undefined && y != date.getFullYear()) { date.setDate(1); date.setMonth(0); date.setFullYear(y); } if (m !== undefined && m != date.getMonth()) { date.setDate(1); date.setMonth(m); } if (d !== undefined) { date.setDate(d); } } /* Date Parsing -----------------------------------------------------------------------------*/ function parseDate(s, ignoreTimezone) { // ignoreTimezone defaults to true if (typeof s == 'object') { // already a Date object return s; } if (typeof s == 'number') { // a UNIX timestamp return new Date(s * 1000); } if (typeof s == 'string') { if (s.match(/^\d+(\.\d+)?$/)) { // a UNIX timestamp return new Date(parseFloat(s) * 1000); } if (ignoreTimezone === undefined) { ignoreTimezone = true; } return parseISO8601(s, ignoreTimezone) || (s ? new Date(s) : null); } // TODO: never return invalid dates (like from new Date(<string>)), return null instead return null; } function parseISO8601(s, ignoreTimezone) { // ignoreTimezone defaults to false // derived from http://delete.me.uk/2005/03/iso8601.html // TODO: for a know glitch/feature, read tests/issue_206_parseDate_dst.html var m = s.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2})(:?([0-9]{2}))?))?)?)?)?$/); if (!m) { return null; } var date = new Date(m[1], 0, 1); if (ignoreTimezone || !m[13]) { var check = new Date(m[1], 0, 1, 9, 0); if (m[3]) { date.setMonth(m[3] - 1); check.setMonth(m[3] - 1); } if (m[5]) { date.setDate(m[5]); check.setDate(m[5]); } fixDate(date, check); if (m[7]) { date.setHours(m[7]); } if (m[8]) { date.setMinutes(m[8]); } if (m[10]) { date.setSeconds(m[10]); } if (m[12]) { date.setMilliseconds(Number("0." + m[12]) * 1000); } fixDate(date, check); }else{ date.setUTCFullYear( m[1], m[3] ? m[3] - 1 : 0, m[5] || 1 ); date.setUTCHours( m[7] || 0, m[8] || 0, m[10] || 0, m[12] ? Number("0." + m[12]) * 1000 : 0 ); if (m[14]) { var offset = Number(m[16]) * 60 + (m[18] ? Number(m[18]) : 0); offset *= m[15] == '-' ? 1 : -1; date = new Date(+date + (offset * 60 * 1000)); } } return date; } function parseTime(s) { // returns minutes since start of day if (typeof s == 'number') { // an hour return s * 60; } if (typeof s == 'object') { // a Date object return s.getHours() * 60 + s.getMinutes(); } var m = s.match(/(\d+)(?::(\d+))?\s*(\w+)?/); if (m) { var h = parseInt(m[1], 10); if (m[3]) { h %= 12; if (m[3].toLowerCase().charAt(0) == 'p') { h += 12; } } return h * 60 + (m[2] ? parseInt(m[2], 10) : 0); } } /* Date Formatting -----------------------------------------------------------------------------*/ // TODO: use same function formatDate(date, [date2], format, [options]) function formatDate(date, format, options) { return formatDates(date, null, format, options); } function formatDates(date1, date2, format, options) { options = options || defaults; var date = date1, otherDate = date2, i, len = format.length, c, i2, formatter, res = ''; for (i=0; i<len; i++) { c = format.charAt(i); if (c == "'") { for (i2=i+1; i2<len; i2++) { if (format.charAt(i2) == "'") { if (date) { if (i2 == i+1) { res += "'"; }else{ res += format.substring(i+1, i2); } i = i2; } break; } } } else if (c == '(') { for (i2=i+1; i2<len; i2++) { if (format.charAt(i2) == ')') { var subres = formatDate(date, format.substring(i+1, i2), options); if (parseInt(subres.replace(/\D/, ''), 10)) { res += subres; } i = i2; break; } } } else if (c == '[') { for (i2=i+1; i2<len; i2++) { if (format.charAt(i2) == ']') { var subformat = format.substring(i+1, i2); var subres = formatDate(date, subformat, options); if (subres != formatDate(otherDate, subformat, options)) { res += subres; } i = i2; break; } } } else if (c == '{') { date = date2; otherDate = date1; } else if (c == '}') { date = date1; otherDate = date2; } else { for (i2=len; i2>i; i2--) { if (formatter = dateFormatters[format.substring(i, i2)]) { if (date) { res += formatter(date, options); } i = i2 - 1; break; } } if (i2 == i) { if (date) { res += c; } } } } return res; }; var dateFormatters = { s : function(d) { return d.getSeconds() }, ss : function(d) { return zeroPad(d.getSeconds()) }, m : function(d) { return d.getMinutes() }, mm : function(d) { return zeroPad(d.getMinutes()) }, h : function(d) { return d.getHours() % 12 || 12 }, hh : function(d) { return zeroPad(d.getHours() % 12 || 12) }, H : function(d) { return d.getHours() }, HH : function(d) { return zeroPad(d.getHours()) }, d : function(d) { return d.getDate() }, dd : function(d) { return zeroPad(d.getDate()) }, ddd : function(d,o) { return o.dayNamesShort[d.getDay()] }, dddd: function(d,o) { return o.dayNames[d.getDay()] }, M : function(d) { return d.getMonth() + 1 }, MM : function(d) { return zeroPad(d.getMonth() + 1) }, MMM : function(d,o) { return o.monthNamesShort[d.getMonth()] }, MMMM: function(d,o) { return o.monthNames[d.getMonth()] }, yy : function(d) { return (d.getFullYear()+'').substring(2) }, yyyy: function(d) { return d.getFullYear() }, t : function(d) { return d.getHours() < 12 ? 'a' : 'p' }, tt : function(d) { return d.getHours() < 12 ? 'am' : 'pm' }, T : function(d) { return d.getHours() < 12 ? 'A' : 'P' }, TT : function(d) { return d.getHours() < 12 ? 'AM' : 'PM' }, u : function(d) { return formatDate(d, "yyyy-MM-dd'T'HH:mm:ss'Z'") }, S : function(d) { var date = d.getDate(); if (date > 10 && date < 20) { return 'th'; } return ['st', 'nd', 'rd'][date%10-1] || 'th'; } }; fc.applyAll = applyAll; /* Event Date Math -----------------------------------------------------------------------------*/ function exclEndDay(event) { if (event.end) { return _exclEndDay(event.end, event.allDay); }else{ return addDays(cloneDate(event.start), 1); } } function _exclEndDay(end, allDay) { end = cloneDate(end); return allDay || end.getHours() || end.getMinutes() ? addDays(end, 1) : clearTime(end); } function segCmp(a, b) { return (b.msLength - a.msLength) * 100 + (a.event.start - b.event.start); } function segsCollide(seg1, seg2) { return seg1.end > seg2.start && seg1.start < seg2.end; } /* Event Sorting -----------------------------------------------------------------------------*/ // event rendering utilities function sliceSegs(events, visEventEnds, start, end) { var segs = [], i, len=events.length, event, eventStart, eventEnd, segStart, segEnd, isStart, isEnd; for (i=0; i<len; i++) { event = events[i]; eventStart = event.start; eventEnd = visEventEnds[i]; if (eventEnd > start && eventStart < end) { if (eventStart < start) { segStart = cloneDate(start); isStart = false; }else{ segStart = eventStart; isStart = true; } if (eventEnd > end) { segEnd = cloneDate(end); isEnd = false; }else{ segEnd = eventEnd; isEnd = true; } segs.push({ event: event, start: segStart, end: segEnd, isStart: isStart, isEnd: isEnd, msLength: segEnd - segStart }); } } return segs.sort(segCmp); } // event rendering calculation utilities function stackSegs(segs) { var levels = [], i, len = segs.length, seg, j, collide, k; for (i=0; i<len; i++) { seg = segs[i]; j = 0; // the level index where seg should belong while (true) { collide = false; if (levels[j]) { for (k=0; k<levels[j].length; k++) { if (segsCollide(levels[j][k], seg)) { collide = true; break; } } } if (collide) { j++; }else{ break; } } if (levels[j]) { levels[j].push(seg); }else{ levels[j] = [seg]; } } return levels; } /* Event Element Binding -----------------------------------------------------------------------------*/ function lazySegBind(container, segs, bindHandlers) { container.unbind('mouseover').mouseover(function(ev) { var parent=ev.target, e, i, seg; while (parent != this) { e = parent; parent = parent.parentNode; } if ((i = e._fci) !== undefined) { e._fci = undefined; seg = segs[i]; bindHandlers(seg.event, seg.element, seg); $(ev.target).trigger(ev); } ev.stopPropagation(); }); } /* Element Dimensions -----------------------------------------------------------------------------*/ function setOuterWidth(element, width, includeMargins) { for (var i=0, e; i<element.length; i++) { e = $(element[i]); e.width(Math.max(0, width - hsides(e, includeMargins))); } } function setOuterHeight(element, height, includeMargins) { for (var i=0, e; i<element.length; i++) { e = $(element[i]); e.height(Math.max(0, height - vsides(e, includeMargins))); } } // TODO: curCSS has been deprecated (jQuery 1.4.3 - 10/16/2010) function hsides(element, includeMargins) { return hpadding(element) + hborders(element) + (includeMargins ? hmargins(element) : 0); } function hpadding(element) { return (parseFloat($.curCSS(element[0], 'paddingLeft', true)) || 0) + (parseFloat($.curCSS(element[0], 'paddingRight', true)) || 0); } function hmargins(element) { return (parseFloat($.curCSS(element[0], 'marginLeft', true)) || 0) + (parseFloat($.curCSS(element[0], 'marginRight', true)) || 0); } function hborders(element) { return (parseFloat($.curCSS(element[0], 'borderLeftWidth', true)) || 0) + (parseFloat($.curCSS(element[0], 'borderRightWidth', true)) || 0); } function vsides(element, includeMargins) { return vpadding(element) + vborders(element) + (includeMargins ? vmargins(element) : 0); } function vpadding(element) { return (parseFloat($.curCSS(element[0], 'paddingTop', true)) || 0) + (parseFloat($.curCSS(element[0], 'paddingBottom', true)) || 0); } function vmargins(element) { return (parseFloat($.curCSS(element[0], 'marginTop', true)) || 0) + (parseFloat($.curCSS(element[0], 'marginBottom', true)) || 0); } function vborders(element) { return (parseFloat($.curCSS(element[0], 'borderTopWidth', true)) || 0) + (parseFloat($.curCSS(element[0], 'borderBottomWidth', true)) || 0); } function setMinHeight(element, height) { height = (typeof height == 'number' ? height + 'px' : height); element.each(function(i, _element) { _element.style.cssText += ';min-height:' + height + ';_height:' + height; // why can't we just use .css() ? i forget }); } /* Misc Utils -----------------------------------------------------------------------------*/ //TODO: arraySlice //TODO: isFunction, grep ? function noop() { } function cmp(a, b) { return a - b; } function arrayMax(a) { return Math.max.apply(Math, a); } function zeroPad(n) { return (n < 10 ? '0' : '') + n; } function smartProperty(obj, name) { // get a camel-cased/namespaced property of an object if (obj[name] !== undefined) { return obj[name]; } var parts = name.split(/(?=[A-Z])/), i=parts.length-1, res; for (; i>=0; i--) { res = obj[parts[i].toLowerCase()]; if (res !== undefined) { return res; } } return obj['']; } function htmlEscape(s) { return s.replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/'/g, '&#039;') .replace(/"/g, '&quot;') .replace(/\n/g, '<br />'); } function cssKey(_element) { return _element.id + '/' + _element.className + '/' + _element.style.cssText.replace(/(^|;)\s*(top|left|width|height)\s*:[^;]*/ig, ''); } function disableTextSelection(element) { element .attr('unselectable', 'on') .css('MozUserSelect', 'none') .bind('selectstart.ui', function() { return false; }); } /* function enableTextSelection(element) { element .attr('unselectable', 'off') .css('MozUserSelect', '') .unbind('selectstart.ui'); } */ function markFirstLast(e) { e.children() .removeClass('fc-first fc-last') .filter(':first-child') .addClass('fc-first') .end() .filter(':last-child') .addClass('fc-last'); } function setDayID(cell, date) { cell.each(function(i, _cell) { _cell.className = _cell.className.replace(/^fc-\w*/, 'fc-' + dayIDs[date.getDay()]); // TODO: make a way that doesn't rely on order of classes }); } function getSkinCss(event, opt) { var source = event.source || {}; var eventColor = event.color; var sourceColor = source.color; var optionColor = opt('eventColor'); var backgroundColor = event.backgroundColor || eventColor || source.backgroundColor || sourceColor || opt('eventBackgroundColor') || optionColor; var borderColor = event.borderColor || eventColor || source.borderColor || sourceColor || opt('eventBorderColor') || optionColor; var textColor = event.textColor || source.textColor || opt('eventTextColor'); var statements = []; if (backgroundColor) { statements.push('background-color:' + backgroundColor); } if (borderColor) { statements.push('border-color:' + borderColor); } if (textColor) { statements.push('color:' + textColor); } return statements.join(';'); } function applyAll(functions, thisObj, args) { if ($.isFunction(functions)) { functions = [ functions ]; } if (functions) { var i; var ret; for (i=0; i<functions.length; i++) { ret = functions[i].apply(thisObj, args) || ret; } return ret; } } function firstDefined() { for (var i=0; i<arguments.length; i++) { if (arguments[i] !== undefined) { return arguments[i]; } } } fcViews.month = MonthView; function MonthView(element, calendar) { var t = this; // exports t.render = render; // imports BasicView.call(t, element, calendar, 'month'); var opt = t.opt; var renderBasic = t.renderBasic; var formatDate = calendar.formatDate; function render(date, delta) { if (delta) { addMonths(date, delta); date.setDate(1); } var start = cloneDate(date, true); start.setDate(1); var end = addMonths(cloneDate(start), 1); var visStart = cloneDate(start); var visEnd = cloneDate(end); var firstDay = opt('firstDay'); var nwe = opt('weekends') ? 0 : 1; if (nwe) { skipWeekend(visStart); skipWeekend(visEnd, -1, true); } addDays(visStart, -((visStart.getDay() - Math.max(firstDay, nwe) + 7) % 7)); addDays(visEnd, (7 - visEnd.getDay() + Math.max(firstDay, nwe)) % 7); var rowCnt = Math.round((visEnd - visStart) / (DAY_MS * 7)); if (opt('weekMode') == 'fixed') { addDays(visEnd, (6 - rowCnt) * 7); rowCnt = 6; } t.title = formatDate(start, opt('titleFormat')); t.start = start; t.end = end; t.visStart = visStart; t.visEnd = visEnd; renderBasic(6, rowCnt, nwe ? 5 : 7, true); } } fcViews.basicWeek = BasicWeekView; function BasicWeekView(element, calendar) { var t = this; // exports t.render = render; // imports BasicView.call(t, element, calendar, 'basicWeek'); var opt = t.opt; var renderBasic = t.renderBasic; var formatDates = calendar.formatDates; function render(date, delta) { if (delta) { addDays(date, delta * 7); } var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7)); var end = addDays(cloneDate(start), 7); var visStart = cloneDate(start); var visEnd = cloneDate(end); var weekends = opt('weekends'); if (!weekends) { skipWeekend(visStart); skipWeekend(visEnd, -1, true); } t.title = formatDates( visStart, addDays(cloneDate(visEnd), -1), opt('titleFormat') ); t.start = start; t.end = end; t.visStart = visStart; t.visEnd = visEnd; renderBasic(1, 1, weekends ? 7 : 5, false); } } fcViews.basicDay = BasicDayView; //TODO: when calendar's date starts out on a weekend, shouldn't happen function BasicDayView(element, calendar) { var t = this; // exports t.render = render; // imports BasicView.call(t, element, calendar, 'basicDay'); var opt = t.opt; var renderBasic = t.renderBasic; var formatDate = calendar.formatDate; function render(date, delta) { if (delta) { addDays(date, delta); if (!opt('weekends')) { skipWeekend(date, delta < 0 ? -1 : 1); } } t.title = formatDate(date, opt('titleFormat')); t.start = t.visStart = cloneDate(date, true); t.end = t.visEnd = addDays(cloneDate(t.start), 1); renderBasic(1, 1, 1, false); } } setDefaults({ weekMode: 'fixed' }); function BasicView(element, calendar, viewName) { var t = this; // exports t.renderBasic = renderBasic; t.setHeight = setHeight; t.setWidth = setWidth; t.renderDayOverlay = renderDayOverlay; t.defaultSelectionEnd = defaultSelectionEnd; t.renderSelection = renderSelection; t.clearSelection = clearSelection; t.reportDayClick = reportDayClick; // for selection (kinda hacky) t.dragStart = dragStart; t.dragStop = dragStop; t.defaultEventEnd = defaultEventEnd; t.getHoverListener = function() { return hoverListener }; t.colContentLeft = colContentLeft; t.colContentRight = colContentRight; t.dayOfWeekCol = dayOfWeekCol; t.dateCell = dateCell; t.cellDate = cellDate; t.cellIsAllDay = function() { return true }; t.allDayRow = allDayRow; t.allDayBounds = allDayBounds; t.getRowCnt = function() { return rowCnt }; t.getColCnt = function() { return colCnt }; t.getColWidth = function() { return colWidth }; t.getDaySegmentContainer = function() { return daySegmentContainer }; // imports View.call(t, element, calendar, viewName); OverlayManager.call(t); SelectionManager.call(t); BasicEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; var clearEvents = t.clearEvents; var renderOverlay = t.renderOverlay; var clearOverlays = t.clearOverlays; var daySelectionMousedown = t.daySelectionMousedown; var formatDate = calendar.formatDate; // locals var head; var headCells; var body; var bodyRows; var bodyCells; var bodyFirstCells; var bodyCellTopInners; var daySegmentContainer; var viewWidth; var viewHeight; var colWidth; var rowCnt, colCnt; var coordinateGrid; var hoverListener; var colContentPositions; var rtl, dis, dit; var firstDay; var nwe; var tm; var colFormat; /* Rendering ------------------------------------------------------------*/ disableTextSelection(element.addClass('fc-grid')); function renderBasic(maxr, r, c, showNumbers) { rowCnt = r; colCnt = c; updateOptions(); var firstTime = !body; if (firstTime) { buildSkeleton(maxr, showNumbers); }else{ clearEvents(); } updateCells(firstTime); } function updateOptions() { rtl = opt('isRTL'); if (rtl) { dis = -1; dit = colCnt - 1; }else{ dis = 1; dit = 0; } firstDay = opt('firstDay'); nwe = opt('weekends') ? 0 : 1; tm = opt('theme') ? 'ui' : 'fc'; colFormat = opt('columnFormat'); } function buildSkeleton(maxRowCnt, showNumbers) { var s; var headerClass = tm + "-widget-header"; var contentClass = tm + "-widget-content"; var i, j; var table; s = "<table class='fc-border-separate' style='width:100%' cellspacing='0'>" + "<thead>" + "<tr>"; for (i=0; i<colCnt; i++) { s += "<th class='fc- " + headerClass + "'/>"; // need fc- for setDayID } s += "</tr>" + "</thead>" + "<tbody>"; for (i=0; i<maxRowCnt; i++) { s += "<tr class='fc-week" + i + "'>"; for (j=0; j<colCnt; j++) { s += "<td class='fc- " + contentClass + " fc-day" + (i*colCnt+j) + "'>" + // need fc- for setDayID "<div>" + (showNumbers ? "<div class='fc-day-number'/>" : '' ) + "<div class='fc-day-content'>" + "<div style='position:relative'>&nbsp;</div>" + "</div>" + "</div>" + "</td>"; } s += "</tr>"; } s += "</tbody>" + "</table>"; table = $(s).appendTo(element); head = table.find('thead'); headCells = head.find('th'); body = table.find('tbody'); bodyRows = body.find('tr'); bodyCells = body.find('td'); bodyFirstCells = bodyCells.filter(':first-child'); bodyCellTopInners = bodyRows.eq(0).find('div.fc-day-content div'); markFirstLast(head.add(head.find('tr'))); // marks first+last tr/th's markFirstLast(bodyRows); // marks first+last td's bodyRows.eq(0).addClass('fc-first'); // fc-last is done in updateCells dayBind(bodyCells); daySegmentContainer = $("<div style='position:absolute;z-index:8;top:0;left:0'/>") .appendTo(element); } function updateCells(firstTime) { var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating? var month = t.start.getMonth(); var today = clearTime(new Date()); var cell; var date; var row; if (dowDirty) { headCells.each(function(i, _cell) { cell = $(_cell); date = indexDate(i); cell.html(formatDate(date, colFormat)); setDayID(cell, date); }); } bodyCells.each(function(i, _cell) { cell = $(_cell); date = indexDate(i); if (date.getMonth() == month) { cell.removeClass('fc-other-month'); }else{ cell.addClass('fc-other-month'); } if (+date == +today) { cell.addClass(tm + '-state-highlight fc-today'); }else{ cell.removeClass(tm + '-state-highlight fc-today'); } cell.find('div.fc-day-number').text(date.getDate()); if (dowDirty) { setDayID(cell, date); } }); bodyRows.each(function(i, _row) { row = $(_row); if (i < rowCnt) { row.show(); if (i == rowCnt-1) { row.addClass('fc-last'); }else{ row.removeClass('fc-last'); } }else{ row.hide(); } }); } function setHeight(height) { viewHeight = height; var bodyHeight = viewHeight - head.height(); var rowHeight; var rowHeightLast; var cell; if (opt('weekMode') == 'variable') { rowHeight = rowHeightLast = Math.floor(bodyHeight / (rowCnt==1 ? 2 : 6)); }else{ rowHeight = Math.floor(bodyHeight / rowCnt); rowHeightLast = bodyHeight - rowHeight * (rowCnt-1); } bodyFirstCells.each(function(i, _cell) { if (i < rowCnt) { cell = $(_cell); setMinHeight( cell.find('> div'), (i==rowCnt-1 ? rowHeightLast : rowHeight) - vsides(cell) ); } }); } function setWidth(width) { viewWidth = width; colContentPositions.clear(); colWidth = Math.floor(viewWidth / colCnt); setOuterWidth(headCells.slice(0, -1), colWidth); } /* Day clicking and binding -----------------------------------------------------------*/ function dayBind(days) { days.click(dayClick) .mousedown(daySelectionMousedown); } function dayClick(ev) { if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick var index = parseInt(this.className.match(/fc\-day(\d+)/)[1]); // TODO: maybe use .data var date = indexDate(index); trigger('dayClick', this, date, true, ev); } } /* Semi-transparent Overlay Helpers ------------------------------------------------------*/ function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive if (refreshCoordinateGrid) { coordinateGrid.build(); } var rowStart = cloneDate(t.visStart); var rowEnd = addDays(cloneDate(rowStart), colCnt); for (var i=0; i<rowCnt; i++) { var stretchStart = new Date(Math.max(rowStart, overlayStart)); var stretchEnd = new Date(Math.min(rowEnd, overlayEnd)); if (stretchStart < stretchEnd) { var colStart, colEnd; if (rtl) { colStart = dayDiff(stretchEnd, rowStart)*dis+dit+1; colEnd = dayDiff(stretchStart, rowStart)*dis+dit+1; }else{ colStart = dayDiff(stretchStart, rowStart); colEnd = dayDiff(stretchEnd, rowStart); } dayBind( renderCellOverlay(i, colStart, i, colEnd-1) ); } addDays(rowStart, 7); addDays(rowEnd, 7); } } function renderCellOverlay(row0, col0, row1, col1) { // row1,col1 is inclusive var rect = coordinateGrid.rect(row0, col0, row1, col1, element); return renderOverlay(rect, element); } /* Selection -----------------------------------------------------------------------*/ function defaultSelectionEnd(startDate, allDay) { return cloneDate(startDate); } function renderSelection(startDate, endDate, allDay) { renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); // rebuild every time??? } function clearSelection() { clearOverlays(); } function reportDayClick(date, allDay, ev) { var cell = dateCell(date); var _element = bodyCells[cell.row*colCnt + cell.col]; trigger('dayClick', _element, date, allDay, ev); } /* External Dragging -----------------------------------------------------------------------*/ function dragStart(_dragElement, ev, ui) { hoverListener.start(function(cell) { clearOverlays(); if (cell) { renderCellOverlay(cell.row, cell.col, cell.row, cell.col); } }, ev); } function dragStop(_dragElement, ev, ui) { var cell = hoverListener.stop(); clearOverlays(); if (cell) { var d = cellDate(cell); trigger('drop', _dragElement, d, true, ev, ui); } } /* Utilities --------------------------------------------------------*/ function defaultEventEnd(event) { return cloneDate(event.start); } coordinateGrid = new CoordinateGrid(function(rows, cols) { var e, n, p; headCells.each(function(i, _e) { e = $(_e); n = e.offset().left; if (i) { p[1] = n; } p = [n]; cols[i] = p; }); p[1] = n + e.outerWidth(); bodyRows.each(function(i, _e) { if (i < rowCnt) { e = $(_e); n = e.offset().top; if (i) { p[1] = n; } p = [n]; rows[i] = p; } }); p[1] = n + e.outerHeight(); }); hoverListener = new HoverListener(coordinateGrid); colContentPositions = new HorizontalPositionCache(function(col) { return bodyCellTopInners.eq(col); }); function colContentLeft(col) { return colContentPositions.left(col); } function colContentRight(col) { return colContentPositions.right(col); } function dateCell(date) { return { row: Math.floor(dayDiff(date, t.visStart) / 7), col: dayOfWeekCol(date.getDay()) }; } function cellDate(cell) { return _cellDate(cell.row, cell.col); } function _cellDate(row, col) { return addDays(cloneDate(t.visStart), row*7 + col*dis+dit); // what about weekends in middle of week? } function indexDate(index) { return _cellDate(Math.floor(index/colCnt), index%colCnt); } function dayOfWeekCol(dayOfWeek) { return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt) * dis + dit; } function allDayRow(i) { return bodyRows.eq(i); } function allDayBounds(i) { return { left: 0, right: viewWidth }; } } function BasicEventRenderer() { var t = this; // exports t.renderEvents = renderEvents; t.compileDaySegs = compileSegs; // for DayEventRenderer t.clearEvents = clearEvents; t.bindDaySeg = bindDaySeg; // imports DayEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; //var setOverflowHidden = t.setOverflowHidden; var isEventDraggable = t.isEventDraggable; var isEventResizable = t.isEventResizable; var reportEvents = t.reportEvents; var reportEventClear = t.reportEventClear; var eventElementHandlers = t.eventElementHandlers; var showEvents = t.showEvents; var hideEvents = t.hideEvents; var eventDrop = t.eventDrop; var getDaySegmentContainer = t.getDaySegmentContainer; var getHoverListener = t.getHoverListener; var renderDayOverlay = t.renderDayOverlay; var clearOverlays = t.clearOverlays; var getRowCnt = t.getRowCnt; var getColCnt = t.getColCnt; var renderDaySegs = t.renderDaySegs; var resizableDayEvent = t.resizableDayEvent; /* Rendering --------------------------------------------------------------------*/ function renderEvents(events, modifiedEventId) { reportEvents(events); renderDaySegs(compileSegs(events), modifiedEventId); } function clearEvents() { reportEventClear(); getDaySegmentContainer().empty(); } function compileSegs(events) { var rowCnt = getRowCnt(), colCnt = getColCnt(), d1 = cloneDate(t.visStart), d2 = addDays(cloneDate(d1), colCnt), visEventsEnds = $.map(events, exclEndDay), i, row, j, level, k, seg, segs=[]; for (i=0; i<rowCnt; i++) { row = stackSegs(sliceSegs(events, visEventsEnds, d1, d2)); for (j=0; j<row.length; j++) { level = row[j]; for (k=0; k<level.length; k++) { seg = level[k]; seg.row = i; seg.level = j; // not needed anymore segs.push(seg); } } addDays(d1, 7); addDays(d2, 7); } return segs; } function bindDaySeg(event, eventElement, seg) { if (isEventDraggable(event)) { draggableDayEvent(event, eventElement); } if (seg.isEnd && isEventResizable(event)) { resizableDayEvent(event, eventElement, seg); } eventElementHandlers(event, eventElement); // needs to be after, because resizableDayEvent might stopImmediatePropagation on click } /* Dragging ----------------------------------------------------------------------------*/ function draggableDayEvent(event, eventElement) { var hoverListener = getHoverListener(); var dayDelta; eventElement.draggable({ zIndex: 9, delay: 50, opacity: opt('dragOpacity'), revertDuration: opt('dragRevertDuration'), start: function(ev, ui) { trigger('eventDragStart', eventElement, event, ev, ui); hideEvents(event, eventElement); hoverListener.start(function(cell, origCell, rowDelta, colDelta) { eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta); clearOverlays(); if (cell) { //setOverflowHidden(true); dayDelta = rowDelta*7 + colDelta * (opt('isRTL') ? -1 : 1); renderDayOverlay( addDays(cloneDate(event.start), dayDelta), addDays(exclEndDay(event), dayDelta) ); }else{ //setOverflowHidden(false); dayDelta = 0; } }, ev, 'drag'); }, stop: function(ev, ui) { hoverListener.stop(); clearOverlays(); trigger('eventDragStop', eventElement, event, ev, ui); if (dayDelta) { eventDrop(this, event, dayDelta, 0, event.allDay, ev, ui); }else{ eventElement.css('filter', ''); // clear IE opacity side-effects showEvents(event, eventElement); } //setOverflowHidden(false); } }); } } fcViews.agendaWeek = AgendaWeekView; function AgendaWeekView(element, calendar) { var t = this; // exports t.render = render; // imports AgendaView.call(t, element, calendar, 'agendaWeek'); var opt = t.opt; var renderAgenda = t.renderAgenda; var formatDates = calendar.formatDates; function render(date, delta) { if (delta) { addDays(date, delta * 7); } var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7)); var end = addDays(cloneDate(start), 7); var visStart = cloneDate(start); var visEnd = cloneDate(end); var weekends = opt('weekends'); if (!weekends) { skipWeekend(visStart); skipWeekend(visEnd, -1, true); } t.title = formatDates( visStart, addDays(cloneDate(visEnd), -1), opt('titleFormat') ); t.start = start; t.end = end; t.visStart = visStart; t.visEnd = visEnd; renderAgenda(weekends ? 7 : 5); } } fcViews.agendaDay = AgendaDayView; function AgendaDayView(element, calendar) { var t = this; // exports t.render = render; // imports AgendaView.call(t, element, calendar, 'agendaDay'); var opt = t.opt; var renderAgenda = t.renderAgenda; var formatDate = calendar.formatDate; function render(date, delta) { if (delta) { addDays(date, delta); if (!opt('weekends')) { skipWeekend(date, delta < 0 ? -1 : 1); } } var start = cloneDate(date, true); var end = addDays(cloneDate(start), 1); t.title = formatDate(date, opt('titleFormat')); t.start = t.visStart = start; t.end = t.visEnd = end; renderAgenda(1); } } setDefaults({ allDaySlot: true, allDayText: 'all-day', firstHour: 6, slotMinutes: 30, defaultEventMinutes: 120, axisFormat: 'h(:mm)tt', timeFormat: { agenda: 'h:mm{ - h:mm}' }, dragOpacity: { agenda: .5 }, minTime: 0, maxTime: 24 }); // TODO: make it work in quirks mode (event corners, all-day height) // TODO: test liquid width, especially in IE6 function AgendaView(element, calendar, viewName) { var t = this; // exports t.renderAgenda = renderAgenda; t.setWidth = setWidth; t.setHeight = setHeight; t.beforeHide = beforeHide; t.afterShow = afterShow; t.defaultEventEnd = defaultEventEnd; t.timePosition = timePosition; t.dayOfWeekCol = dayOfWeekCol; t.dateCell = dateCell; t.cellDate = cellDate; t.cellIsAllDay = cellIsAllDay; t.allDayRow = getAllDayRow; t.allDayBounds = allDayBounds; t.getHoverListener = function() { return hoverListener }; t.colContentLeft = colContentLeft; t.colContentRight = colContentRight; t.getDaySegmentContainer = function() { return daySegmentContainer }; t.getSlotSegmentContainer = function() { return slotSegmentContainer }; t.getMinMinute = function() { return minMinute }; t.getMaxMinute = function() { return maxMinute }; t.getBodyContent = function() { return slotContent }; // !!?? t.getRowCnt = function() { return 1 }; t.getColCnt = function() { return colCnt }; t.getColWidth = function() { return colWidth }; t.getSlotHeight = function() { return slotHeight }; t.defaultSelectionEnd = defaultSelectionEnd; t.renderDayOverlay = renderDayOverlay; t.renderSelection = renderSelection; t.clearSelection = clearSelection; t.reportDayClick = reportDayClick; // selection mousedown hack t.dragStart = dragStart; t.dragStop = dragStop; // imports View.call(t, element, calendar, viewName); OverlayManager.call(t); SelectionManager.call(t); AgendaEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; var clearEvents = t.clearEvents; var renderOverlay = t.renderOverlay; var clearOverlays = t.clearOverlays; var reportSelection = t.reportSelection; var unselect = t.unselect; var daySelectionMousedown = t.daySelectionMousedown; var slotSegHtml = t.slotSegHtml; var formatDate = calendar.formatDate; // locals var dayTable; var dayHead; var dayHeadCells; var dayBody; var dayBodyCells; var dayBodyCellInners; var dayBodyFirstCell; var dayBodyFirstCellStretcher; var slotLayer; var daySegmentContainer; var allDayTable; var allDayRow; var slotScroller; var slotContent; var slotSegmentContainer; var slotTable; var slotTableFirstInner; var axisFirstCells; var gutterCells; var selectionHelper; var viewWidth; var viewHeight; var axisWidth; var colWidth; var gutterWidth; var slotHeight; // TODO: what if slotHeight changes? (see issue 650) var savedScrollTop; var colCnt; var slotCnt; var coordinateGrid; var hoverListener; var colContentPositions; var slotTopCache = {}; var tm; var firstDay; var nwe; // no weekends (int) var rtl, dis, dit; // day index sign / translate var minMinute, maxMinute; var colFormat; /* Rendering -----------------------------------------------------------------------------*/ disableTextSelection(element.addClass('fc-agenda')); function renderAgenda(c) { colCnt = c; updateOptions(); if (!dayTable) { buildSkeleton(); }else{ clearEvents(); } updateCells(); } function updateOptions() { tm = opt('theme') ? 'ui' : 'fc'; nwe = opt('weekends') ? 0 : 1; firstDay = opt('firstDay'); if (rtl = opt('isRTL')) { dis = -1; dit = colCnt - 1; }else{ dis = 1; dit = 0; } minMinute = parseTime(opt('minTime')); maxMinute = parseTime(opt('maxTime')); colFormat = opt('columnFormat'); } function buildSkeleton() { var headerClass = tm + "-widget-header"; var contentClass = tm + "-widget-content"; var s; var i; var d; var maxd; var minutes; var slotNormal = opt('slotMinutes') % 15 == 0; s = "<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'>" + "<thead>" + "<tr>" + "<th class='fc-agenda-axis " + headerClass + "'>&nbsp;</th>"; for (i=0; i<colCnt; i++) { s += "<th class='fc- fc-col" + i + ' ' + headerClass + "'/>"; // fc- needed for setDayID } s += "<th class='fc-agenda-gutter " + headerClass + "'>&nbsp;</th>" + "</tr>" + "</thead>" + "<tbody>" + "<tr>" + "<th class='fc-agenda-axis " + headerClass + "'>&nbsp;</th>"; for (i=0; i<colCnt; i++) { s += "<td class='fc- fc-col" + i + ' ' + contentClass + "'>" + // fc- needed for setDayID "<div>" + "<div class='fc-day-content'>" + "<div style='position:relative'>&nbsp;</div>" + "</div>" + "</div>" + "</td>"; } s += "<td class='fc-agenda-gutter " + contentClass + "'>&nbsp;</td>" + "</tr>" + "</tbody>" + "</table>"; dayTable = $(s).appendTo(element); dayHead = dayTable.find('thead'); dayHeadCells = dayHead.find('th').slice(1, -1); dayBody = dayTable.find('tbody'); dayBodyCells = dayBody.find('td').slice(0, -1); dayBodyCellInners = dayBodyCells.find('div.fc-day-content div'); dayBodyFirstCell = dayBodyCells.eq(0); dayBodyFirstCellStretcher = dayBodyFirstCell.find('> div'); markFirstLast(dayHead.add(dayHead.find('tr'))); markFirstLast(dayBody.add(dayBody.find('tr'))); axisFirstCells = dayHead.find('th:first'); gutterCells = dayTable.find('.fc-agenda-gutter'); slotLayer = $("<div style='position:absolute;z-index:2;left:0;width:100%'/>") .appendTo(element); if (opt('allDaySlot')) { daySegmentContainer = $("<div style='position:absolute;z-index:8;top:0;left:0'/>") .appendTo(slotLayer); s = "<table style='width:100%' class='fc-agenda-allday' cellspacing='0'>" + "<tr>" + "<th class='" + headerClass + " fc-agenda-axis'>" + opt('allDayText') + "</th>" + "<td>" + "<div class='fc-day-content'><div style='position:relative'/></div>" + "</td>" + "<th class='" + headerClass + " fc-agenda-gutter'>&nbsp;</th>" + "</tr>" + "</table>"; allDayTable = $(s).appendTo(slotLayer); allDayRow = allDayTable.find('tr'); dayBind(allDayRow.find('td')); axisFirstCells = axisFirstCells.add(allDayTable.find('th:first')); gutterCells = gutterCells.add(allDayTable.find('th.fc-agenda-gutter')); slotLayer.append( "<div class='fc-agenda-divider " + headerClass + "'>" + "<div class='fc-agenda-divider-inner'/>" + "</div>" ); }else{ daySegmentContainer = $([]); // in jQuery 1.4, we can just do $() } slotScroller = $("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>") .appendTo(slotLayer); slotContent = $("<div style='position:relative;width:100%;overflow:hidden'/>") .appendTo(slotScroller); slotSegmentContainer = $("<div style='position:absolute;z-index:8;top:0;left:0'/>") .appendTo(slotContent); s = "<table class='fc-agenda-slots' style='width:100%' cellspacing='0'>" + "<tbody>"; d = zeroDate(); maxd = addMinutes(cloneDate(d), maxMinute); addMinutes(d, minMinute); slotCnt = 0; for (i=0; d < maxd; i++) { minutes = d.getMinutes(); s += "<tr class='fc-slot" + i + ' ' + (!minutes ? '' : 'fc-minor') + "'>" + "<th class='fc-agenda-axis " + headerClass + "'>" + ((!slotNormal || !minutes) ? formatDate(d, opt('axisFormat')) : '&nbsp;') + "</th>" + "<td class='" + contentClass + "'>" + "<div style='position:relative'>&nbsp;</div>" + "</td>" + "</tr>"; addMinutes(d, opt('slotMinutes')); slotCnt++; } s += "</tbody>" + "</table>"; slotTable = $(s).appendTo(slotContent); slotTableFirstInner = slotTable.find('div:first'); slotBind(slotTable.find('td')); axisFirstCells = axisFirstCells.add(slotTable.find('th:first')); } function updateCells() { var i; var headCell; var bodyCell; var date; var today = clearTime(new Date()); for (i=0; i<colCnt; i++) { date = colDate(i); headCell = dayHeadCells.eq(i); headCell.html(formatDate(date, colFormat)); bodyCell = dayBodyCells.eq(i); if (+date == +today) { bodyCell.addClass(tm + '-state-highlight fc-today'); }else{ bodyCell.removeClass(tm + '-state-highlight fc-today'); } setDayID(headCell.add(bodyCell), date); } } function setHeight(height, dateChanged) { if (height === undefined) { height = viewHeight; } viewHeight = height; slotTopCache = {}; var headHeight = dayBody.position().top; var allDayHeight = slotScroller.position().top; // including divider var bodyHeight = Math.min( // total body height, including borders height - headHeight, // when scrollbars slotTable.height() + allDayHeight + 1 // when no scrollbars. +1 for bottom border ); dayBodyFirstCellStretcher .height(bodyHeight - vsides(dayBodyFirstCell)); slotLayer.css('top', headHeight); slotScroller.height(bodyHeight - allDayHeight - 1); slotHeight = slotTableFirstInner.height() + 1; // +1 for border if (dateChanged) { resetScroll(); } } function setWidth(width) { viewWidth = width; colContentPositions.clear(); axisWidth = 0; setOuterWidth( axisFirstCells .width('') .each(function(i, _cell) { axisWidth = Math.max(axisWidth, $(_cell).outerWidth()); }), axisWidth ); var slotTableWidth = slotScroller[0].clientWidth; // needs to be done after axisWidth (for IE7) //slotTable.width(slotTableWidth); gutterWidth = slotScroller.width() - slotTableWidth; if (gutterWidth) { setOuterWidth(gutterCells, gutterWidth); gutterCells .show() .prev() .removeClass('fc-last'); }else{ gutterCells .hide() .prev() .addClass('fc-last'); } colWidth = Math.floor((slotTableWidth - axisWidth) / colCnt); setOuterWidth(dayHeadCells.slice(0, -1), colWidth); } function resetScroll() { var d0 = zeroDate(); var scrollDate = cloneDate(d0); scrollDate.setHours(opt('firstHour')); var top = timePosition(d0, scrollDate) + 1; // +1 for the border function scroll() { slotScroller.scrollTop(top); } scroll(); setTimeout(scroll, 0); // overrides any previous scroll state made by the browser } function beforeHide() { savedScrollTop = slotScroller.scrollTop(); } function afterShow() { slotScroller.scrollTop(savedScrollTop); } /* Slot/Day clicking and binding -----------------------------------------------------------------------*/ function dayBind(cells) { cells.click(slotClick) .mousedown(daySelectionMousedown); } function slotBind(cells) { cells.click(slotClick) .mousedown(slotSelectionMousedown); } function slotClick(ev) { if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick var col = Math.min(colCnt-1, Math.floor((ev.pageX - dayTable.offset().left - axisWidth) / colWidth)); var date = colDate(col); var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: maybe use data if (rowMatch) { var mins = parseInt(rowMatch[1]) * opt('slotMinutes'); var hours = Math.floor(mins/60); date.setHours(hours); date.setMinutes(mins%60 + minMinute); trigger('dayClick', dayBodyCells[col], date, false, ev); }else{ trigger('dayClick', dayBodyCells[col], date, true, ev); } } } /* Semi-transparent Overlay Helpers -----------------------------------------------------*/ function renderDayOverlay(startDate, endDate, refreshCoordinateGrid) { // endDate is exclusive if (refreshCoordinateGrid) { coordinateGrid.build(); } var visStart = cloneDate(t.visStart); var startCol, endCol; if (rtl) { startCol = dayDiff(endDate, visStart)*dis+dit+1; endCol = dayDiff(startDate, visStart)*dis+dit+1; }else{ startCol = dayDiff(startDate, visStart); endCol = dayDiff(endDate, visStart); } startCol = Math.max(0, startCol); endCol = Math.min(colCnt, endCol); if (startCol < endCol) { dayBind( renderCellOverlay(0, startCol, 0, endCol-1) ); } } function renderCellOverlay(row0, col0, row1, col1) { // only for all-day? var rect = coordinateGrid.rect(row0, col0, row1, col1, slotLayer); return renderOverlay(rect, slotLayer); } function renderSlotOverlay(overlayStart, overlayEnd) { var dayStart = cloneDate(t.visStart); var dayEnd = addDays(cloneDate(dayStart), 1); for (var i=0; i<colCnt; i++) { var stretchStart = new Date(Math.max(dayStart, overlayStart)); var stretchEnd = new Date(Math.min(dayEnd, overlayEnd)); if (stretchStart < stretchEnd) { var col = i*dis+dit; var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only use it for horizontal coords var top = timePosition(dayStart, stretchStart); var bottom = timePosition(dayStart, stretchEnd); rect.top = top; rect.height = bottom - top; slotBind( renderOverlay(rect, slotContent) ); } addDays(dayStart, 1); addDays(dayEnd, 1); } } /* Coordinate Utilities -----------------------------------------------------------------------------*/ coordinateGrid = new CoordinateGrid(function(rows, cols) { var e, n, p; dayHeadCells.each(function(i, _e) { e = $(_e); n = e.offset().left; if (i) { p[1] = n; } p = [n]; cols[i] = p; }); p[1] = n + e.outerWidth(); if (opt('allDaySlot')) { e = allDayRow; n = e.offset().top; rows[0] = [n, n+e.outerHeight()]; } var slotTableTop = slotContent.offset().top; var slotScrollerTop = slotScroller.offset().top; var slotScrollerBottom = slotScrollerTop + slotScroller.outerHeight(); function constrain(n) { return Math.max(slotScrollerTop, Math.min(slotScrollerBottom, n)); } for (var i=0; i<slotCnt; i++) { rows.push([ constrain(slotTableTop + slotHeight*i), constrain(slotTableTop + slotHeight*(i+1)) ]); } }); hoverListener = new HoverListener(coordinateGrid); colContentPositions = new HorizontalPositionCache(function(col) { return dayBodyCellInners.eq(col); }); function colContentLeft(col) { return colContentPositions.left(col); } function colContentRight(col) { return colContentPositions.right(col); } function dateCell(date) { // "cell" terminology is now confusing return { row: Math.floor(dayDiff(date, t.visStart) / 7), col: dayOfWeekCol(date.getDay()) }; } function cellDate(cell) { var d = colDate(cell.col); var slotIndex = cell.row; if (opt('allDaySlot')) { slotIndex--; } if (slotIndex >= 0) { addMinutes(d, minMinute + slotIndex * opt('slotMinutes')); } return d; } function colDate(col) { // returns dates with 00:00:00 return addDays(cloneDate(t.visStart), col*dis+dit); } function cellIsAllDay(cell) { return opt('allDaySlot') && !cell.row; } function dayOfWeekCol(dayOfWeek) { return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt)*dis+dit; } // get the Y coordinate of the given time on the given day (both Date objects) function timePosition(day, time) { // both date objects. day holds 00:00 of current day day = cloneDate(day, true); if (time < addMinutes(cloneDate(day), minMinute)) { return 0; } if (time >= addMinutes(cloneDate(day), maxMinute)) { return slotTable.height(); } var slotMinutes = opt('slotMinutes'), minutes = time.getHours()*60 + time.getMinutes() - minMinute, slotI = Math.floor(minutes / slotMinutes), slotTop = slotTopCache[slotI]; if (slotTop === undefined) { slotTop = slotTopCache[slotI] = slotTable.find('tr:eq(' + slotI + ') td div')[0].offsetTop; //.position().top; // need this optimization??? } return Math.max(0, Math.round( slotTop - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes) )); } function allDayBounds() { return { left: axisWidth, right: viewWidth - gutterWidth } } function getAllDayRow(index) { return allDayRow; } function defaultEventEnd(event) { var start = cloneDate(event.start); if (event.allDay) { return start; } return addMinutes(start, opt('defaultEventMinutes')); } /* Selection ---------------------------------------------------------------------------------*/ function defaultSelectionEnd(startDate, allDay) { if (allDay) { return cloneDate(startDate); } return addMinutes(cloneDate(startDate), opt('slotMinutes')); } function renderSelection(startDate, endDate, allDay) { // only for all-day if (allDay) { if (opt('allDaySlot')) { renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); } }else{ renderSlotSelection(startDate, endDate); } } function renderSlotSelection(startDate, endDate) { var helperOption = opt('selectHelper'); coordinateGrid.build(); if (helperOption) { var col = dayDiff(startDate, t.visStart) * dis + dit; if (col >= 0 && col < colCnt) { // only works when times are on same day var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only for horizontal coords var top = timePosition(startDate, startDate); var bottom = timePosition(startDate, endDate); if (bottom > top) { // protect against selections that are entirely before or after visible range rect.top = top; rect.height = bottom - top; rect.left += 2; rect.width -= 5; if ($.isFunction(helperOption)) { var helperRes = helperOption(startDate, endDate); if (helperRes) { rect.position = 'absolute'; rect.zIndex = 8; selectionHelper = $(helperRes) .css(rect) .appendTo(slotContent); } }else{ rect.isStart = true; // conside rect a "seg" now rect.isEnd = true; // selectionHelper = $(slotSegHtml( { title: '', start: startDate, end: endDate, className: ['fc-select-helper'], editable: false }, rect )); selectionHelper.css('opacity', opt('dragOpacity')); } if (selectionHelper) { slotBind(selectionHelper); slotContent.append(selectionHelper); setOuterWidth(selectionHelper, rect.width, true); // needs to be after appended setOuterHeight(selectionHelper, rect.height, true); } } } }else{ renderSlotOverlay(startDate, endDate); } } function clearSelection() { clearOverlays(); if (selectionHelper) { selectionHelper.remove(); selectionHelper = null; } } function slotSelectionMousedown(ev) { if (ev.which == 1 && opt('selectable')) { // ev.which==1 means left mouse button unselect(ev); var dates; hoverListener.start(function(cell, origCell) { clearSelection(); if (cell && cell.col == origCell.col && !cellIsAllDay(cell)) { var d1 = cellDate(origCell); var d2 = cellDate(cell); dates = [ d1, addMinutes(cloneDate(d1), opt('slotMinutes')), d2, addMinutes(cloneDate(d2), opt('slotMinutes')) ].sort(cmp); renderSlotSelection(dates[0], dates[3]); }else{ dates = null; } }, ev); $(document).one('mouseup', function(ev) { hoverListener.stop(); if (dates) { if (+dates[0] == +dates[1]) { reportDayClick(dates[0], false, ev); } reportSelection(dates[0], dates[3], false, ev); } }); } } function reportDayClick(date, allDay, ev) { trigger('dayClick', dayBodyCells[dayOfWeekCol(date.getDay())], date, allDay, ev); } /* External Dragging --------------------------------------------------------------------------------*/ function dragStart(_dragElement, ev, ui) { hoverListener.start(function(cell) { clearOverlays(); if (cell) { if (cellIsAllDay(cell)) { renderCellOverlay(cell.row, cell.col, cell.row, cell.col); }else{ var d1 = cellDate(cell); var d2 = addMinutes(cloneDate(d1), opt('defaultEventMinutes')); renderSlotOverlay(d1, d2); } } }, ev); } function dragStop(_dragElement, ev, ui) { var cell = hoverListener.stop(); clearOverlays(); if (cell) { trigger('drop', _dragElement, cellDate(cell), cellIsAllDay(cell), ev, ui); } } } function AgendaEventRenderer() { var t = this; // exports t.renderEvents = renderEvents; t.compileDaySegs = compileDaySegs; // for DayEventRenderer t.clearEvents = clearEvents; t.slotSegHtml = slotSegHtml; t.bindDaySeg = bindDaySeg; // imports DayEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; //var setOverflowHidden = t.setOverflowHidden; var isEventDraggable = t.isEventDraggable; var isEventResizable = t.isEventResizable; var eventEnd = t.eventEnd; var reportEvents = t.reportEvents; var reportEventClear = t.reportEventClear; var eventElementHandlers = t.eventElementHandlers; var setHeight = t.setHeight; var getDaySegmentContainer = t.getDaySegmentContainer; var getSlotSegmentContainer = t.getSlotSegmentContainer; var getHoverListener = t.getHoverListener; var getMaxMinute = t.getMaxMinute; var getMinMinute = t.getMinMinute; var timePosition = t.timePosition; var colContentLeft = t.colContentLeft; var colContentRight = t.colContentRight; var renderDaySegs = t.renderDaySegs; var resizableDayEvent = t.resizableDayEvent; // TODO: streamline binding architecture var getColCnt = t.getColCnt; var getColWidth = t.getColWidth; var getSlotHeight = t.getSlotHeight; var getBodyContent = t.getBodyContent; var reportEventElement = t.reportEventElement; var showEvents = t.showEvents; var hideEvents = t.hideEvents; var eventDrop = t.eventDrop; var eventResize = t.eventResize; var renderDayOverlay = t.renderDayOverlay; var clearOverlays = t.clearOverlays; var calendar = t.calendar; var formatDate = calendar.formatDate; var formatDates = calendar.formatDates; /* Rendering ----------------------------------------------------------------------------*/ function renderEvents(events, modifiedEventId) { reportEvents(events); var i, len=events.length, dayEvents=[], slotEvents=[]; for (i=0; i<len; i++) { if (events[i].allDay) { dayEvents.push(events[i]); }else{ slotEvents.push(events[i]); } } if (opt('allDaySlot')) { renderDaySegs(compileDaySegs(dayEvents), modifiedEventId); setHeight(); // no params means set to viewHeight } renderSlotSegs(compileSlotSegs(slotEvents), modifiedEventId); } function clearEvents() { reportEventClear(); getDaySegmentContainer().empty(); getSlotSegmentContainer().empty(); } function compileDaySegs(events) { var levels = stackSegs(sliceSegs(events, $.map(events, exclEndDay), t.visStart, t.visEnd)), i, levelCnt=levels.length, level, j, seg, segs=[]; for (i=0; i<levelCnt; i++) { level = levels[i]; for (j=0; j<level.length; j++) { seg = level[j]; seg.row = 0; seg.level = i; // not needed anymore segs.push(seg); } } return segs; } function compileSlotSegs(events) { var colCnt = getColCnt(), minMinute = getMinMinute(), maxMinute = getMaxMinute(), d = addMinutes(cloneDate(t.visStart), minMinute), visEventEnds = $.map(events, slotEventEnd), i, col, j, level, k, seg, segs=[]; for (i=0; i<colCnt; i++) { col = stackSegs(sliceSegs(events, visEventEnds, d, addMinutes(cloneDate(d), maxMinute-minMinute))); countForwardSegs(col); for (j=0; j<col.length; j++) { level = col[j]; for (k=0; k<level.length; k++) { seg = level[k]; seg.col = i; seg.level = j; segs.push(seg); } } addDays(d, 1, true); } return segs; } function slotEventEnd(event) { if (event.end) { return cloneDate(event.end); }else{ return addMinutes(cloneDate(event.start), opt('defaultEventMinutes')); } } // renders events in the 'time slots' at the bottom function renderSlotSegs(segs, modifiedEventId) { var i, segCnt=segs.length, seg, event, classes, top, bottom, colI, levelI, forward, leftmost, availWidth, outerWidth, left, html='', eventElements, eventElement, triggerRes, vsideCache={}, hsideCache={}, key, val, contentElement, height, slotSegmentContainer = getSlotSegmentContainer(), rtl, dis, dit, colCnt = getColCnt(); if (rtl = opt('isRTL')) { dis = -1; dit = colCnt - 1; }else{ dis = 1; dit = 0; } // calculate position/dimensions, create html for (i=0; i<segCnt; i++) { seg = segs[i]; event = seg.event; top = timePosition(seg.start, seg.start); bottom = timePosition(seg.start, seg.end); colI = seg.col; levelI = seg.level; forward = seg.forward || 0; leftmost = colContentLeft(colI*dis + dit); availWidth = colContentRight(colI*dis + dit) - leftmost; availWidth = Math.min(availWidth-6, availWidth*.95); // TODO: move this to CSS if (levelI) { // indented and thin outerWidth = availWidth / (levelI + forward + 1); }else{ if (forward) { // moderately wide, aligned left still outerWidth = ((availWidth / (forward + 1)) - (12/2)) * 2; // 12 is the predicted width of resizer = }else{ // can be entire width, aligned left outerWidth = availWidth; } } left = leftmost + // leftmost possible (availWidth / (levelI + forward + 1) * levelI) // indentation * dis + (rtl ? availWidth - outerWidth : 0); // rtl seg.top = top; seg.left = left; seg.outerWidth = outerWidth; seg.outerHeight = bottom - top; html += slotSegHtml(event, seg); } slotSegmentContainer[0].innerHTML = html; // faster than html() eventElements = slotSegmentContainer.children(); // retrieve elements, run through eventRender callback, bind event handlers for (i=0; i<segCnt; i++) { seg = segs[i]; event = seg.event; eventElement = $(eventElements[i]); // faster than eq() triggerRes = trigger('eventRender', event, event, eventElement); if (triggerRes === false) { eventElement.remove(); }else{ if (triggerRes && triggerRes !== true) { eventElement.remove(); eventElement = $(triggerRes) .css({ position: 'absolute', top: seg.top, left: seg.left }) .appendTo(slotSegmentContainer); } seg.element = eventElement; if (event._id === modifiedEventId) { bindSlotSeg(event, eventElement, seg); }else{ eventElement[0]._fci = i; // for lazySegBind } reportEventElement(event, eventElement); } } lazySegBind(slotSegmentContainer, segs, bindSlotSeg); // record event sides and title positions for (i=0; i<segCnt; i++) { seg = segs[i]; if (eventElement = seg.element) { val = vsideCache[key = seg.key = cssKey(eventElement[0])]; seg.vsides = val === undefined ? (vsideCache[key] = vsides(eventElement, true)) : val; val = hsideCache[key]; seg.hsides = val === undefined ? (hsideCache[key] = hsides(eventElement, true)) : val; contentElement = eventElement.find('div.fc-event-content'); if (contentElement.length) { seg.contentTop = contentElement[0].offsetTop; } } } // set all positions/dimensions at once for (i=0; i<segCnt; i++) { seg = segs[i]; if (eventElement = seg.element) { eventElement[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px'; height = Math.max(0, seg.outerHeight - seg.vsides); eventElement[0].style.height = height + 'px'; event = seg.event; if (seg.contentTop !== undefined && height - seg.contentTop < 10) { // not enough room for title, put it in the time header eventElement.find('div.fc-event-time') .text(formatDate(event.start, opt('timeFormat')) + ' - ' + event.title); eventElement.find('div.fc-event-title') .remove(); } trigger('eventAfterRender', event, event, eventElement); } } } function slotSegHtml(event, seg) { var html = "<"; var url = event.url; var skinCss = getSkinCss(event, opt); var skinCssAttr = (skinCss ? " style='" + skinCss + "'" : ''); var classes = ['fc-event', 'fc-event-skin', 'fc-event-vert']; if (isEventDraggable(event)) { classes.push('fc-event-draggable'); } if (seg.isStart) { classes.push('fc-corner-top'); } if (seg.isEnd) { classes.push('fc-corner-bottom'); } classes = classes.concat(event.className); if (event.source) { classes = classes.concat(event.source.className || []); } if (url) { html += "a href='" + htmlEscape(event.url) + "'"; }else{ html += "div"; } html += " class='" + classes.join(' ') + "'" + " style='position:absolute;z-index:8;top:" + seg.top + "px;left:" + seg.left + "px;" + skinCss + "'" + ">" + "<div class='fc-event-inner fc-event-skin'" + skinCssAttr + ">" + "<div class='fc-event-head fc-event-skin'" + skinCssAttr + ">" + "<div class='fc-event-time'>" + htmlEscape(formatDates(event.start, event.end, opt('timeFormat'))) + "</div>" + "</div>" + "<div class='fc-event-content'>" + "<div class='fc-event-title'>" + htmlEscape(event.title) + "</div>" + "</div>" + "<div class='fc-event-bg'></div>" + "</div>"; // close inner if (seg.isEnd && isEventResizable(event)) { html += "<div class='ui-resizable-handle ui-resizable-s'>=</div>"; } html += "</" + (url ? "a" : "div") + ">"; return html; } function bindDaySeg(event, eventElement, seg) { if (isEventDraggable(event)) { draggableDayEvent(event, eventElement, seg.isStart); } if (seg.isEnd && isEventResizable(event)) { resizableDayEvent(event, eventElement, seg); } eventElementHandlers(event, eventElement); // needs to be after, because resizableDayEvent might stopImmediatePropagation on click } function bindSlotSeg(event, eventElement, seg) { var timeElement = eventElement.find('div.fc-event-time'); if (isEventDraggable(event)) { draggableSlotEvent(event, eventElement, timeElement); } if (seg.isEnd && isEventResizable(event)) { resizableSlotEvent(event, eventElement, timeElement); } eventElementHandlers(event, eventElement); } /* Dragging -----------------------------------------------------------------------------------*/ // when event starts out FULL-DAY function draggableDayEvent(event, eventElement, isStart) { var origWidth; var revert; var allDay=true; var dayDelta; var dis = opt('isRTL') ? -1 : 1; var hoverListener = getHoverListener(); var colWidth = getColWidth(); var slotHeight = getSlotHeight(); var minMinute = getMinMinute(); eventElement.draggable({ zIndex: 9, opacity: opt('dragOpacity', 'month'), // use whatever the month view was using revertDuration: opt('dragRevertDuration'), start: function(ev, ui) { trigger('eventDragStart', eventElement, event, ev, ui); hideEvents(event, eventElement); origWidth = eventElement.width(); hoverListener.start(function(cell, origCell, rowDelta, colDelta) { clearOverlays(); if (cell) { //setOverflowHidden(true); revert = false; dayDelta = colDelta * dis; if (!cell.row) { // on full-days renderDayOverlay( addDays(cloneDate(event.start), dayDelta), addDays(exclEndDay(event), dayDelta) ); resetElement(); }else{ // mouse is over bottom slots if (isStart) { if (allDay) { // convert event to temporary slot-event eventElement.width(colWidth - 10); // don't use entire width setOuterHeight( eventElement, slotHeight * Math.round( (event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes')) / opt('slotMinutes') ) ); eventElement.draggable('option', 'grid', [colWidth, 1]); allDay = false; } }else{ revert = true; } } revert = revert || (allDay && !dayDelta); }else{ resetElement(); //setOverflowHidden(false); revert = true; } eventElement.draggable('option', 'revert', revert); }, ev, 'drag'); }, stop: function(ev, ui) { hoverListener.stop(); clearOverlays(); trigger('eventDragStop', eventElement, event, ev, ui); if (revert) { // hasn't moved or is out of bounds (draggable has already reverted) resetElement(); eventElement.css('filter', ''); // clear IE opacity side-effects showEvents(event, eventElement); }else{ // changed! var minuteDelta = 0; if (!allDay) { minuteDelta = Math.round((eventElement.offset().top - getBodyContent().offset().top) / slotHeight) * opt('slotMinutes') + minMinute - (event.start.getHours() * 60 + event.start.getMinutes()); } eventDrop(this, event, dayDelta, minuteDelta, allDay, ev, ui); } //setOverflowHidden(false); } }); function resetElement() { if (!allDay) { eventElement .width(origWidth) .height('') .draggable('option', 'grid', null); allDay = true; } } } // when event starts out IN TIMESLOTS function draggableSlotEvent(event, eventElement, timeElement) { var origPosition; var allDay=false; var dayDelta; var minuteDelta; var prevMinuteDelta; var dis = opt('isRTL') ? -1 : 1; var hoverListener = getHoverListener(); var colCnt = getColCnt(); var colWidth = getColWidth(); var slotHeight = getSlotHeight(); eventElement.draggable({ zIndex: 9, scroll: false, grid: [colWidth, slotHeight], axis: colCnt==1 ? 'y' : false, opacity: opt('dragOpacity'), revertDuration: opt('dragRevertDuration'), start: function(ev, ui) { trigger('eventDragStart', eventElement, event, ev, ui); hideEvents(event, eventElement); origPosition = eventElement.position(); minuteDelta = prevMinuteDelta = 0; hoverListener.start(function(cell, origCell, rowDelta, colDelta) { eventElement.draggable('option', 'revert', !cell); clearOverlays(); if (cell) { dayDelta = colDelta * dis; if (opt('allDaySlot') && !cell.row) { // over full days if (!allDay) { // convert to temporary all-day event allDay = true; timeElement.hide(); eventElement.draggable('option', 'grid', null); } renderDayOverlay( addDays(cloneDate(event.start), dayDelta), addDays(exclEndDay(event), dayDelta) ); }else{ // on slots resetElement(); } } }, ev, 'drag'); }, drag: function(ev, ui) { minuteDelta = Math.round((ui.position.top - origPosition.top) / slotHeight) * opt('slotMinutes'); if (minuteDelta != prevMinuteDelta) { if (!allDay) { updateTimeText(minuteDelta); } prevMinuteDelta = minuteDelta; } }, stop: function(ev, ui) { var cell = hoverListener.stop(); clearOverlays(); trigger('eventDragStop', eventElement, event, ev, ui); if (cell && (dayDelta || minuteDelta || allDay)) { // changed! eventDrop(this, event, dayDelta, allDay ? 0 : minuteDelta, allDay, ev, ui); }else{ // either no change or out-of-bounds (draggable has already reverted) resetElement(); eventElement.css('filter', ''); // clear IE opacity side-effects eventElement.css(origPosition); // sometimes fast drags make event revert to wrong position updateTimeText(0); showEvents(event, eventElement); } } }); function updateTimeText(minuteDelta) { var newStart = addMinutes(cloneDate(event.start), minuteDelta); var newEnd; if (event.end) { newEnd = addMinutes(cloneDate(event.end), minuteDelta); } timeElement.text(formatDates(newStart, newEnd, opt('timeFormat'))); } function resetElement() { // convert back to original slot-event if (allDay) { timeElement.css('display', ''); // show() was causing display=inline eventElement.draggable('option', 'grid', [colWidth, slotHeight]); allDay = false; } } } /* Resizing --------------------------------------------------------------------------------------*/ function resizableSlotEvent(event, eventElement, timeElement) { var slotDelta, prevSlotDelta; var slotHeight = getSlotHeight(); eventElement.resizable({ handles: { s: 'div.ui-resizable-s' }, grid: slotHeight, start: function(ev, ui) { slotDelta = prevSlotDelta = 0; hideEvents(event, eventElement); eventElement.css('z-index', 9); trigger('eventResizeStart', this, event, ev, ui); }, resize: function(ev, ui) { // don't rely on ui.size.height, doesn't take grid into account slotDelta = Math.round((Math.max(slotHeight, eventElement.height()) - ui.originalSize.height) / slotHeight); if (slotDelta != prevSlotDelta) { timeElement.text( formatDates( event.start, (!slotDelta && !event.end) ? null : // no change, so don't display time range addMinutes(eventEnd(event), opt('slotMinutes')*slotDelta), opt('timeFormat') ) ); prevSlotDelta = slotDelta; } }, stop: function(ev, ui) { trigger('eventResizeStop', this, event, ev, ui); if (slotDelta) { eventResize(this, event, 0, opt('slotMinutes')*slotDelta, ev, ui); }else{ eventElement.css('z-index', 8); showEvents(event, eventElement); // BUG: if event was really short, need to put title back in span } } }); } } function countForwardSegs(levels) { var i, j, k, level, segForward, segBack; for (i=levels.length-1; i>0; i--) { level = levels[i]; for (j=0; j<level.length; j++) { segForward = level[j]; for (k=0; k<levels[i-1].length; k++) { segBack = levels[i-1][k]; if (segsCollide(segForward, segBack)) { segBack.forward = Math.max(segBack.forward||0, (segForward.forward||0)+1); } } } } } function View(element, calendar, viewName) { var t = this; // exports t.element = element; t.calendar = calendar; t.name = viewName; t.opt = opt; t.trigger = trigger; //t.setOverflowHidden = setOverflowHidden; t.isEventDraggable = isEventDraggable; t.isEventResizable = isEventResizable; t.reportEvents = reportEvents; t.eventEnd = eventEnd; t.reportEventElement = reportEventElement; t.reportEventClear = reportEventClear; t.eventElementHandlers = eventElementHandlers; t.showEvents = showEvents; t.hideEvents = hideEvents; t.eventDrop = eventDrop; t.eventResize = eventResize; // t.title // t.start, t.end // t.visStart, t.visEnd // imports var defaultEventEnd = t.defaultEventEnd; var normalizeEvent = calendar.normalizeEvent; // in EventManager var reportEventChange = calendar.reportEventChange; // locals var eventsByID = {}; var eventElements = []; var eventElementsByID = {}; var options = calendar.options; function opt(name, viewNameOverride) { var v = options[name]; if (typeof v == 'object') { return smartProperty(v, viewNameOverride || viewName); } return v; } function trigger(name, thisObj) { return calendar.trigger.apply( calendar, [name, thisObj || t].concat(Array.prototype.slice.call(arguments, 2), [t]) ); } /* function setOverflowHidden(bool) { element.css('overflow', bool ? 'hidden' : ''); } */ function isEventDraggable(event) { return isEventEditable(event) && !opt('disableDragging'); } function isEventResizable(event) { // but also need to make sure the seg.isEnd == true return isEventEditable(event) && !opt('disableResizing'); } function isEventEditable(event) { return firstDefined(event.editable, (event.source || {}).editable, opt('editable')); } /* Event Data ------------------------------------------------------------------------------*/ // report when view receives new events function reportEvents(events) { // events are already normalized at this point eventsByID = {}; var i, len=events.length, event; for (i=0; i<len; i++) { event = events[i]; if (eventsByID[event._id]) { eventsByID[event._id].push(event); }else{ eventsByID[event._id] = [event]; } } } // returns a Date object for an event's end function eventEnd(event) { return event.end ? cloneDate(event.end) : defaultEventEnd(event); } /* Event Elements ------------------------------------------------------------------------------*/ // report when view creates an element for an event function reportEventElement(event, element) { eventElements.push(element); if (eventElementsByID[event._id]) { eventElementsByID[event._id].push(element); }else{ eventElementsByID[event._id] = [element]; } } function reportEventClear() { eventElements = []; eventElementsByID = {}; } // attaches eventClick, eventMouseover, eventMouseout function eventElementHandlers(event, eventElement) { eventElement .click(function(ev) { if (!eventElement.hasClass('ui-draggable-dragging') && !eventElement.hasClass('ui-resizable-resizing')) { return trigger('eventClick', this, event, ev); } }) .hover( function(ev) { trigger('eventMouseover', this, event, ev); }, function(ev) { trigger('eventMouseout', this, event, ev); } ); // TODO: don't fire eventMouseover/eventMouseout *while* dragging is occuring (on subject element) // TODO: same for resizing } function showEvents(event, exceptElement) { eachEventElement(event, exceptElement, 'show'); } function hideEvents(event, exceptElement) { eachEventElement(event, exceptElement, 'hide'); } function eachEventElement(event, exceptElement, funcName) { var elements = eventElementsByID[event._id], i, len = elements.length; for (i=0; i<len; i++) { if (!exceptElement || elements[i][0] != exceptElement[0]) { elements[i][funcName](); } } } /* Event Modification Reporting ---------------------------------------------------------------------------------*/ function eventDrop(e, event, dayDelta, minuteDelta, allDay, ev, ui) { var oldAllDay = event.allDay; var eventId = event._id; moveEvents(eventsByID[eventId], dayDelta, minuteDelta, allDay); trigger( 'eventDrop', e, event, dayDelta, minuteDelta, allDay, function() { // TODO: investigate cases where this inverse technique might not work moveEvents(eventsByID[eventId], -dayDelta, -minuteDelta, oldAllDay); reportEventChange(eventId); }, ev, ui ); reportEventChange(eventId); } function eventResize(e, event, dayDelta, minuteDelta, ev, ui) { var eventId = event._id; elongateEvents(eventsByID[eventId], dayDelta, minuteDelta); trigger( 'eventResize', e, event, dayDelta, minuteDelta, function() { // TODO: investigate cases where this inverse technique might not work elongateEvents(eventsByID[eventId], -dayDelta, -minuteDelta); reportEventChange(eventId); }, ev, ui ); reportEventChange(eventId); } /* Event Modification Math ---------------------------------------------------------------------------------*/ function moveEvents(events, dayDelta, minuteDelta, allDay) { minuteDelta = minuteDelta || 0; for (var e, len=events.length, i=0; i<len; i++) { e = events[i]; if (allDay !== undefined) { e.allDay = allDay; } addMinutes(addDays(e.start, dayDelta, true), minuteDelta); if (e.end) { e.end = addMinutes(addDays(e.end, dayDelta, true), minuteDelta); } normalizeEvent(e, options); } } function elongateEvents(events, dayDelta, minuteDelta) { minuteDelta = minuteDelta || 0; for (var e, len=events.length, i=0; i<len; i++) { e = events[i]; e.end = addMinutes(addDays(eventEnd(e), dayDelta, true), minuteDelta); normalizeEvent(e, options); } } } function DayEventRenderer() { var t = this; // exports t.renderDaySegs = renderDaySegs; t.resizableDayEvent = resizableDayEvent; // imports var opt = t.opt; var trigger = t.trigger; var isEventDraggable = t.isEventDraggable; var isEventResizable = t.isEventResizable; var eventEnd = t.eventEnd; var reportEventElement = t.reportEventElement; var showEvents = t.showEvents; var hideEvents = t.hideEvents; var eventResize = t.eventResize; var getRowCnt = t.getRowCnt; var getColCnt = t.getColCnt; var getColWidth = t.getColWidth; var allDayRow = t.allDayRow; var allDayBounds = t.allDayBounds; var colContentLeft = t.colContentLeft; var colContentRight = t.colContentRight; var dayOfWeekCol = t.dayOfWeekCol; var dateCell = t.dateCell; var compileDaySegs = t.compileDaySegs; var getDaySegmentContainer = t.getDaySegmentContainer; var bindDaySeg = t.bindDaySeg; //TODO: streamline this var formatDates = t.calendar.formatDates; var renderDayOverlay = t.renderDayOverlay; var clearOverlays = t.clearOverlays; var clearSelection = t.clearSelection; /* Rendering -----------------------------------------------------------------------------*/ function renderDaySegs(segs, modifiedEventId) { var segmentContainer = getDaySegmentContainer(); var rowDivs; var rowCnt = getRowCnt(); var colCnt = getColCnt(); var i = 0; var rowI; var levelI; var colHeights; var j; var segCnt = segs.length; var seg; var top; var k; segmentContainer[0].innerHTML = daySegHTML(segs); // faster than .html() daySegElementResolve(segs, segmentContainer.children()); daySegElementReport(segs); daySegHandlers(segs, segmentContainer, modifiedEventId); daySegCalcHSides(segs); daySegSetWidths(segs); daySegCalcHeights(segs); rowDivs = getRowDivs(); // set row heights, calculate event tops (in relation to row top) for (rowI=0; rowI<rowCnt; rowI++) { levelI = 0; colHeights = []; for (j=0; j<colCnt; j++) { colHeights[j] = 0; } while (i<segCnt && (seg = segs[i]).row == rowI) { // loop through segs in a row top = arrayMax(colHeights.slice(seg.startCol, seg.endCol)); seg.top = top; top += seg.outerHeight; for (k=seg.startCol; k<seg.endCol; k++) { colHeights[k] = top; } i++; } rowDivs[rowI].height(arrayMax(colHeights)); } daySegSetTops(segs, getRowTops(rowDivs)); } function renderTempDaySegs(segs, adjustRow, adjustTop) { var tempContainer = $("<div/>"); var elements; var segmentContainer = getDaySegmentContainer(); var i; var segCnt = segs.length; var element; tempContainer[0].innerHTML = daySegHTML(segs); // faster than .html() elements = tempContainer.children(); segmentContainer.append(elements); daySegElementResolve(segs, elements); daySegCalcHSides(segs); daySegSetWidths(segs); daySegCalcHeights(segs); daySegSetTops(segs, getRowTops(getRowDivs())); elements = []; for (i=0; i<segCnt; i++) { element = segs[i].element; if (element) { if (segs[i].row === adjustRow) { element.css('top', adjustTop); } elements.push(element[0]); } } return $(elements); } function daySegHTML(segs) { // also sets seg.left and seg.outerWidth var rtl = opt('isRTL'); var i; var segCnt=segs.length; var seg; var event; var url; var classes; var bounds = allDayBounds(); var minLeft = bounds.left; var maxLeft = bounds.right; var leftCol; var rightCol; var left; var right; var skinCss; var html = ''; // calculate desired position/dimensions, create html for (i=0; i<segCnt; i++) { seg = segs[i]; event = seg.event; classes = ['fc-event', 'fc-event-skin', 'fc-event-hori']; if (isEventDraggable(event)) { classes.push('fc-event-draggable'); } if (rtl) { if (seg.isStart) { classes.push('fc-corner-right'); } if (seg.isEnd) { classes.push('fc-corner-left'); } leftCol = dayOfWeekCol(seg.end.getDay()-1); rightCol = dayOfWeekCol(seg.start.getDay()); left = seg.isEnd ? colContentLeft(leftCol) : minLeft; right = seg.isStart ? colContentRight(rightCol) : maxLeft; }else{ if (seg.isStart) { classes.push('fc-corner-left'); } if (seg.isEnd) { classes.push('fc-corner-right'); } leftCol = dayOfWeekCol(seg.start.getDay()); rightCol = dayOfWeekCol(seg.end.getDay()-1); left = seg.isStart ? colContentLeft(leftCol) : minLeft; right = seg.isEnd ? colContentRight(rightCol) : maxLeft; } classes = classes.concat(event.className); if (event.source) { classes = classes.concat(event.source.className || []); } url = event.url; skinCss = getSkinCss(event, opt); if (url) { html += "<a href='" + htmlEscape(url) + "'"; }else{ html += "<div"; } html += " class='" + classes.join(' ') + "'" + " style='position:absolute;z-index:8;left:"+left+"px;" + skinCss + "'" + ">" + "<div" + " class='fc-event-inner fc-event-skin'" + (skinCss ? " style='" + skinCss + "'" : '') + ">"; if (!event.allDay && seg.isStart) { html += "<span class='fc-event-time'>" + htmlEscape(formatDates(event.start, event.end, opt('timeFormat'))) + "</span>"; } html += "<span class='fc-event-title'>" + htmlEscape(event.title) + "</span>" + "</div>"; if (seg.isEnd && isEventResizable(event)) { html += "<div class='ui-resizable-handle ui-resizable-" + (rtl ? 'w' : 'e') + "'>" + "&nbsp;&nbsp;&nbsp;" + // makes hit area a lot better for IE6/7 "</div>"; } html += "</" + (url ? "a" : "div" ) + ">"; seg.left = left; seg.outerWidth = right - left; seg.startCol = leftCol; seg.endCol = rightCol + 1; // needs to be exclusive } return html; } function daySegElementResolve(segs, elements) { // sets seg.element var i; var segCnt = segs.length; var seg; var event; var element; var triggerRes; for (i=0; i<segCnt; i++) { seg = segs[i]; event = seg.event; element = $(elements[i]); // faster than .eq() triggerRes = trigger('eventRender', event, event, element); if (triggerRes === false) { element.remove(); }else{ if (triggerRes && triggerRes !== true) { triggerRes = $(triggerRes) .css({ position: 'absolute', left: seg.left }); element.replaceWith(triggerRes); element = triggerRes; } seg.element = element; } } } function daySegElementReport(segs) { var i; var segCnt = segs.length; var seg; var element; for (i=0; i<segCnt; i++) { seg = segs[i]; element = seg.element; if (element) { reportEventElement(seg.event, element); } } } function daySegHandlers(segs, segmentContainer, modifiedEventId) { var i; var segCnt = segs.length; var seg; var element; var event; // retrieve elements, run through eventRender callback, bind handlers for (i=0; i<segCnt; i++) { seg = segs[i]; element = seg.element; if (element) { event = seg.event; if (event._id === modifiedEventId) { bindDaySeg(event, element, seg); }else{ element[0]._fci = i; // for lazySegBind } } } lazySegBind(segmentContainer, segs, bindDaySeg); } function daySegCalcHSides(segs) { // also sets seg.key var i; var segCnt = segs.length; var seg; var element; var key, val; var hsideCache = {}; // record event horizontal sides for (i=0; i<segCnt; i++) { seg = segs[i]; element = seg.element; if (element) { key = seg.key = cssKey(element[0]); val = hsideCache[key]; if (val === undefined) { val = hsideCache[key] = hsides(element, true); } seg.hsides = val; } } } function daySegSetWidths(segs) { var i; var segCnt = segs.length; var seg; var element; for (i=0; i<segCnt; i++) { seg = segs[i]; element = seg.element; if (element) { element[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px'; } } } function daySegCalcHeights(segs) { var i; var segCnt = segs.length; var seg; var element; var key, val; var vmarginCache = {}; // record event heights for (i=0; i<segCnt; i++) { seg = segs[i]; element = seg.element; if (element) { key = seg.key; // created in daySegCalcHSides val = vmarginCache[key]; if (val === undefined) { val = vmarginCache[key] = vmargins(element); } seg.outerHeight = element[0].offsetHeight + val; } } } function getRowDivs() { var i; var rowCnt = getRowCnt(); var rowDivs = []; for (i=0; i<rowCnt; i++) { rowDivs[i] = allDayRow(i) .find('td:first div.fc-day-content > div'); // optimal selector? } return rowDivs; } function getRowTops(rowDivs) { var i; var rowCnt = rowDivs.length; var tops = []; for (i=0; i<rowCnt; i++) { tops[i] = rowDivs[i][0].offsetTop; // !!?? but this means the element needs position:relative if in a table cell!!!! } return tops; } function daySegSetTops(segs, rowTops) { // also triggers eventAfterRender var i; var segCnt = segs.length; var seg; var element; var event; for (i=0; i<segCnt; i++) { seg = segs[i]; element = seg.element; if (element) { element[0].style.top = rowTops[seg.row] + (seg.top||0) + 'px'; event = seg.event; trigger('eventAfterRender', event, event, element); } } } /* Resizing -----------------------------------------------------------------------------------*/ function resizableDayEvent(event, element, seg) { var rtl = opt('isRTL'); var direction = rtl ? 'w' : 'e'; var handle = element.find('div.ui-resizable-' + direction); var isResizing = false; // TODO: look into using jquery-ui mouse widget for this stuff disableTextSelection(element); // prevent native <a> selection for IE element .mousedown(function(ev) { // prevent native <a> selection for others ev.preventDefault(); }) .click(function(ev) { if (isResizing) { ev.preventDefault(); // prevent link from being visited (only method that worked in IE6) ev.stopImmediatePropagation(); // prevent fullcalendar eventClick handler from being called // (eventElementHandlers needs to be bound after resizableDayEvent) } }); handle.mousedown(function(ev) { if (ev.which != 1) { return; // needs to be left mouse button } isResizing = true; var hoverListener = t.getHoverListener(); var rowCnt = getRowCnt(); var colCnt = getColCnt(); var dis = rtl ? -1 : 1; var dit = rtl ? colCnt-1 : 0; var elementTop = element.css('top'); var dayDelta; var helpers; var eventCopy = $.extend({}, event); var minCell = dateCell(event.start); clearSelection(); $('body') .css('cursor', direction + '-resize') .one('mouseup', mouseup); trigger('eventResizeStart', this, event, ev); hoverListener.start(function(cell, origCell) { if (cell) { var r = Math.max(minCell.row, cell.row); var c = cell.col; if (rowCnt == 1) { r = 0; // hack for all-day area in agenda views } if (r == minCell.row) { if (rtl) { c = Math.min(minCell.col, c); }else{ c = Math.max(minCell.col, c); } } dayDelta = (r*7 + c*dis+dit) - (origCell.row*7 + origCell.col*dis+dit); var newEnd = addDays(eventEnd(event), dayDelta, true); if (dayDelta) { eventCopy.end = newEnd; var oldHelpers = helpers; helpers = renderTempDaySegs(compileDaySegs([eventCopy]), seg.row, elementTop); helpers.find('*').css('cursor', direction + '-resize'); if (oldHelpers) { oldHelpers.remove(); } hideEvents(event); }else{ if (helpers) { showEvents(event); helpers.remove(); helpers = null; } } clearOverlays(); renderDayOverlay(event.start, addDays(cloneDate(newEnd), 1)); // coordinate grid already rebuild at hoverListener.start } }, ev); function mouseup(ev) { trigger('eventResizeStop', this, event, ev); $('body').css('cursor', ''); hoverListener.stop(); clearOverlays(); if (dayDelta) { eventResize(this, event, dayDelta, 0, ev); // event redraw will clear helpers } // otherwise, the drag handler already restored the old events setTimeout(function() { // make this happen after the element's click event isResizing = false; },0); } }); } } //BUG: unselect needs to be triggered when events are dragged+dropped function SelectionManager() { var t = this; // exports t.select = select; t.unselect = unselect; t.reportSelection = reportSelection; t.daySelectionMousedown = daySelectionMousedown; // imports var opt = t.opt; var trigger = t.trigger; var defaultSelectionEnd = t.defaultSelectionEnd; var renderSelection = t.renderSelection; var clearSelection = t.clearSelection; // locals var selected = false; // unselectAuto if (opt('selectable') && opt('unselectAuto')) { $(document).mousedown(function(ev) { var ignore = opt('unselectCancel'); if (ignore) { if ($(ev.target).parents(ignore).length) { // could be optimized to stop after first match return; } } unselect(ev); }); } function select(startDate, endDate, allDay) { unselect(); if (!endDate) { endDate = defaultSelectionEnd(startDate, allDay); } renderSelection(startDate, endDate, allDay); reportSelection(startDate, endDate, allDay); } function unselect(ev) { if (selected) { selected = false; clearSelection(); trigger('unselect', null, ev); } } function reportSelection(startDate, endDate, allDay, ev) { selected = true; trigger('select', null, startDate, endDate, allDay, ev); } function daySelectionMousedown(ev) { // not really a generic manager method, oh well var cellDate = t.cellDate; var cellIsAllDay = t.cellIsAllDay; var hoverListener = t.getHoverListener(); var reportDayClick = t.reportDayClick; // this is hacky and sort of weird if (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button unselect(ev); var _mousedownElement = this; var dates; hoverListener.start(function(cell, origCell) { // TODO: maybe put cellDate/cellIsAllDay info in cell clearSelection(); if (cell && cellIsAllDay(cell)) { dates = [ cellDate(origCell), cellDate(cell) ].sort(cmp); renderSelection(dates[0], dates[1], true); }else{ dates = null; } }, ev); $(document).one('mouseup', function(ev) { hoverListener.stop(); if (dates) { if (+dates[0] == +dates[1]) { reportDayClick(dates[0], true, ev); } reportSelection(dates[0], dates[1], true, ev); } }); } } } function OverlayManager() { var t = this; // exports t.renderOverlay = renderOverlay; t.clearOverlays = clearOverlays; // locals var usedOverlays = []; var unusedOverlays = []; function renderOverlay(rect, parent) { var e = unusedOverlays.shift(); if (!e) { e = $("<div class='fc-cell-overlay' style='position:absolute;z-index:3'/>"); } if (e[0].parentNode != parent[0]) { e.appendTo(parent); } usedOverlays.push(e.css(rect).show()); return e; } function clearOverlays() { var e; while (e = usedOverlays.shift()) { unusedOverlays.push(e.hide().unbind()); } } } function CoordinateGrid(buildFunc) { var t = this; var rows; var cols; t.build = function() { rows = []; cols = []; buildFunc(rows, cols); }; t.cell = function(x, y) { var rowCnt = rows.length; var colCnt = cols.length; var i, r=-1, c=-1; for (i=0; i<rowCnt; i++) { if (y >= rows[i][0] && y < rows[i][1]) { r = i; break; } } for (i=0; i<colCnt; i++) { if (x >= cols[i][0] && x < cols[i][1]) { c = i; break; } } return (r>=0 && c>=0) ? { row:r, col:c } : null; }; t.rect = function(row0, col0, row1, col1, originElement) { // row1,col1 is inclusive var origin = originElement.offset(); return { top: rows[row0][0] - origin.top, left: cols[col0][0] - origin.left, width: cols[col1][1] - cols[col0][0], height: rows[row1][1] - rows[row0][0] }; }; } function HoverListener(coordinateGrid) { var t = this; var bindType; var change; var firstCell; var cell; t.start = function(_change, ev, _bindType) { change = _change; firstCell = cell = null; coordinateGrid.build(); mouse(ev); bindType = _bindType || 'mousemove'; $(document).bind(bindType, mouse); }; function mouse(ev) { _fixUIEvent(ev); // see below var newCell = coordinateGrid.cell(ev.pageX, ev.pageY); if (!newCell != !cell || newCell && (newCell.row != cell.row || newCell.col != cell.col)) { if (newCell) { if (!firstCell) { firstCell = newCell; } change(newCell, firstCell, newCell.row-firstCell.row, newCell.col-firstCell.col); }else{ change(newCell, firstCell); } cell = newCell; } } t.stop = function() { $(document).unbind(bindType, mouse); return cell; }; } // this fix was only necessary for jQuery UI 1.8.16 (and jQuery 1.7 or 1.7.1) // upgrading to jQuery UI 1.8.17 (and using either jQuery 1.7 or 1.7.1) fixed the problem // but keep this in here for 1.8.16 users // and maybe remove it down the line function _fixUIEvent(event) { // for issue 1168 if (event.pageX === undefined) { event.pageX = event.originalEvent.pageX; event.pageY = event.originalEvent.pageY; } } function HorizontalPositionCache(getElement) { var t = this, elements = {}, lefts = {}, rights = {}; function e(i) { return elements[i] = elements[i] || getElement(i); } t.left = function(i) { return lefts[i] = lefts[i] === undefined ? e(i).position().left : lefts[i]; }; t.right = function(i) { return rights[i] = rights[i] === undefined ? t.left(i) + e(i).width() : rights[i]; }; t.clear = function() { elements = {}; lefts = {}; rights = {}; }; } })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/fullcalendar-1.5.3/fullcalendar-1.5.3/fullcalendar/fullcalendar.js
JavaScript
gpl2
124,738
/*! * jQuery Templates Plugin 1.0.0pre * http://github.com/jquery/jquery-tmpl * Requires jQuery 1.4.2 * * Copyright 2011, Software Freedom Conservancy, Inc. * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license */ (function( jQuery, undefined ){ var oldManip = jQuery.fn.domManip, tmplItmAtt = "_tmplitem", htmlExpr = /^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /, newTmplItems = {}, wrappedItems = {}, appendToTmplItems, topTmplItem = { key: 0, data: {} }, itemKey = 0, cloneIndex = 0, stack = []; function newTmplItem( options, parentItem, fn, data ) { // Returns a template item data structure for a new rendered instance of a template (a 'template item'). // The content field is a hierarchical array of strings and nested items (to be // removed and replaced by nodes field of dom elements, once inserted in DOM). var newItem = { data: data || (data === 0 || data === false) ? data : (parentItem ? parentItem.data : {}), _wrap: parentItem ? parentItem._wrap : null, tmpl: null, parent: parentItem || null, nodes: [], calls: tiCalls, nest: tiNest, wrap: tiWrap, html: tiHtml, update: tiUpdate }; if ( options ) { jQuery.extend( newItem, options, { nodes: [], parent: parentItem }); } if ( fn ) { // Build the hierarchical content to be used during insertion into DOM newItem.tmpl = fn; newItem._ctnt = newItem._ctnt || newItem.tmpl( jQuery, newItem ); newItem.key = ++itemKey; // Keep track of new template item, until it is stored as jQuery Data on DOM element (stack.length ? wrappedItems : newTmplItems)[itemKey] = newItem; } return newItem; } // Override appendTo etc., in order to provide support for targeting multiple elements. (This code would disappear if integrated in jquery core). jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var ret = [], insert = jQuery( selector ), elems, i, l, tmplItems, parent = this.length === 1 && this[0].parentNode; appendToTmplItems = newTmplItems || {}; if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { insert[ original ]( this[0] ); ret = this; } else { for ( i = 0, l = insert.length; i < l; i++ ) { cloneIndex = i; elems = (i > 0 ? this.clone(true) : this).get(); jQuery( insert[i] )[ original ]( elems ); ret = ret.concat( elems ); } cloneIndex = 0; ret = this.pushStack( ret, name, insert.selector ); } tmplItems = appendToTmplItems; appendToTmplItems = null; jQuery.tmpl.complete( tmplItems ); return ret; }; }); jQuery.fn.extend({ // Use first wrapped element as template markup. // Return wrapped set of template items, obtained by rendering template against data. tmpl: function( data, options, parentItem ) { return jQuery.tmpl( this[0], data, options, parentItem ); }, // Find which rendered template item the first wrapped DOM element belongs to tmplItem: function() { return jQuery.tmplItem( this[0] ); }, // Consider the first wrapped element as a template declaration, and get the compiled template or store it as a named template. template: function( name ) { return jQuery.template( name, this[0] ); }, domManip: function( args, table, callback, options ) { if ( args[0] && jQuery.isArray( args[0] )) { var dmArgs = jQuery.makeArray( arguments ), elems = args[0], elemsLength = elems.length, i = 0, tmplItem; while ( i < elemsLength && !(tmplItem = jQuery.data( elems[i++], "tmplItem" ))) {} if ( tmplItem && cloneIndex ) { dmArgs[2] = function( fragClone ) { // Handler called by oldManip when rendered template has been inserted into DOM. jQuery.tmpl.afterManip( this, fragClone, callback ); }; } oldManip.apply( this, dmArgs ); } else { oldManip.apply( this, arguments ); } cloneIndex = 0; if ( !appendToTmplItems ) { jQuery.tmpl.complete( newTmplItems ); } return this; } }); jQuery.extend({ // Return wrapped set of template items, obtained by rendering template against data. tmpl: function( tmpl, data, options, parentItem ) { var ret, topLevel = !parentItem; if ( topLevel ) { // This is a top-level tmpl call (not from a nested template using {{tmpl}}) parentItem = topTmplItem; tmpl = jQuery.template[tmpl] || jQuery.template( null, tmpl ); wrappedItems = {}; // Any wrapped items will be rebuilt, since this is top level } else if ( !tmpl ) { // The template item is already associated with DOM - this is a refresh. // Re-evaluate rendered template for the parentItem tmpl = parentItem.tmpl; newTmplItems[parentItem.key] = parentItem; parentItem.nodes = []; if ( parentItem.wrapped ) { updateWrapped( parentItem, parentItem.wrapped ); } // Rebuild, without creating a new template item return jQuery( build( parentItem, null, parentItem.tmpl( jQuery, parentItem ) )); } if ( !tmpl ) { return []; // Could throw... } if ( typeof data === "function" ) { data = data.call( parentItem || {} ); } if ( options && options.wrapped ) { updateWrapped( options, options.wrapped ); } ret = jQuery.isArray( data ) ? jQuery.map( data, function( dataItem ) { return dataItem ? newTmplItem( options, parentItem, tmpl, dataItem ) : null; }) : [ newTmplItem( options, parentItem, tmpl, data ) ]; return topLevel ? jQuery( build( parentItem, null, ret ) ) : ret; }, // Return rendered template item for an element. tmplItem: function( elem ) { var tmplItem; if ( elem instanceof jQuery ) { elem = elem[0]; } while ( elem && elem.nodeType === 1 && !(tmplItem = jQuery.data( elem, "tmplItem" )) && (elem = elem.parentNode) ) {} return tmplItem || topTmplItem; }, // Set: // Use $.template( name, tmpl ) to cache a named template, // where tmpl is a template string, a script element or a jQuery instance wrapping a script element, etc. // Use $( "selector" ).template( name ) to provide access by name to a script block template declaration. // Get: // Use $.template( name ) to access a cached template. // Also $( selectorToScriptBlock ).template(), or $.template( null, templateString ) // will return the compiled template, without adding a name reference. // If templateString includes at least one HTML tag, $.template( templateString ) is equivalent // to $.template( null, templateString ) template: function( name, tmpl ) { if (tmpl) { // Compile template and associate with name if ( typeof tmpl === "string" ) { // This is an HTML string being passed directly in. tmpl = buildTmplFn( tmpl ); } else if ( tmpl instanceof jQuery ) { tmpl = tmpl[0] || {}; } if ( tmpl.nodeType ) { // If this is a template block, use cached copy, or generate tmpl function and cache. tmpl = jQuery.data( tmpl, "tmpl" ) || jQuery.data( tmpl, "tmpl", buildTmplFn( tmpl.innerHTML )); // Issue: In IE, if the container element is not a script block, the innerHTML will remove quotes from attribute values whenever the value does not include white space. // This means that foo="${x}" will not work if the value of x includes white space: foo="${x}" -> foo=value of x. // To correct this, include space in tag: foo="${ x }" -> foo="value of x" } return typeof name === "string" ? (jQuery.template[name] = tmpl) : tmpl; } // Return named compiled template return name ? (typeof name !== "string" ? jQuery.template( null, name ): (jQuery.template[name] || // If not in map, and not containing at least on HTML tag, treat as a selector. // (If integrated with core, use quickExpr.exec) jQuery.template( null, htmlExpr.test( name ) ? name : jQuery( name )))) : null; }, encode: function( text ) { // Do HTML encoding replacing < > & and ' and " by corresponding entities. return ("" + text).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;"); } }); jQuery.extend( jQuery.tmpl, { tag: { "tmpl": { _default: { $2: "null" }, open: "if($notnull_1){__=__.concat($item.nest($1,$2));}" // tmpl target parameter can be of type function, so use $1, not $1a (so not auto detection of functions) // This means that {{tmpl foo}} treats foo as a template (which IS a function). // Explicit parens can be used if foo is a function that returns a template: {{tmpl foo()}}. }, "wrap": { _default: { $2: "null" }, open: "$item.calls(__,$1,$2);__=[];", close: "call=$item.calls();__=call._.concat($item.wrap(call,__));" }, "each": { _default: { $2: "$index, $value" }, open: "if($notnull_1){$.each($1a,function($2){with(this){", close: "}});}" }, "if": { open: "if(($notnull_1) && $1a){", close: "}" }, "else": { _default: { $1: "true" }, open: "}else if(($notnull_1) && $1a){" }, "html": { // Unecoded expression evaluation. open: "if($notnull_1){__.push($1a);}" }, "=": { // Encoded expression evaluation. Abbreviated form is ${}. _default: { $1: "$data" }, open: "if($notnull_1){__.push($.encode($1a));}" }, "!": { // Comment tag. Skipped by parser open: "" } }, // This stub can be overridden, e.g. in jquery.tmplPlus for providing rendered events complete: function( items ) { newTmplItems = {}; }, // Call this from code which overrides domManip, or equivalent // Manage cloning/storing template items etc. afterManip: function afterManip( elem, fragClone, callback ) { // Provides cloned fragment ready for fixup prior to and after insertion into DOM var content = fragClone.nodeType === 11 ? jQuery.makeArray(fragClone.childNodes) : fragClone.nodeType === 1 ? [fragClone] : []; // Return fragment to original caller (e.g. append) for DOM insertion callback.call( elem, fragClone ); // Fragment has been inserted:- Add inserted nodes to tmplItem data structure. Replace inserted element annotations by jQuery.data. storeTmplItems( content ); cloneIndex++; } }); //========================== Private helper functions, used by code above ========================== function build( tmplItem, nested, content ) { // Convert hierarchical content into flat string array // and finally return array of fragments ready for DOM insertion var frag, ret = content ? jQuery.map( content, function( item ) { return (typeof item === "string") ? // Insert template item annotations, to be converted to jQuery.data( "tmplItem" ) when elems are inserted into DOM. (tmplItem.key ? item.replace( /(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g, "$1 " + tmplItmAtt + "=\"" + tmplItem.key + "\" $2" ) : item) : // This is a child template item. Build nested template. build( item, tmplItem, item._ctnt ); }) : // If content is not defined, insert tmplItem directly. Not a template item. May be a string, or a string array, e.g. from {{html $item.html()}}. tmplItem; if ( nested ) { return ret; } // top-level template ret = ret.join(""); // Support templates which have initial or final text nodes, or consist only of text // Also support HTML entities within the HTML markup. ret.replace( /^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/, function( all, before, middle, after) { frag = jQuery( middle ).get(); storeTmplItems( frag ); if ( before ) { frag = unencode( before ).concat(frag); } if ( after ) { frag = frag.concat(unencode( after )); } }); return frag ? frag : unencode( ret ); } function unencode( text ) { // Use createElement, since createTextNode will not render HTML entities correctly var el = document.createElement( "div" ); el.innerHTML = text; return jQuery.makeArray(el.childNodes); } // Generate a reusable function that will serve to render a template against data function buildTmplFn( markup ) { return new Function("jQuery","$item", // Use the variable __ to hold a string array while building the compiled template. (See https://github.com/jquery/jquery-tmpl/issues#issue/10). "var $=jQuery,call,__=[],$data=$item.data;" + // Introduce the data as local variables using with(){} "with($data){__.push('" + // Convert the template into pure JavaScript jQuery.trim(markup) .replace( /([\\'])/g, "\\$1" ) .replace( /[\r\t\n]/g, " " ) .replace( /\$\{([^\}]*)\}/g, "{{= $1}}" ) .replace( /\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g, function( all, slash, type, fnargs, target, parens, args ) { var tag = jQuery.tmpl.tag[ type ], def, expr, exprAutoFnDetect; if ( !tag ) { throw "Unknown template tag: " + type; } def = tag._default || []; if ( parens && !/\w$/.test(target)) { target += parens; parens = ""; } if ( target ) { target = unescape( target ); args = args ? ("," + unescape( args ) + ")") : (parens ? ")" : ""); // Support for target being things like a.toLowerCase(); // In that case don't call with template item as 'this' pointer. Just evaluate... expr = parens ? (target.indexOf(".") > -1 ? target + unescape( parens ) : ("(" + target + ").call($item" + args)) : target; exprAutoFnDetect = parens ? expr : "(typeof(" + target + ")==='function'?(" + target + ").call($item):(" + target + "))"; } else { exprAutoFnDetect = expr = def.$1 || "null"; } fnargs = unescape( fnargs ); return "');" + tag[ slash ? "close" : "open" ] .split( "$notnull_1" ).join( target ? "typeof(" + target + ")!=='undefined' && (" + target + ")!=null" : "true" ) .split( "$1a" ).join( exprAutoFnDetect ) .split( "$1" ).join( expr ) .split( "$2" ).join( fnargs || def.$2 || "" ) + "__.push('"; }) + "');}return __;" ); } function updateWrapped( options, wrapped ) { // Build the wrapped content. options._wrap = build( options, true, // Suport imperative scenario in which options.wrapped can be set to a selector or an HTML string. jQuery.isArray( wrapped ) ? wrapped : [htmlExpr.test( wrapped ) ? wrapped : jQuery( wrapped ).html()] ).join(""); } function unescape( args ) { return args ? args.replace( /\\'/g, "'").replace(/\\\\/g, "\\" ) : null; } function outerHtml( elem ) { var div = document.createElement("div"); div.appendChild( elem.cloneNode(true) ); return div.innerHTML; } // Store template items in jQuery.data(), ensuring a unique tmplItem data data structure for each rendered template instance. function storeTmplItems( content ) { var keySuffix = "_" + cloneIndex, elem, elems, newClonedItems = {}, i, l, m; for ( i = 0, l = content.length; i < l; i++ ) { if ( (elem = content[i]).nodeType !== 1 ) { continue; } elems = elem.getElementsByTagName("*"); for ( m = elems.length - 1; m >= 0; m-- ) { processItemKey( elems[m] ); } processItemKey( elem ); } function processItemKey( el ) { var pntKey, pntNode = el, pntItem, tmplItem, key; // Ensure that each rendered template inserted into the DOM has its own template item, if ( (key = el.getAttribute( tmplItmAtt ))) { while ( pntNode.parentNode && (pntNode = pntNode.parentNode).nodeType === 1 && !(pntKey = pntNode.getAttribute( tmplItmAtt ))) { } if ( pntKey !== key ) { // The next ancestor with a _tmplitem expando is on a different key than this one. // So this is a top-level element within this template item // Set pntNode to the key of the parentNode, or to 0 if pntNode.parentNode is null, or pntNode is a fragment. pntNode = pntNode.parentNode ? (pntNode.nodeType === 11 ? 0 : (pntNode.getAttribute( tmplItmAtt ) || 0)) : 0; if ( !(tmplItem = newTmplItems[key]) ) { // The item is for wrapped content, and was copied from the temporary parent wrappedItem. tmplItem = wrappedItems[key]; tmplItem = newTmplItem( tmplItem, newTmplItems[pntNode]||wrappedItems[pntNode] ); tmplItem.key = ++itemKey; newTmplItems[itemKey] = tmplItem; } if ( cloneIndex ) { cloneTmplItem( key ); } } el.removeAttribute( tmplItmAtt ); } else if ( cloneIndex && (tmplItem = jQuery.data( el, "tmplItem" )) ) { // This was a rendered element, cloned during append or appendTo etc. // TmplItem stored in jQuery data has already been cloned in cloneCopyEvent. We must replace it with a fresh cloned tmplItem. cloneTmplItem( tmplItem.key ); newTmplItems[tmplItem.key] = tmplItem; pntNode = jQuery.data( el.parentNode, "tmplItem" ); pntNode = pntNode ? pntNode.key : 0; } if ( tmplItem ) { pntItem = tmplItem; // Find the template item of the parent element. // (Using !=, not !==, since pntItem.key is number, and pntNode may be a string) while ( pntItem && pntItem.key != pntNode ) { // Add this element as a top-level node for this rendered template item, as well as for any // ancestor items between this item and the item of its parent element pntItem.nodes.push( el ); pntItem = pntItem.parent; } // Delete content built during rendering - reduce API surface area and memory use, and avoid exposing of stale data after rendering... delete tmplItem._ctnt; delete tmplItem._wrap; // Store template item as jQuery data on the element jQuery.data( el, "tmplItem", tmplItem ); } function cloneTmplItem( key ) { key = key + keySuffix; tmplItem = newClonedItems[key] = (newClonedItems[key] || newTmplItem( tmplItem, newTmplItems[tmplItem.parent.key + keySuffix] || tmplItem.parent )); } } } //---- Helper functions for template item ---- function tiCalls( content, tmpl, data, options ) { if ( !content ) { return stack.pop(); } stack.push({ _: content, tmpl: tmpl, item:this, data: data, options: options }); } function tiNest( tmpl, data, options ) { // nested template, using {{tmpl}} tag return jQuery.tmpl( jQuery.template( tmpl ), data, options, this ); } function tiWrap( call, wrapped ) { // nested template, using {{wrap}} tag var options = call.options || {}; options.wrapped = wrapped; // Apply the template, which may incorporate wrapped content, return jQuery.tmpl( jQuery.template( call.tmpl ), call.data, options, call.item ); } function tiHtml( filter, textOnly ) { var wrapped = this._wrap; return jQuery.map( jQuery( jQuery.isArray( wrapped ) ? wrapped.join("") : wrapped ).filter( filter || "*" ), function(e) { return textOnly ? e.innerText || e.textContent : e.outerHTML || outerHtml(e); }); } function tiUpdate() { var coll = this.nodes; jQuery.tmpl( null, null, null, this).insertBefore( coll[0] ); jQuery( coll ).remove(); } })( jQuery );
zzyn125-bench
BigMelon/Backup/jslib_backup/jquery.tmpl.js
JavaScript
gpl2
19,093
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Customers</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery-jtemplates.js"></script> <link rel="stylesheet" href="style.css"> <script type="text/javascript"> $(document).ready(function() { //set template $("#CustomersList").setTemplateElement("Template-List"); //add parameter using to calculate "age" $("#CustomersList").setParam("year", 2012); //process template $("#CustomersList").processTemplateURL("data.json"); //set template for detailed info $("#CustomerDetails").setTemplateElement("Template-Details"); }); //show customer detail, run from template function ShowDetails(cust) { //process a template $("#CustomerDetails").processTemplate(cust); } </script> </head> <body> <!-- Templates --> <p style="display:none"><textarea id="Template-List" rows="0" cols="0"><!-- {#template MAIN} <table> <tr class="{#cycle values=['bcEEC','bcCEE']}"> <td class="header">Details</td> <td class="header">Name</td> <td class="header">Age</td> </tr> {#foreach $T.Customers as Cust} {#include ROW root=$T.Cust} {#/for} </table> {#/template MAIN} {#template ROW} <tr class="{#cycle values=['bcEED','bcDEE']}"> <td><a href="#" onclick="ShowDetails({#var $T})">SELECT</a></td> <td>{$T.FirstName} {$T.LastName}</td> <td>{$P.year-$T.Born}</td> </tr> {#/template ROW} --></textarea></p> <p style="display:none"><textarea id="Template-Details" rows="0" cols="0"><!-- <table> <tr><td class="header">First Name</td><td>{$T.FirstName}</td></tr> <tr><td class="header">Last Name</td><td>{$T.LastName}</td></tr> <tr><td class="header">Born</td><td>{$T.Born}</td></tr> <tr><td class="header">E-mail</td><td>{$T.Email.link('mailto:'+$T.Email)}</td></tr> </table> --></textarea></p> <!-- Output elements --> <div id="CustomersList" class="Content"></div> <div id="CustomerDetails" class="Content"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jTemplates_examples/customers.html
HTML
gpl2
2,438
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Items</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery-jtemplates.js"></script> <link rel="stylesheet" href="style.css"> <script type="text/javascript"> $(document).ready(function() { //set template and process $("#Items").setTemplateElement("Template-Items").processTemplateURL("data.json"); }); </script> </head> <body> <!-- Templates --> <p style="display:none"><textarea id="Template-Items" rows="0" cols="0"><!-- <table> <tr> <td class="header">Name</td> <td class="header CellDecimal">Sales Prce</td> </tr> {#foreach $T.Items as Item} <tr class="{#cycle values=['bcEED','bcDEE']}"> <td>{$T.Item.Name}</td> <td class="CellDecimal">{$T.Item.SalesPrice}</td> </tr> {#/for} </table> --></textarea></p> <!-- Output elements --> <div id="Items" class="Content"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jTemplates_examples/items.html
HTML
gpl2
1,227
.Content { background: #DDD; border: 1px solid #000; margin: 2em; width: 320px; } .Content * { padding: 4px; margin: 2px auto; } .Content td,tr { border: 1px solid black; } .Content td.header { background: #CCC; font-weight: bold; } .title { font-size: large; font-weight: bold; text-align: center; } .bcEED { background: #EED; } .bcDEE { background: #DEE; } .CellDecimal { text-align: right; }
zzyn125-bench
BigMelon/Backup/jslib_backup/jTemplates_examples/style.css
CSS
gpl2
484
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Sales</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery-jtemplates.js"></script> <link rel="stylesheet" href="style.css"> <script type="text/javascript"> <!-- //global variables Items = null; Customers = null; Sales = null; //update selection of Customers and refresh entries function UpdateCustomer(elem, index) { Customers[index].selected = elem.checked; UpdatEntries(); } //update selection of Items and refresh entries function UpdateItem(elem, index) { Items[index].selected = elem.checked; UpdatEntries(); } //refresh entries function UpdatEntries() { //local key cache var CustCacheMap = {}; var ItemCacheMap = {}; //build key cache for(var i=0; i<Customers.length; ++i) { CustCacheMap[Customers[i].ID] = Customers[i]; } for(var i=0; i<Items.length; ++i) { ItemCacheMap[Items[i].ID] = Items[i]; } //create resultset from all Sales entries var entries = $.map(Sales, function(e) { //find customer and item var cust = CustCacheMap[e.CustomerID]; var item = ItemCacheMap[e.ItemID]; //if customer of item not found skip record if(cust == null || item == null) { return null; } //if both customer and item are selected then put record if(cust.selected && item.selected) { return [{ "CustName": cust.FirstName + ' ' + cust.LastName, "ItemName": item.Name, "Price": e.SalesPrice, "Cost": e.UnitCost }]; } else { return null; } }); //process template $("#Entries").processTemplate(entries); } $(document).ready(function() { //load data $.getJSON('data.json', function(data) { Items = data.Items; Customers = data.Customers; Sales = data.SalesEntry; //setup templates $("#Customers").setTemplateElement("Template-ListCustomers").processTemplate(Customers); $("#Items").setTemplateElement("Template-ListItems").processTemplate(Items); $("#Entries").setTemplateElement("Template-Entries"); $("#Entries").processTemplate(null); //process empty data to show header }); }); --> </script> </head> <body> <!-- Templates --> <p style="display:none"><textarea id="Template-ListCustomers" rows="0" cols="0"><!-- <div class="title">Customers</div> <table> <tr> <td class="header">Choose</td> <td class="header">Name</td> </tr> {#foreach $T as Row} <tr class="{#cycle values=['bcEED','bcDEE']}"> <td><input type="checkbox" value="{$T.Row.ID}" onclick="UpdateCustomer(this,{$T.Row$index})") /></td> <td>{$T.Row.FirstName} {$T.Row.LastName}</td> </tr> {#/for} </table> --></textarea></p> <p style="display:none"><textarea id="Template-ListItems" rows="0" cols="0"><!-- <div class="title">Items</div> <table> <tr> <td class="header">Choose</td> <td class="header">Name</td> </tr> {#foreach $T as Row} <tr class="{#cycle values=['bcEED','bcDEE']}"> <td><input type="checkbox" value="{$T.Row.ID}" onclick="UpdateItem(this,{$T.Row$index})") /></td> <td>{$T.Row.Name}</td> </tr> {#/for} </table> --></textarea></p> <p style="display:none"><textarea id="Template-Entries" rows="0" cols="0"><!-- <div class="title">Entries</div> <table> <tr> <td class="header">Customer</td> <td class="header">Item</td> <td class="header">Price</td> <td class="header">Cost</td> <td class="header">Profit</td> </tr> {#param name=ProfitTotal value=0} {#foreach $T as Row} <tr class="{#cycle values=['bcEED','bcDEE']}"> <td>{$T.Row.CustName}</td> <td>{$T.Row.ItemName}</td> <td>{$T.Row.Price}</td> <td>{$T.Row.Cost}</td> <td>{$T.Row.Price - $T.Row.Cost}</td> </tr> {#param name=ProfitTotal value=$P.ProfitTotal + ($T.Row.Price - $T.Row.Cost)} {#/for} <tr> <td class="header"></td> <td class="header"></td> <td class="header"></td> <td class="header">Total:</td> <td class="header">{$P.ProfitTotal}</td> </tr> </table> --></textarea></p> <!-- Output elements --> <div id="Customers" class="Content"></div> <div id="Items" class="Content"></div> <div id="Entries" class="Content"></div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/jTemplates_examples/sales.html
HTML
gpl2
5,129
/*! jsObservable: http://github.com/BorisMoore/jsviews */ /* * Subcomponent of JsViews * Data change events for data-linking * * Copyright 2012, Boris Moore and Brad Olenick * Released under the MIT License. */ // informal pre beta commit counter: 7 (function ( $, undefined ) { $.observable = function( data, options ) { return $.isArray( data ) ? new ArrayObservable( data ) : new ObjectObservable( data ); }; var splice = [].splice; function ObjectObservable( data ) { if ( !this.data ) { return new ObjectObservable( data ); } this._data = data; return this; }; $.observable.Object = ObjectObservable; ObjectObservable.prototype = { _data: null, data: function() { return this._data; }, afterChange: function( path, callback ) { }, setProperty: function( path, value ) { // TODO in the case of multiple changes (object): raise single propertyChanges event (which may span different objects, via paths) with set of changes. if ( $.isArray( path ) ) { // This is the array format generated by serializeArray. However, this has the problem that it coerces types to string, // and does not provide simple support of convertTo and convertFrom functions. // TODO: We've discussed an "objectchange" event to capture all N property updates here. See TODO note above about propertyChanges. for ( var i = 0, l = path.length; i < l; i++ ) { var pair = path[i]; this.setProperty( pair.name, pair.value ); } } else if ( typeof( path ) === "object" ) { // Object representation where property name is path and property value is value. // TODO: We've discussed an "objectchange" event to capture all N property updates here. See TODO note above about propertyChanges. for ( var key in path ) { this.setProperty( key, path[ key ]); } } else { // Simple single property case. var object = this._data, leaf = getLeafObject( object, path ); path = leaf[1]; leaf = leaf[0]; if ( leaf ) { this._setProperty( leaf, path, value ); } } return this; }, _setProperty: function( leaf, path, value ) { var setter, property = leaf[ path ]; if ( $.isFunction( property ) ) { // Case of property setter/getter - with convention that property() is getter and property( value ) is setter setter = property; property = property.call( leaf ); //get } if ( property != value ) { // test for non-strict equality, since serializeArray, and form-based editors can map numbers to strings, etc. if ( setter ) { setter.call( leaf, value ); //set value = setter.call( leaf ); //get updated value } else { leaf[ path ] = value; } this._trigger( leaf, { path: path, value: value, oldValue: property } ); } }, _trigger: function( target, eventArgs ) { $( target ).triggerHandler( "propertyChange", eventArgs ); } }; function getLeafObject( object, path ) { if ( object && path ) { var parts = path.split("."); path = parts.pop(); while ( object && parts.length ) { object = object[ parts.shift() ]; } return [ object, path ]; } return []; }; function ArrayObservable( data ) { if ( !this.data ) { return new ArrayObservable( data ); } this._data = data; return this; }; function validateIndex( index ) { if ( typeof index !== "number" ) { throw "Invalid index."; } }; $.observable.Array = ArrayObservable; ArrayObservable.prototype = { _data: null, data: function() { return this._data; }, insert: function( index, data ) { validateIndex( index ); if ( arguments.length > 1 ) { data = $.isArray( data ) ? data : [ data ]; // TODO: Clone array here? // data can be a single item (including a null/undefined value) or an array of items. if ( data.length > 0 ) { this._insert( index, data ); } } return this; }, _insert: function( index, data ) { splice.apply( this._data, [ index, 0 ].concat( data )); this._trigger( { change: "insert", index: index, items: data } ); }, remove: function( index, numToRemove ) { validateIndex( index ); numToRemove = ( numToRemove === undefined || numToRemove === null ) ? 1 : numToRemove; if ( numToRemove && index > -1 ) { var items = this._data.slice( index, index + numToRemove ); numToRemove = items.length; if ( numToRemove ) { this._remove( index, numToRemove, items ); } } return this; }, _remove: function( index, numToRemove, items ) { this._data.splice( index, numToRemove ); this._trigger( { change: "remove", index: index, items: items } ); }, move: function( oldIndex, newIndex, numToMove ) { validateIndex( oldIndex ); validateIndex( newIndex ); numToMove = ( numToMove === undefined || numToMove === null ) ? 1 : numToMove; if ( numToMove ) { var items = this._data.slice( oldIndex, oldIndex + numToMove ); this._move( oldIndex, newIndex, numToMove, items ); } return this; }, _move: function( oldIndex, newIndex, numToMove, items ) { this._data.splice( oldIndex, numToMove ); this._data.splice.apply( this._data, [ newIndex, 0 ].concat( items ) ); this._trigger( { change: "move", oldIndex: oldIndex, index: newIndex, items: items } ); }, refresh: function( newItems ) { var oldItems = this._data.slice( 0 ); this._refresh( oldItems, newItems ); return this; }, _refresh: function( oldItems, newItems ) { splice.apply( this._data, [ 0, this._data.length ].concat( newItems )); this._trigger( { change: "refresh", oldItems: oldItems } ); }, _trigger: function( eventArgs ) { $([ this._data ]).triggerHandler( "arrayChange", eventArgs ); } }; })(jQuery);
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsviews/jquery.observable.js
JavaScript
gpl2
5,753
<!DOCTYPE html> <html> <head> <title>JsViews: Step by step</title> <link href="resources/demos.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="subhead"><< <a href="index.html">Index for JsViews and JsRender</a></div> <h2>JsViews: Demos</h2> <ul class="indexitems"> <li><a href="step-by-step/01_rendering-and-linking.html">Rendering and linking</a></li> <li><a href="step-by-step/02_accordion_switching-template.html">Switch templates: Accordion</a></li> <li><a href="step-by-step/03_tree-view_recursive-nested-each.html">Recursive Tree View - {{for}}</a></li> <li><a href="step-by-step/04_editable-data.html">Full declarative data-linking with <em>'observable'</em> editable data and arrays</a></li> <li><a href="step-by-step/05_server-rendered_client-activated.html">Server-render then client-activate</a></li> <li><a href="step-by-step/06_top-level-linking.html">Top-level data-linking</a></li> <li><a href="step-by-step/07_form-elements.html">Form Elements</a></li><a <li><a href="step-by-step/10_todos.html">Todos sample app</a></li> </ul> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsviews/demos/demos.html
HTML
gpl2
1,092
/* Sample inspired by Backbone Todos sample: http://documentcloud.github.com/backbone/examples/todos/index.html */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } body { line-height: 1; color: black; background: white; } ol, ul { list-style: none; } a img { border: none; } html { background: #eeeeee; } body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.4em; background: #eeeeee; color: #333333; } #todoapp { width: 480px; margin: 0 auto 40px; background: white; padding: 20px; -moz-box-shadow: rgba(0, 0, 0, 0.2) 0 5px 6px 0; -webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 5px 6px 0; -o-box-shadow: rgba(0, 0, 0, 0.2) 0 5px 6px 0; box-shadow: rgba(0, 0, 0, 0.2) 0 5px 6px 0; } #todoapp h1 { font-size: 36px; font-weight: bold; text-align: center; padding: 20px 0 30px 0; line-height: 1; } #new-todo { position: relative; width: 466px; font-size: 24px; font-family: inherit; line-height: 1.4em; border: 0; outline: none; padding: 6px; border: 1px solid #999999; -moz-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset; -webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset; -o-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset; box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset; } #create-todo input::-webkit-input-placeholder { font-style: italic; } #create-todo span { position: absolute; z-index: 999; width: 170px; left: 50%; margin-left: -85px; } #todo-list { margin-top: 10px; } #todo-list li { padding: 12px 20px 11px 0; position: relative; font-size: 24px; line-height: 1.1em; border-bottom: 1px solid #cccccc; } #todo-list li:after { content: "\0020"; display: block; height: 0; clear: both; overflow: hidden; visibility: hidden; } #todo-list .editing { padding: 0; border-bottom: 0; } #todo-list .editing input { width: 444px; font-size: 24px; font-family: inherit; margin: 0; line-height: 1.6em; border: 0; outline: none; padding: 10px 7px 0px 27px; border: 1px solid #999999; -moz-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset; -webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset; -o-box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset; box-shadow: rgba(0, 0, 0, 0.2) 0 1px 2px 0 inset; } #todo-list input[type=checkbox] { position: relative; top: 9px; margin: 0 10px 0 7px; float: left; } #todo-list .done .todo-content { text-decoration: line-through; color: #777777; } #todo-list .todo-destroy { position: absolute; right: 5px; top: 14px; display: none; cursor: pointer; width: 20px; height: 20px; background: url(http://documentcloud.github.com/backbone/examples/todos/destroy.png) no-repeat 0 0; } #todo-list li:hover .todo-destroy { display: block; } #todo-list .todo-destroy:hover { background-position: 0 -20px; } #todo-stats { *zoom: 1; margin-top: 10px; color: #777777; } #todo-stats:after { content: "\0020"; display: block; height: 0; clear: both; overflow: hidden; visibility: hidden; } #todo-stats .todo-count { float: left; } #todo-stats .todo-count .number { font-weight: bold; color: #333333; } #todo-stats .todo-clear { float: right; } #todo-stats .todo-clear a { color: #777777; font-size: 12px; } #todo-stats .todo-clear a:visited { color: #777777; } #todo-stats .todo-clear a:hover { color: #336699; } #instructions { width: 520px; margin: 10px auto; color: #777777; text-shadow: rgba(255, 255, 255, 0.8) 0 1px 0; text-align: center; } #instructions a { color: #336699; } #credits { width: 520px; margin: 30px auto; color: #999; text-shadow: rgba(255, 255, 255, 0.8) 0 1px 0; text-align: center; } #credits a { color: #888; } /* * François 'cahnory' Germain */ .ui-tooltip, .ui-tooltip-top, .ui-tooltip-right, .ui-tooltip-bottom, .ui-tooltip-left { color:#ffffff; cursor:normal; display:-moz-inline-stack; display:inline-block; font-size:12px; font-family:arial; padding:.5em 1em; position:relative; text-align:center; text-shadow:0 -1px 1px #111111; -webkit-border-top-left-radius:4px ; -webkit-border-top-right-radius:4px ; -webkit-border-bottom-right-radius:4px ; -webkit-border-bottom-left-radius:4px ; -khtml-border-top-left-radius:4px ; -khtml-border-top-right-radius:4px ; -khtml-border-bottom-right-radius:4px ; -khtml-border-bottom-left-radius:4px ; -moz-border-radius-topleft:4px ; -moz-border-radius-topright:4px ; -moz-border-radius-bottomright:4px ; -moz-border-radius-bottomleft:4px ; border-top-left-radius:4px ; border-top-right-radius:4px ; border-bottom-right-radius:4px ; border-bottom-left-radius:4px ; -o-box-shadow:0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444; -moz-box-shadow:0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444; -khtml-box-shadow:0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444; -webkit-box-shadow:0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444; box-shadow:0 1px 2px #000000, inset 0 0 0 1px #222222, inset 0 2px #666666, inset 0 -2px 2px #444444; background-color:#3b3b3b; background-image:-moz-linear-gradient(top,#555555,#222222); background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#555555),color-stop(1,#222222)); filter:progid:DXImageTransform.Microsoft.gradient(startColorStr=#555555,EndColorStr=#222222); -ms-filter:progid:DXImageTransform.Microsoft.gradient(startColorStr=#555555,EndColorStr=#222222); } .ui-tooltip:after, .ui-tooltip-top:after, .ui-tooltip-right:after, .ui-tooltip-bottom:after, .ui-tooltip-left:after { content:"\25B8"; display:block; font-size:2em; height:0; line-height:0; position:absolute; } .ui-tooltip:after, .ui-tooltip-bottom:after { color:#2a2a2a; bottom:0; left:1px; text-align:center; text-shadow:1px 0 2px #000000; -o-transform:rotate(90deg); -moz-transform:rotate(90deg); -khtml-transform:rotate(90deg); -webkit-transform:rotate(90deg); width:100%; } .ui-tooltip-top:after { bottom:auto; color:#4f4f4f; left:-2px; top:0; text-align:center; text-shadow:none; -o-transform:rotate(-90deg); -moz-transform:rotate(-90deg); -khtml-transform:rotate(-90deg); -webkit-transform:rotate(-90deg); width:100%; } .ui-tooltip-right:after { color:#222222; right:-0.375em; top:50%; margin-top:-.05em; text-shadow:0 1px 2px #000000; -o-transform:rotate(0); -moz-transform:rotate(0); -khtml-transform:rotate(0); -webkit-transform:rotate(0); } .ui-tooltip-left:after { color:#222222; left:-0.375em; top:50%; margin-top:.1em; text-shadow:0 -1px 2px #000000; -o-transform:rotate(180deg); -moz-transform:rotate(180deg); -khtml-transform:rotate(180deg); -webkit-transform:rotate(180deg); } .date-input { width:200px;}
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsviews/demos/resources/todos.css
CSS
gpl2
7,782
/** * SyntaxHighlighter * http://alexgorbatchev.com/ * * SyntaxHighlighter is donationware. If you are using it, please donate. * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate * * @version * 2.0.296 (March 01 2009) * * @copyright * Copyright (C) 2004-2009 Alex Gorbatchev. * * @license * This file is part of SyntaxHighlighter. * * SyntaxHighlighter is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SyntaxHighlighter is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SyntaxHighlighter. If not, see <http://www.gnu.org/licenses/>. */ .syntaxhighlighter, .syntaxhighlighter div, .syntaxhighlighter code, .syntaxhighlighter span { margin: 0 !important; padding: 0 !important; border: 0 !important; outline: 0 !important; background: none !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-family: "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 1em !important; } .syntaxhighlighter { width: 100% !important; margin: 1em 0 1em 0 !important; padding: 1px !important; /* adds a little border on top and bottom */ position: relative !important; } .syntaxhighlighter .bold { font-weight: bold !important; } .syntaxhighlighter .italic { font-style: italic !important; } .syntaxhighlighter .line .number { float: left !important; width: 3em !important; padding-right: .3em !important; text-align: right !important; display: block !important; } /* Disable numbers when no gutter option is set */ .syntaxhighlighter.nogutter .line .number { display: none !important; } .syntaxhighlighter .line .content { margin-left: 3.3em !important; padding-left: .5em !important; display: block !important; } .syntaxhighlighter .line .content .block { display: block !important; padding-left: 1.5em !important; text-indent: -1.5em !important; } .syntaxhighlighter .line .content .spaces { display: none !important; } /* Disable border and margin on the lines when no gutter option is set */ .syntaxhighlighter.nogutter .line .content { margin-left: 0 !important; border-left: none !important; } .syntaxhighlighter .bar { } .syntaxhighlighter.collapsed .bar { } .syntaxhighlighter.nogutter .ruler { margin-left: 0 !important; padding-left: 0 !important; } .syntaxhighlighter .ruler { padding: 0 0 .5em .5em !important; margin-left: 3.3em !important; overflow: hidden !important; } /* Adjust some properties when collapsed */ .syntaxhighlighter.collapsed .lines, .syntaxhighlighter.collapsed .ruler { display: none !important; } /* Styles for the toolbar */ .syntaxhighlighter .toolbar { position: absolute !important; right: 0px !important; top: 0px !important; font-size: 1px !important; padding: 8px 8px 8px 0 !important; /* in px because images don't scale with ems */ } .syntaxhighlighter.collapsed .toolbar { font-size: 80% !important; padding: .2em 0 .5em .5em !important; position: static !important; } .syntaxhighlighter .toolbar a.item, .syntaxhighlighter .toolbar .item { display: block !important; float: left !important; margin-left: 8px !important; background-repeat: no-repeat !important; overflow: hidden !important; text-indent: -5000px !important; } .syntaxhighlighter.collapsed .toolbar .item { display: none !important; } .syntaxhighlighter.collapsed .toolbar .item.expandSource { background-image: url(magnifier.png) !important; display: inline !important; text-indent: 0 !important; width: auto !important; float: none !important; height: 16px !important; padding-left: 20px !important; } .syntaxhighlighter .toolbar .item.viewSource { background-image: url(page_white_code.png) !important; } .syntaxhighlighter .toolbar .item.printSource { background-image: url(printer.png) !important; } .syntaxhighlighter .toolbar .item.copyToClipboard { text-indent: 0 !important; background: none !important; overflow: visible !important; } .syntaxhighlighter .toolbar .item.about { background-image: url(help.png) !important; } /** * Print view. * Colors are based on the default theme without background. */ .syntaxhighlighter.printing, .syntaxhighlighter.printing .line.alt1 .content, .syntaxhighlighter.printing .line.alt2 .content, .syntaxhighlighter.printing .line.highlighted .number, .syntaxhighlighter.printing .line.highlighted.alt1 .content, .syntaxhighlighter.printing .line.highlighted.alt2 .content, .syntaxhighlighter.printing .line .content .block { background: none !important; } /* Gutter line numbers */ .syntaxhighlighter.printing .line .number { color: #bbb !important; } /* Add border to the lines */ .syntaxhighlighter.printing .line .content { color: #000 !important; } /* Toolbar when visible */ .syntaxhighlighter.printing .toolbar, .syntaxhighlighter.printing .ruler { display: none !important; } .syntaxhighlighter.printing a { text-decoration: none !important; } .syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { color: #000 !important; } .syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { color: #008200 !important; } .syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { color: blue !important; } .syntaxhighlighter.printing .keyword { color: #069 !important; font-weight: bold !important; } .syntaxhighlighter.printing .preprocessor { color: gray !important; } .syntaxhighlighter.printing .variable { color: #a70 !important; } .syntaxhighlighter.printing .value { color: #090 !important; } .syntaxhighlighter.printing .functions { color: #ff1493 !important; } .syntaxhighlighter.printing .constants { color: #0066CC !important; } .syntaxhighlighter.printing .script { font-weight: bold !important; } .syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { color: #808080 !important; } .syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { color: #ff1493 !important; } .syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { color: red !important; } /** * SyntaxHighlighter * http://alexgorbatchev.com/ * * SyntaxHighlighter is donationware. If you are using it, please donate. * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate * * @version * 2.0.296 (March 01 2009) * * @copyright * Copyright (C) 2004-2009 Alex Gorbatchev. * * @license * This file is part of SyntaxHighlighter. * * SyntaxHighlighter is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SyntaxHighlighter is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SyntaxHighlighter. If not, see <http://www.gnu.org/licenses/>. */ /************************************ * Default Syntax Highlighter theme. * * Interface elements. ************************************/ .syntaxhighlighter { background-color: #E7E5DC !important; } /* Highlighed line number */ .syntaxhighlighter .line.highlighted .number { background-color: #6CE26C !important; color: black !important; } /* Highlighed line */ .syntaxhighlighter .line.highlighted.alt1 .content, .syntaxhighlighter .line.highlighted.alt2 .content { background-color: #6CE26C !important; } /* Gutter line numbers */ .syntaxhighlighter .line .number { color: #5C5C5C !important; } /* Add border to the lines */ .syntaxhighlighter .line .content { border-left: 3px solid #6CE26C !important; color: #000 !important; } .syntaxhighlighter.printing .line .content { border: 0 !important; } /* First line */ .syntaxhighlighter .line.alt1 .content { background-color: #fff !important; } /* Second line */ .syntaxhighlighter .line.alt2 .content { background-color: #F8F8F8 !important; } .syntaxhighlighter .ruler { color: silver !important; background-color: #F8F8F8 !important; border-left: 3px solid #6CE26C !important; } .syntaxhighlighter.nogutter .ruler { border: 0 !important; } .syntaxhighlighter .toolbar { background-color: #F8F8F8 !important; border: #E7E5DC solid 1px !important; } .syntaxhighlighter .toolbar a { color: #a0a0a0 !important; } .syntaxhighlighter .toolbar a:hover { color: red !important; } /************************************ * Actual syntax highlighter colors. ************************************/ .syntaxhighlighter .plain, .syntaxhighlighter .plain a { color: #000 !important; } .syntaxhighlighter .comments, .syntaxhighlighter .comments a { color: #008200 !important; } .syntaxhighlighter .string, .syntaxhighlighter .string a { color: blue !important; } .syntaxhighlighter .keyword { color: #069 !important; font-weight: bold !important; } .syntaxhighlighter .preprocessor { color: gray !important; } .syntaxhighlighter .variable { color: #a70 !important; } .syntaxhighlighter .value { color: #090 !important; } .syntaxhighlighter .functions { color: #ff1493 !important; } .syntaxhighlighter .constants { color: #0066CC !important; } .syntaxhighlighter .script { background-color: yellow !important; } .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { color: #808080 !important; } .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { color: #ff1493 !important; } .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { color: red !important; }
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsviews/demos/resources/syntaxhighlighter.css
CSS
gpl2
10,408
table { border-collapse: collapse; } table tr { color: blue; height: 25px; } thead { color: #009; border-bottom: solid #77c 2px; background-color: #E8E8F7; } thead th { padding:5px; border: 1px solid #77c; } #movieList tr td:first-child { width: 130px; } table { border: 2px solid blue; width: 480px; margin: 4px 0 24px 4px; padding: 2px; background-color: #f8f8f8; } table td { padding: 3px; margin: 3px; border: solid #77c 1px; }
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsviews/demos/resources/movielist.css
CSS
gpl2
435
body { padding: 10px; font-family: Verdana; font-size: small } h4 { font-size: inherit`; font-variant: small-caps; } .height { width: 100%; margin-bottom:10px; float: left; clear: both; } .bottom { height:400px; width: 100%; margin-bottom:10px; float: left; clear: both; } body > button { float: left; clear: right; margin: 3px } .subhead { margin: 15px 0 4px 0; font-weight:bolder; color:#116; font-family:Arial; font-size:10pt } a { color: #55b} .result { text-align:right; }
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsviews/demos/resources/perf-compare.css
CSS
gpl2
481
input { color: #1010c0; } .buttons, .comment { float: left; clear:both; margin-bottom: 10px; } .comment { font-style:italic; } table { border-collapse: collapse; float: left; clear: both; border: 2px solid #4242ae; width: 380px; margin: 4px 0 4px 0px; padding: 2px; background-color: #f8f8f8; } table tr { border: 1px solid #4242ae; color: #1010c0; height: 25px; } thead tr { color: #009; border-bottom: solid #77c 2px; background-color: #e0e0e8; } thead th { padding:5px; } .hover { cursor: pointer; } .hover:hover { color: #AD0157; } #movieList tr td:first-child { width: 250px; } #movieDetail > div { border: 2px solid #4242ae; width: 280px; margin: 4px 0 4px 4px; padding: 2px; background-color: #f8f8f8; } table td { padding: 3px; margin: 3px; } #movieDetail div div { margin: 3px; } .selected { background-color: yellow; } #movieDetail input { float: left; padding: 2px; width: 245px; margin: 1px; border: 1px solid #4a4aff } #movieDetail { float: left; margin-left: 10px; font-weight: bold; font-style: italic; color:#009; } #movieDetail div { float: left; clear: both; } #movieDetail input.special { float:none; padding: inherit; width:inherit; margin: 3px; border: inherit; } #movieDetail .title { padding-top: 8px; } .close { float: right; cursor: pointer; margin: 6px; } #addLanguageBtn, #addMovieBtn { float: right; text-decoration: underline; font-style: italic; color: #1010c0; cursor:pointer; padding: 0 5px 0 15px; } table input { width: 95%; border: 1px solid #000; padding:4px; } #console { float: left; clear:both; }
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsviews/demos/resources/masterdetail.css
CSS
gpl2
1,539
body { padding: 10px; font-family: Verdana; font-size: small } h4 { font-size: inherit`; font-variant: small-caps; } .height { width: 100%; margin-bottom:10px; float: left; clear: both; } .bottom { height:400px; width: 100%; margin-bottom:10px; float: left; clear: both; } body > button { float: left; clear: right; margin: 3px } .subhead { margin: 3px 0 5px 0; font-weight:bolder; color:#116; font-family:Arial; font-size:10pt } a { color: #55b; } pre { font-size:10pt; font-weight:bold; } .inset { padding-left: 18px; } .box { border: 1px solid #777; padding: 10px; margin: 5px 0 30px; } .box div { margin: 3px 0 10px 0; } .box .label { margin: 0; padding: 10px 0 0 0; font-style:italic; color: #55b; } .box.label { font-style:italic; color: #55b; } .desc { font-style:italic; margin: 0 0 15px; color:#116; } pre { border-left: 3px solid #aaa; padding:10px; margin-bottom: 30px; } .indexitems { list-style-type:none; padding-left:10px; margin: 0 0 20px;} h3 { margin-bottom: 10px; font-size: 11pt;} select { margin-bottom:15px; width: 200px; }
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsviews/demos/resources/demos.css
CSS
gpl2
1,050
body { padding: 10px; font-family: Verdana; font-size: small } h4 { font-size: inherit`; font-variant: small-caps; } .height { width: 100%; margin-bottom:10px; float: left; clear: both; } .bottom { height:400px; width: 100%; margin-bottom:10px; float: left; clear: both; } body > button { float: left; clear: right; margin: 3px } .subhead { margin: 15px 0 10px 0; font-weight:bolder; color:#116; font-family:Arial; font-size:10pt; font-style:italic } a { color: #55b} pre { font-size:10pt; font-weight:bold; } table { border-collapse: collapse; } table tr { color: blue; height: 25px; } thead tr { color: #009; border-bottom: solid #77c 2px; background-color: #E8E8F7; } thead th { padding:5px; border: 1px solid #77c; } #movieList tr td:first-child { width: 130px; } table { border: 2px solid blue; width: 480px; margin: 6px 0 24px; padding: 2px; background-color: #f8f8f8; } table td { width: 50%; padding: 3px; margin: 3px; border: solid #77c 1px; } table.three td { width: 33%; padding: 3px; margin: 3px; border: solid #77c 1px; } table input { width: 96%; border: 1px solid #000; padding:4px; } table.three input { width: auto; border: 1px solid #000; padding:4px; }
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsviews/demos/resources/presentation.css
CSS
gpl2
1,176
<!DOCTYPE html> <html> <head> <title>JsViews: Demos</title> <link href="resources/demos.css" rel="stylesheet" type="text/css" /> </head> <body> <h2>JsViews: Next-generation jQuery Templates and Data Linking</h2> <div class="subhead"><em>JsViews</em>:</div> <div class="box"> <div class="desc">JsViews are interactive data-driven views, built on top of JsRender templates</div> <div class="subhead"><b><a href="demos.html">JsViews: Demos</a></b></div> <div class="label">JsViews and JsRender Overview:</div> <div class="subhead"><b><a href="jQueryConfDemosOct2011/index.html" >Demo sequence from jQuery Conference October 2011</a></b></div> <div class="label">Source code:</div> <div><a href="https://github.com/BorisMoore/jsviews">https://github.com/BorisMoore/jsviews</a></div> </div> <div class="subhead">See also on <em>JsRender</em> site:</div> <div class="box"> <div class="desc">JsRender templates are optimized for high-performance pure string-based rendering, without DOM or jQuery dependency</div> <div class="subhead"><b><a href="http://borismoore.github.com/jsrender/demos/index.html">JsRender: Demos</a></b></div> </div> <div class="subhead">Other links:</div> <div class="box"> <div><a href="http://www.slideshare.net/BorisMoore/jsviews-next-generation-jquery-templates" >Slide deck: jQuery Conference October 2011</a></div> <div><a href="http://msdn.microsoft.com/en-us/magazine/hh882454.aspx" >MSDN 'Client Insight' article on JsRender</a></div> <div>Training course: <a href="http://johnpapa.net/new-course-on-jsrender-templating-fundamentals-with-javascript" >JsRender Fundamentals</a> from John Papa on <a href="http://pluralsight.net/" >Pluralsight</a> (3 hours of video)</div> </div> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsviews/demos/index.html
HTML
gpl2
1,739
 <!DOCTYPE html> <html> <head> <link href="../resources/demos.css" rel="stylesheet" type="text/css" /> <link href="../resources/movielist.css" rel="stylesheet" type="text/css" /> <link href="../resources/syntaxhighlighter.css" rel="stylesheet" type="text/css" /> <script src="../resources/syntaxhighlighter.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> </head> <body> <div class="nav"><a href="13_converters.html">Prev</a> <a href="index.html">Index</a></div> <h3>JsRender: Custom tags for rendering</h3> <script id="movieTemplate" type="text/x-jsrender"> <tr> <td>{{:title}}</td> <td>{{sort languages tmpl="#sortedTemplate"/}}</td> <td> {{sort languages reverse=true}} <div> <b>{{:name}}</b> </div> {{/sort}} </td> </tr> </script> <script id="sortedTemplate" type="text/x-jsrender"> <div>{{:name}}</div> </script> <table> <thead><tr><th>Title</th><th>Orginal order</th><th>Reverse order</th></tr></thead> <tbody id="movieList"></tbody> </table> <div id="cons"></div> <script type="text/javascript"> $.views.tags({ sort: function( array ){ var ret = ""; if ( this.props.reverse ) { // Render in reverse order for ( var i = array.length; i; i-- ) { ret += this.renderContent( array[ i - 1 ] ); } } else { // Render in original order ret += this.renderContent( array ); } return ret; } }); var movies = [ { title: "Meet Joe Black", languages: [ { name: "English" }, { name: "French" } ] }, { title: "Eyes Wide Shut", languages: [ { name: "French" }, { name: "German" }, { name: "Spanish" } ] } ]; $( "#movieList" ).html( $( "#movieTemplate" ).render( movies ) ); </script> <!--================ End of Demo Section ================--> <h4>HTML:</h4> <pre class="brush: xml;"> &lt;td> {{sort languages reverse="true"}} &lt;div>{{:name}}&lt;/div> {{/sort}} &lt;/td> </pre> <h4>Script:</h4> <pre class="brush: js;"> $.views.tags({ sort: function( array ){ ... if ( this.props.reverse === "true" ) { // Render in reverse order for ( var l = array.length, i = l; i; i-- ) { ret += $.render( array[ i - 1 ], this.tmpl ); } } ... return ret; } }); </pre> </body> </html>
zzyn125-bench
BigMelon/Backup/jslib_backup/BorisMoore-jsviews/demos/jQueryConfDemosOct2011/14_custom-tags.html
HTML
gpl2
2,474