inital commit

This commit is contained in:
2024-02-01 09:53:53 +00:00
commit 9743fce12b
19771 changed files with 4230637 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,151 @@
/*!
* jQuery counter Plugin
* http://kcounter.kudoslabs.co.uk
* Copyright (c) 2012 Kudos
* Version: 0.1
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* Requires: jQuery v1.7 or later
*/
(function($){
var methods = {
init : function( options ){
// defaults
settings = $.extend({
height: 50,
width: 50,
initial: false,
easing: 'swing',
duration: 'fast'
}, options);
$(this).data('settings',settings) ;
return this.each(function(){
var $this = $(this),
initialContent = settings.initial ? settings.initial : $this.html() , // get the initial content
chars = initialContent.toString().split("") , // everything is a string!
html = "" ;
$.each(chars, function(index, value) { // build individual counters
if( $.isNumeric(value) ) {
html += "<ul><li style=\"top:-"+(value*settings.height)+"px\">" ;
for (var i = 0; i < 10; i++) {
html += '<span>'+ i +'</span>' ;
}
html += "</li></ul>" ;
} else {
html += '<ul><li><span>'+value+'</span></li></ul>' ;
}
});
$this.html(html) ;
methods.updateCss.call($this, settings);
}) ;
},
updateCss : function(settings) {
return this.each(function(){
var $this = $(this);
$this.css({
'overflow' : 'hidden'
}) ;
$('ul', $this).css({
'position' : 'relative',
'float' : 'left',
'overflow' : 'hidden',
'height' : settings.height+'px',
'width' : settings.width+'px',
'line-height' : settings.height+'px'
}) ;
$('li', $this).css({
'position' : 'absolute',
'width' : settings.width+'px'
}) ;
$('span', $this).css({
'display' : 'block',
'text-align' : 'center',
'height' : settings.height+'px',
'width' : settings.width+'px',
}) ;
}) ;
},
update : function( content ) {
return this.each(function(){
var $this = $(this),
chars = content.toString().split(""),
numberCounters = $('ul', $this).length,
settings = $(this).data('settings'),
diff, html;
if(numberCounters!==chars.length){
diff = chars.length-numberCounters ;
numberCounters = chars.length ;
// decide whether to add or remove values
if( diff<0 ) {
$('ul', $this).slice(diff).remove() ;
} else {
html = '' ;
while (diff--) {
html += "<ul><li>" ;
for (var i = 0; i < 10; i++) {
html += '<span>'+ i +'</span>' ;
}
html += "</li></ul>" ;
}
$this.prepend(html) ;
}
}
$.each(chars, function(index, value){
var html = '';
if (settings.duration === 0) {
$('ul:nth-child('+(index+1)+') li', $this).html("<span>"+value+"</span>").css({top: 0});
return;
}
if( $.isNumeric(value) ) {
if( $('ul:nth-child('+(index+1)+') li span', $this).length==1 ) { // if this value was previously a char change it
for (var i = 0; i < 10; i++) {
html += '<span>'+ i +'</span>' ;
}
$('ul:nth-child('+(index+1)+') li', $this).html(html) ;
}
$('ul:nth-child('+(index+1)+') li', $this).animate({ top: -value * settings.height }, settings.duration, settings.easing ) ;
} else {
$('ul:nth-child('+(index+1)+') li', $this).html("<span>"+value+"</span>").animate({top: 0}, settings.duration, settings.easing) ;
}
});
methods.updateCss.call($this, settings);
}) ;
}
};
$.fn.kCounter = function( method ){
if ( methods[method] ) {
return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof method === 'object' || ! method ) {
return methods.init.apply( this, arguments );
} else {
$.error( 'Method ' + method + ' does not exist on jQuery.kCounter' );
}
};
})( jQuery );

View File

@@ -0,0 +1 @@
(function(b){var a={init:function(c){settings=b.extend({height:50,width:50,initial:false,easing:"swing",duration:"fast"},c);b(this).data("settings",settings);return this.each(function(){var g=b(this),f=settings.initial?settings.initial:g.html(),e=f.toString().split(""),d="";b.each(e,function(h,k){if(b.isNumeric(k)){d+='<ul><li style="top:-'+(k*settings.height)+'px">';for(var j=0;j<10;j++){d+="<span>"+j+"</span>"}d+="</li></ul>"}else{d+="<ul><li><span>"+k+"</span></li></ul>"}});g.html(d);a.updateCss.call(g,settings)})},updateCss:function(c){return this.each(function(){var d=b(this);d.css({overflow:"hidden"});b("ul",d).css({position:"relative","float":"left",overflow:"hidden",height:c.height+"px",width:c.width+"px","line-height":c.height+"px"});b("li",d).css({position:"absolute",width:c.width+"px"});b("span",d).css({display:"block","text-align":"center",height:c.height+"px",width:c.width+"px"})})},update:function(c){return this.each(function(){var k=b(this),h=c.toString().split(""),f=b("ul",k).length,g=b(this).data("settings"),j,e;if(f!==h.length){j=h.length-f;f=h.length;if(j<0){b("ul",k).slice(j).remove()}else{e="";while(j--){e+="<ul><li>";for(var d=0;d<10;d++){e+="<span>"+d+"</span>"}e+="</li></ul>"}k.prepend(e)}}b.each(h,function(l,o){var n="";if(g.duration===0){b("ul:nth-child("+(l+1)+") li",k).html("<span>"+o+"</span>").css({top:0});return}if(b.isNumeric(o)){if(b("ul:nth-child("+(l+1)+") li span",k).length==1){for(var m=0;m<10;m++){n+="<span>"+m+"</span>"}b("ul:nth-child("+(l+1)+") li",k).html(n)}b("ul:nth-child("+(l+1)+") li",k).animate({top:-o*g.height},g.duration,g.easing)}else{b("ul:nth-child("+(l+1)+") li",k).html("<span>"+o+"</span>").animate({top:0},g.duration,g.easing)}});a.updateCss.call(k,g)})}};b.fn.kCounter=function(c){if(a[c]){return a[c].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof c==="object"||!c){return a.init.apply(this,arguments)}else{b.error("Method "+c+" does not exist on jQuery.kCounter")}}}})(jQuery);