JQuery Paginate Plugin

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    JQuery Paginate Plugin

    I've recently find some Paginate Plugin
    but it's only came with NEXT & PRV

    HERE IS THE CODE

    Code:
    eval(function(p,a,c,k,e,r){e=function(c)
    	{
    		return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))
    	};
    	if(!''.replace(/^/,String))
    		{
    			while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function()
    				{
    					return'\\w+'};c=1
    				};
    			while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);
    			return p
    			}
    			('o.L.M=5(c){c=o.N({3:6,2:C,s:t,u:"O",w:"P",p:"Q",x:"R",D:"S"},c);0 d;0 e;0 f=q;0 g=t;0 h=o(T);0 i;0 j;0 k=5(){h.y();e=h.z();4(h.z()>c.3){h.U(":V("+(c.3-1)+")").A();d=c.3;n()}};0 l=5(){4(!f){0 a=d+c.3;h.A();h.E(d,a).y();d=a;4(d>=e){f=t;i.B("r")}4(c.s)c.2.7("."+c.p).v(d/c.3);j.F("r");g=q}};0 m=5(){4(!g){0 a=d-c.3;h.A();h.E((a-c.3),a).y();d=a;4(d==c.3){g=t;j.B("r")}4(c.s)c.2.7("."+c.p).v(d/c.3);i.F("r");f=q}};0 n=5(){4(c.2===C){c.2=o(\'<G 8="W"></G>\');h.X(h.z()-1).H(c.2)}0 a=$(\'<a 8="\'+c.u+\'" I="#">&Y; Z</a><a 8="\'+c.w+\'" I="#">10 &11;</a>\');o(c.2).12(a);4(c.s){0 b=\'<9 8="\'+c.D+\'"><9 8="\'+c.p+\'"></9> / <9 8="\'+c.x+\'"></9></9>\';c.2.7("."+c.u).H(b);c.2.7("."+c.p).v(1);c.2.7("."+c.x).v(13.14(e/c.3))}i=c.2.7("."+c.w);j=c.2.7("."+c.u);j.B("r");i.J(5(){l();K q});j.J(5(){m();K q})};k()};',62,67,'var||pager|perpage|if|function||find|class|span|||||||||||||||jQuery|pagenumber|false|qp_disabled|showcounter|true|prev|text|next|totalnumber|show|size|hide|addClass|null|counter|slice|removeClass|div|after|href|click|return|fn|quickpaginate|extend|qp_next|qp_prev|qp_pagenumber|qp_totalnumber|qp_counter|this|filter|gt|qc_pager|eq|laquo|Prev|Next|raquo|append|Math|ceil'.split('|'),0,{}))
    it's return the page no.

    Code:
    $(function(){
    $("#shopping_list li").quickpaginate({ perpage: 4, pager : $("#shopping_list_counter") });
    	});
    i want something like next with page no.
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    #2
    the file name called jQuery.quickpag inate.packed.js

    & Example is jQuery Quick Pagination

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Your post is confusing. Does it come with next/prev or page numbers? You've said both:
      but it's only came with NEXT & PRV
      it's return the page no.
      Usually, when code is obfuscated like this, you're better off writing your own, or finding one that already has the functionality, or is easily extendable.

      Comment

      • Fary4u
        Contributor
        • Jul 2007
        • 273

        #4
        Thanks for reply

        regarding my post it's executed fine only problem with getting per page links
        it's only brining result with NEXT & PREV

        variables are followings

        prev : The class name for the 'prev' link(s) => "qp_next"
        next : The class name for the 'next' link(s) => "qp_prev"
        counter : The class name for the span that wraps the counter => qp_counter
        totalnumber : The class name for the span that wraps the total number of pages => "qp_totalnumber "
        pagenumber : The class name for the span that wraps the current page count => "qp_pagenum ber"
        & " return page no " mean how many items you want to show on per page.

        i'm sure you know about " jquery pagination " but have a look following link it's also based on same methord but in different way it's call " jquery quick paginate "



        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Since this is not built-in, and you haven't written it, I would recommend that you just use one of the other plugins that does support page numbers.

          Comment

          • Fary4u
            Contributor
            • Jul 2007
            • 273

            #6
            well there is few plugins available for this pagnation

            but now recently i came accross 1 advance thing that mostly JQuery came as packed code & it's very hard to read & understand, if you need to do something then all you need is to make it as unpacked & do you own programming.

            thanx for ur reply

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Yes, you posted the packed version (p,a,c,k,e,r should've been the clue), but an unpacked version is also available.

              Comment

              • Fary4u
                Contributor
                • Jul 2007
                • 273

                #8
                yep i've done my job what i'm looking for.

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  That's good to hear. Perhaps you could post your code for the benefit of others.

                  Comment

                  • Fary4u
                    Contributor
                    • Jul 2007
                    • 273

                    #10
                    yep sure & i always be there 4 evey one : )
                    also i've changed this code with my own requirments here's the code
                    Code:
                    jQuery.fn.quickpaginate = function (c) {
                    	c = jQuery.extend({
                    		perpage: 6,
                    		pager: null,
                    		showcounter: true,
                    		prev: "qp_next",
                    		next: "qp_prev",
                    		pagenumber: "qp_pagenumber",
                    		totalnumber: "qp_totalnumber",
                    		counter: "qp_counter"
                    	},
                    	c);
                    	var d;
                    	var e;
                    	var f = false;
                    	var g = true;
                    	var h = jQuery(this);
                    	var i;
                    	var j;
                    	var k = function () {
                    		h.show();
                    		e = h.size();
                    		if (h.size() > c.perpage) {
                    			h.filter(":gt(" + (c.perpage - 1) + ")").hide();
                    			d = c.perpage;
                    			n()
                    		}
                    	};
                    	var l = function () {
                    		if (!f) {
                    			var a = d + c.perpage;
                    			h.hide();
                    			h.slice(d, a).show();
                    			d = a;
                    			if (d >= e) {
                    				f = true;
                    				i.addClass("qp_disabled")
                    			}
                    			if (c.showcounter) c.pager.find("." + c.pagenumber).text(d / c.perpage);
                    			j.removeClass("qp_disabled");
                    			g = false
                    		}
                    	};
                    	var m = function () {
                    		if (!g) {
                    			var a = d - c.perpage;
                    			h.hide();
                    			h.slice((a - c.perpage), a).show();
                    			d = a;
                    			if (d == c.perpage) {
                    				g = true;
                    				j.addClass("qp_disabled")
                    			}
                    			if (c.showcounter) c.pager.find("." + c.pagenumber).text(d / c.perpage);
                    			i.removeClass("qp_disabled");
                    			f = false
                    		}
                    	};
                    	var n = function () {
                    		if (c.pager === null) {
                    			c.pager = jQuery('<div class="qc_pager"></div>');
                    			h.eq(h.size() - 1).after(c.pager)
                    		}
                    		var a = $('<a class="' + c.prev + '" href="#"><img border=0 src=libs/L.jpg></a><a class="' + c.next + '" href="#"><img border=0 src=libs/R.jpg></a>');
                    		jQuery(c.pager).append(a);
                    		if (c.showcounter) {
                    			var b = '<span class="' + c.counter + '"><span class="' + c.pagenumber + '"></span> / <span class="' + c.totalnumber + '"></span></span>';
                    			c.pager.find("." + c.prev).after(b);
                    			c.pager.find("." + c.pagenumber).text(1);
                    			c.pager.find("." + c.totalnumber).text(Math.ceil(e / c.perpage))
                    		}
                    		i = c.pager.find("." + c.next);
                    		j = c.pager.find("." + c.prev);
                    		j.addClass("qp_disabled");
                    		i.click(function () {
                    			l();
                    		});
                    		j.click(function () {
                    			m();
                    		})
                    	};
                    	k()
                    };

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      #11
                      Thanks for posting. I haven't checked the code, but if it's working well, it must be good.

                      Comment

                      Working...