1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
|
(function($){if(typeof $.log==="undefined"){if(typeof window.console!=="undefined"&&typeof window.console.log==="function"){$.console={};$.console.log=$.log=function(){var arr=[];for(var i=0;i<arguments.length;i++){arr.push(arguments[i])}window.console.log.apply(window.console,arr)};if(typeof window.console.debug!=="undefined"){$.console.debug=function(){var arr=[];for(var i=0;i<arguments.length;i++){arr.push(arguments[i])}window.console.debug.apply(window.console,arr)}}else{$.console.debug=function(){var arr=[];for(var i=0;i<arguments.length;i++){arr.push(arguments[i])}window.console.log.apply(window.console,arr)}}if(typeof window.console.warn!=="undefined"){$.console.warn=function(){var arr=[];for(var i=0;i<arguments.length;i++){arr.push(arguments[i])}window.console.warn.apply(window.console,arr)}}else{$.console.warn=function(){var arr=[];for(var i=0;i<arguments.length;i++){arr.push(arguments[i])}window.console.log.apply(window.console,arr)}}if(typeof window.console.error!=="undefined"){$.console.error=function(){var arr=["An error has occured:"];for(var i=0;i<arguments.length;i++){arr.push(arguments[i])}window.console.error.apply(window.console,arr);$.console.trace()}}else{$.console.error=function(){var args=arguments;var arr=["An error has occured:"];for(var i=0;i<arguments.length;i++){arr.push(arguments[i])}window.console.log.apply(window.console,arr);$.console.trace()}}if(typeof window.console.trace!=="undefined"){$.console.trace=function(){window.console.trace()}}else{$.console.trace=function(){window.console.log.apply(window.console,["Attempted trace... but window.console.trace does not exist."])}}}else{$.console={};$.log=$.console.log=$.console.debug=$.console.warn=$.console.trace=function(){};$.console.error=function(){alert("An error has occured. Please use another browser to obtain more detailed information.")}}}$.SmartyClass=function(){this.construct()};String.prototype.populate=$.fn.populate=function(options){$.Smarty=$.Smarty||new $.SmartyClass();options=$.extend({data:null},options);var result;if(typeof this.substring!=="undefined"){result=$.Smarty.populate(this)}else{$.each($(this),function(){var $this=$(this);return $this.html($.Smarty.populate($(this).html()))});result=this}return result};$.extend($.SmartyClass.prototype,{data:{build:"0.5.0-dev (June 29, 2010)"},config:{},templates:{},onchange_funcs:{},auto_updates:{_length:0},modifier_helper:{},section:{},foreach:{},cycle:{},template_url:"templates/",search:{tags:/\{((?:"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'|[^\s'"}]+)*)\s*((?:(?:"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'|[^\s'"}]+)\s*)*)\}(?:(.+?)\{\/\1\})?/,tags_g:/\{((?:"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'|[^\s'"}]+)*)\s*((?:(?:"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'|[^\s'"}]+)\s*)*)\}(?:(.+?)\{\/\1\})?/g,attributes:/(?:[\s]*(?:([^=\s]+?)=)?((?:"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'|[^\s'"]+)+))+?/,attributes_g:/(?:[\s]*(?:([^=\s]+?)=)?((?:"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'|[^\s'"]+)+))+?/g,modifiers:/(?:([|:])("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'|[^|:]+)?)+?/,modifiers_g:/(?:([|:])("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'|[^|:]+)?)+?/g},operators:{eq:"==",ne:"!=",neq:"!=",gt:">",lt:"<",ge:">=",gte:">=",le:"<=",lte:"<=",and:"&&",or:"||",mod:"%","==":"==","===":"===","!=":"!=",">":">","<":"<",">=":">=","<=":"<=","!":"!","%":"%","(":"(",")":")","0":0,"false":false,"null":null,"undefined":null},modifiers:{auto_update:function(value,id,el,css_class){++$.Smarty.auto_updates._length;el=(typeof el==="undefined")?"span":el;css_class=css_class?' class="'+css_class+'"':"";var j;if(!el||(id&&id.match(/[^a-zA-Z0-9_]/g))){j=html_entity_decode(id);id=el=css_class=null}else{id=id||"jqsmarty__auto_update__"+$.Smarty.auto_updates._length;j="#"+id}var helper=$.extend({},$.Smarty.modifier_helper);if(helper["var"].charAt(0)!=="$"){$.Smarty.debug("jqsmarty: ERROR: auto_update does not apply for: ",helper);return value}var v=helper["var"];var s=helper.source;for(var i=1,n=helper.modifiers.length;i<n;i++){var c=helper.modifiers[i];i
|