tw_bootstrap_helper 0.2.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ (function($){$.extend({tablesorter:new
2
+ function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction=="simple"){if(config.supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.innerHTML;}}}else{if(typeof(config.textExtraction)=="function"){text=config.textExtraction(node);}else{text=$(node).text();}}return text;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function computeTableHeaderCellIndexes(t){var matrix=[];var lookup={};var thead=t.getElementsByTagName('THEAD')[0];var trs=thead.getElementsByTagName('TR');for(var i=0;i<trs.length;i++){var cells=trs[i].cells;for(var j=0;j<cells.length;j++){var c=cells[j];var rowIndex=c.parentNode.rowIndex;var cellId=rowIndex+"-"+c.cellIndex;var rowSpan=c.rowSpan||1;var colSpan=c.colSpan||1
3
+ var firstAvailCol;if(typeof(matrix[rowIndex])=="undefined"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])=="undefined"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])=="undefined"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x";}}}}return lookup;}function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){return(v.toLowerCase()=="desc")?1:0;}else{return(v==1)?1:0;}}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));var e="e"+i;dynamicExp+="var "+e+" = "+s;dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";if(table.config.debug){benchmark("Evaling expression:"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a="a["+index+"]",b="b["+index+"]";if(type=='text'&&direction=='asc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));";}else if(type=='text'&&direction=='desc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));";}else if(type=='numeric'&&direction=='asc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));";}else if(type=='numeric'&&direction=='desc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));";}};function makeSortText(i){return"((a["+i+"] < b["+i+"]) ? -1 : ((a["+i+"] > b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);},1);}).bind("updateCell",function(e,cell){var config=this.config;var pos=[(cell.parentNode.rowIndex-1),cell.cellIndex];cache.normalized[pos[0]][pos[1]]=config.parsers[pos[1]].format(getElementText(config,cell),cell);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){return/^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g,'')));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLocaleLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}var $tr,row=-1,odd;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=(row%2==0);$tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
@@ -0,0 +1,124 @@
1
+ /* ==========================================================
2
+ * bootstrap-alerts.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#alerts
4
+ * ==========================================================
5
+ * Copyright 2011 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ========================================================== */
19
+
20
+
21
+ !function( $ ){
22
+
23
+ "use strict"
24
+
25
+ /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
26
+ * ======================================================= */
27
+
28
+ var transitionEnd
29
+
30
+ $(document).ready(function () {
31
+
32
+ $.support.transition = (function () {
33
+ var thisBody = document.body || document.documentElement
34
+ , thisStyle = thisBody.style
35
+ , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
36
+ return support
37
+ })()
38
+
39
+ // set CSS transition event type
40
+ if ( $.support.transition ) {
41
+ transitionEnd = "TransitionEnd"
42
+ if ( $.browser.webkit ) {
43
+ transitionEnd = "webkitTransitionEnd"
44
+ } else if ( $.browser.mozilla ) {
45
+ transitionEnd = "transitionend"
46
+ } else if ( $.browser.opera ) {
47
+ transitionEnd = "oTransitionEnd"
48
+ }
49
+ }
50
+
51
+ })
52
+
53
+ /* ALERT CLASS DEFINITION
54
+ * ====================== */
55
+
56
+ var Alert = function ( content, options ) {
57
+ if (options == 'close') return this.close.call(content)
58
+ this.settings = $.extend({}, $.fn.alert.defaults, options)
59
+ this.$element = $(content)
60
+ .delegate(this.settings.selector, 'click', this.close)
61
+ }
62
+
63
+ Alert.prototype = {
64
+
65
+ close: function (e) {
66
+ var $element = $(this)
67
+ , className = 'alert-message'
68
+
69
+ $element = $element.hasClass(className) ? $element : $element.parent()
70
+
71
+ e && e.preventDefault()
72
+ $element.removeClass('in')
73
+
74
+ function removeElement () {
75
+ $element.remove()
76
+ }
77
+
78
+ $.support.transition && $element.hasClass('fade') ?
79
+ $element.bind(transitionEnd, removeElement) :
80
+ removeElement()
81
+ }
82
+
83
+ }
84
+
85
+
86
+ /* ALERT PLUGIN DEFINITION
87
+ * ======================= */
88
+
89
+ $.fn.alert = function ( options ) {
90
+
91
+ if ( options === true ) {
92
+ return this.data('alert')
93
+ }
94
+
95
+ return this.each(function () {
96
+ var $this = $(this)
97
+ , data
98
+
99
+ if ( typeof options == 'string' ) {
100
+
101
+ data = $this.data('alert')
102
+
103
+ if (typeof data == 'object') {
104
+ return data[options].call( $this )
105
+ }
106
+
107
+ }
108
+
109
+ $(this).data('alert', new Alert( this, options ))
110
+
111
+ })
112
+ }
113
+
114
+ $.fn.alert.defaults = {
115
+ selector: '.close'
116
+ }
117
+
118
+ $(document).ready(function () {
119
+ new Alert($('body'), {
120
+ selector: '.alert-message[data-alert] .close'
121
+ })
122
+ })
123
+
124
+ }( window.jQuery || window.ender );
@@ -0,0 +1,64 @@
1
+ /* ============================================================
2
+ * bootstrap-buttons.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#buttons
4
+ * ============================================================
5
+ * Copyright 2011 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ============================================================ */
19
+
20
+ !function( $ ){
21
+
22
+ "use strict"
23
+
24
+ function setState(el, state) {
25
+ var d = 'disabled'
26
+ , $el = $(el)
27
+ , data = $el.data()
28
+
29
+ state = state + 'Text'
30
+ data.resetText || $el.data('resetText', $el.html())
31
+
32
+ $el.html( data[state] || $.fn.button.defaults[state] )
33
+
34
+ setTimeout(function () {
35
+ state == 'loadingText' ?
36
+ $el.addClass(d).attr(d, d) :
37
+ $el.removeClass(d).removeAttr(d)
38
+ }, 0)
39
+ }
40
+
41
+ function toggle(el) {
42
+ $(el).toggleClass('active')
43
+ }
44
+
45
+ $.fn.button = function(options) {
46
+ return this.each(function () {
47
+ if (options == 'toggle') {
48
+ return toggle(this)
49
+ }
50
+ options && setState(this, options)
51
+ })
52
+ }
53
+
54
+ $.fn.button.defaults = {
55
+ loadingText: 'loading...'
56
+ }
57
+
58
+ $(function () {
59
+ $('body').delegate('.btn[data-toggle]', 'click', function () {
60
+ $(this).button('toggle')
61
+ })
62
+ })
63
+
64
+ }( window.jQuery || window.ender );
@@ -0,0 +1,55 @@
1
+ /* ============================================================
2
+ * bootstrap-dropdown.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#dropdown
4
+ * ============================================================
5
+ * Copyright 2011 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ============================================================ */
19
+
20
+
21
+ !function( $ ){
22
+
23
+ "use strict"
24
+
25
+ /* DROPDOWN PLUGIN DEFINITION
26
+ * ========================== */
27
+
28
+ $.fn.dropdown = function ( selector ) {
29
+ return this.each(function () {
30
+ $(this).delegate(selector || d, 'click', function (e) {
31
+ var li = $(this).parent('li')
32
+ , isActive = li.hasClass('open')
33
+
34
+ clearMenus()
35
+ !isActive && li.toggleClass('open')
36
+ return false
37
+ })
38
+ })
39
+ }
40
+
41
+ /* APPLY TO STANDARD DROPDOWN ELEMENTS
42
+ * =================================== */
43
+
44
+ var d = 'a.menu, .dropdown-toggle'
45
+
46
+ function clearMenus() {
47
+ $(d).parent('li').removeClass('open')
48
+ }
49
+
50
+ $(function () {
51
+ $('html').bind("click", clearMenus)
52
+ $('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' )
53
+ })
54
+
55
+ }( window.jQuery || window.ender );
@@ -0,0 +1,260 @@
1
+ /* =========================================================
2
+ * bootstrap-modal.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#modal
4
+ * =========================================================
5
+ * Copyright 2011 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ========================================================= */
19
+
20
+
21
+ !function( $ ){
22
+
23
+ "use strict"
24
+
25
+ /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
26
+ * ======================================================= */
27
+
28
+ var transitionEnd
29
+
30
+ $(document).ready(function () {
31
+
32
+ $.support.transition = (function () {
33
+ var thisBody = document.body || document.documentElement
34
+ , thisStyle = thisBody.style
35
+ , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
36
+ return support
37
+ })()
38
+
39
+ // set CSS transition event type
40
+ if ( $.support.transition ) {
41
+ transitionEnd = "TransitionEnd"
42
+ if ( $.browser.webkit ) {
43
+ transitionEnd = "webkitTransitionEnd"
44
+ } else if ( $.browser.mozilla ) {
45
+ transitionEnd = "transitionend"
46
+ } else if ( $.browser.opera ) {
47
+ transitionEnd = "oTransitionEnd"
48
+ }
49
+ }
50
+
51
+ })
52
+
53
+
54
+ /* MODAL PUBLIC CLASS DEFINITION
55
+ * ============================= */
56
+
57
+ var Modal = function ( content, options ) {
58
+ this.settings = $.extend({}, $.fn.modal.defaults, options)
59
+ this.$element = $(content)
60
+ .delegate('.close', 'click.modal', $.proxy(this.hide, this))
61
+
62
+ if ( this.settings.show ) {
63
+ this.show()
64
+ }
65
+
66
+ return this
67
+ }
68
+
69
+ Modal.prototype = {
70
+
71
+ toggle: function () {
72
+ return this[!this.isShown ? 'show' : 'hide']()
73
+ }
74
+
75
+ , show: function () {
76
+ var that = this
77
+ this.isShown = true
78
+ this.$element.trigger('show')
79
+
80
+ escape.call(this)
81
+ backdrop.call(this, function () {
82
+ var transition = $.support.transition && that.$element.hasClass('fade')
83
+
84
+ that.$element
85
+ .appendTo(document.body)
86
+ .show()
87
+
88
+ if (transition) {
89
+ that.$element[0].offsetWidth // force reflow
90
+ }
91
+
92
+ that.$element.addClass('in')
93
+
94
+ transition ?
95
+ that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
96
+ that.$element.trigger('shown')
97
+
98
+ })
99
+
100
+ return this
101
+ }
102
+
103
+ , hide: function (e) {
104
+ e && e.preventDefault()
105
+
106
+ if ( !this.isShown ) {
107
+ return this
108
+ }
109
+
110
+ var that = this
111
+ this.isShown = false
112
+
113
+ escape.call(this)
114
+
115
+ this.$element
116
+ .trigger('hide')
117
+ .removeClass('in')
118
+
119
+ $.support.transition && this.$element.hasClass('fade') ?
120
+ hideWithTransition.call(this) :
121
+ hideModal.call(this)
122
+
123
+ return this
124
+ }
125
+
126
+ }
127
+
128
+
129
+ /* MODAL PRIVATE METHODS
130
+ * ===================== */
131
+
132
+ function hideWithTransition() {
133
+ // firefox drops transitionEnd events :{o
134
+ var that = this
135
+ , timeout = setTimeout(function () {
136
+ that.$element.unbind(transitionEnd)
137
+ hideModal.call(that)
138
+ }, 500)
139
+
140
+ this.$element.one(transitionEnd, function () {
141
+ clearTimeout(timeout)
142
+ hideModal.call(that)
143
+ })
144
+ }
145
+
146
+ function hideModal (that) {
147
+ this.$element
148
+ .hide()
149
+ .trigger('hidden')
150
+
151
+ backdrop.call(this)
152
+ }
153
+
154
+ function backdrop ( callback ) {
155
+ var that = this
156
+ , animate = this.$element.hasClass('fade') ? 'fade' : ''
157
+ if ( this.isShown && this.settings.backdrop ) {
158
+ var doAnimate = $.support.transition && animate
159
+
160
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
161
+ .appendTo(document.body)
162
+
163
+ if ( this.settings.backdrop != 'static' ) {
164
+ this.$backdrop.click($.proxy(this.hide, this))
165
+ }
166
+
167
+ if ( doAnimate ) {
168
+ this.$backdrop[0].offsetWidth // force reflow
169
+ }
170
+
171
+ this.$backdrop.addClass('in')
172
+
173
+ doAnimate ?
174
+ this.$backdrop.one(transitionEnd, callback) :
175
+ callback()
176
+
177
+ } else if ( !this.isShown && this.$backdrop ) {
178
+ this.$backdrop.removeClass('in')
179
+
180
+ $.support.transition && this.$element.hasClass('fade')?
181
+ this.$backdrop.one(transitionEnd, $.proxy(removeBackdrop, this)) :
182
+ removeBackdrop.call(this)
183
+
184
+ } else if ( callback ) {
185
+ callback()
186
+ }
187
+ }
188
+
189
+ function removeBackdrop() {
190
+ this.$backdrop.remove()
191
+ this.$backdrop = null
192
+ }
193
+
194
+ function escape() {
195
+ var that = this
196
+ if ( this.isShown && this.settings.keyboard ) {
197
+ $(document).bind('keyup.modal', function ( e ) {
198
+ if ( e.which == 27 ) {
199
+ that.hide()
200
+ }
201
+ })
202
+ } else if ( !this.isShown ) {
203
+ $(document).unbind('keyup.modal')
204
+ }
205
+ }
206
+
207
+
208
+ /* MODAL PLUGIN DEFINITION
209
+ * ======================= */
210
+
211
+ $.fn.modal = function ( options ) {
212
+ var modal = this.data('modal')
213
+
214
+ if (!modal) {
215
+
216
+ if (typeof options == 'string') {
217
+ options = {
218
+ show: /show|toggle/.test(options)
219
+ }
220
+ }
221
+
222
+ return this.each(function () {
223
+ $(this).data('modal', new Modal(this, options))
224
+ })
225
+ }
226
+
227
+ if ( options === true ) {
228
+ return modal
229
+ }
230
+
231
+ if ( typeof options == 'string' ) {
232
+ modal[options]()
233
+ } else if ( modal ) {
234
+ modal.toggle()
235
+ }
236
+
237
+ return this
238
+ }
239
+
240
+ $.fn.modal.Modal = Modal
241
+
242
+ $.fn.modal.defaults = {
243
+ backdrop: false
244
+ , keyboard: false
245
+ , show: false
246
+ }
247
+
248
+
249
+ /* MODAL DATA- IMPLEMENTATION
250
+ * ========================== */
251
+
252
+ $(document).ready(function () {
253
+ $('body').delegate('[data-controls-modal]', 'click', function (e) {
254
+ e.preventDefault()
255
+ var $this = $(this).data('show', true)
256
+ $('#' + $this.attr('data-controls-modal')).modal( $this.data() )
257
+ })
258
+ })
259
+
260
+ }( window.jQuery || window.ender );
@@ -0,0 +1,90 @@
1
+ /* ===========================================================
2
+ * bootstrap-popover.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#popover
4
+ * ===========================================================
5
+ * Copyright 2011 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * =========================================================== */
19
+
20
+
21
+ !function( $ ) {
22
+
23
+ "use strict"
24
+
25
+ var Popover = function ( element, options ) {
26
+ this.$element = $(element)
27
+ this.options = options
28
+ this.enabled = true
29
+ this.fixTitle()
30
+ }
31
+
32
+ /* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
33
+ ========================================= */
34
+
35
+ Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {
36
+
37
+ setContent: function () {
38
+ var $tip = this.tip()
39
+ $tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
40
+ $tip.find('.content > *')[this.options.html ? 'html' : 'text'](this.getContent())
41
+ $tip[0].className = 'popover'
42
+ }
43
+
44
+ , hasContent: function () {
45
+ return this.getTitle() || this.getContent()
46
+ }
47
+
48
+ , getContent: function () {
49
+ var content
50
+ , $e = this.$element
51
+ , o = this.options
52
+
53
+ if (typeof this.options.content == 'string') {
54
+ content = $e.attr(this.options.content)
55
+ } else if (typeof this.options.content == 'function') {
56
+ content = this.options.content.call(this.$element[0])
57
+ }
58
+
59
+ return content
60
+ }
61
+
62
+ , tip: function() {
63
+ if (!this.$tip) {
64
+ this.$tip = $('<div class="popover" />')
65
+ .html(this.options.template)
66
+ }
67
+ return this.$tip
68
+ }
69
+
70
+ })
71
+
72
+
73
+ /* POPOVER PLUGIN DEFINITION
74
+ * ======================= */
75
+
76
+ $.fn.popover = function (options) {
77
+ if (typeof options == 'object') options = $.extend({}, $.fn.popover.defaults, options)
78
+ $.fn.twipsy.initWith.call(this, options, Popover, 'popover')
79
+ return this
80
+ }
81
+
82
+ $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
83
+ placement: 'right'
84
+ , content: 'data-content'
85
+ , template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
86
+ })
87
+
88
+ $.fn.twipsy.rejectAttrOptions.push( 'content' )
89
+
90
+ }( window.jQuery || window.ender );