1/// 2///EUC¤ËÊÑ´¹¤·¤Þ¤·¤¿¡£ 3/// 4 5(function ($) { 6/* 7 **************************************************************************** 8 * File : jquery.ranking.js 2.22 9 * 10 * Copyright (C) 2005-2009 http://bizcaz.com/ All rights reserved. 11 **************************************************************************** 12 */ 13$.fn.PageRank = function(opt) { 14 opt = $.extend({ 15 blog_id : '', // ¥Ö¥í¥° ID 16 blog_url : '', // ¥Ö¥í¥° URL 17 script_url : '', // ¥é¥ó¥¥ó¥°¥¹¥¯¥ê¥×¥È¤Î¥¢¥Ã¥×¥í¡¼¥ÉÀè URL 18 include_all_logs: 0, // Á´¥Ö¥í¥°¤Î¥í¥°¾ðÊó¼èÆÀ(0:¤Ê¤·¡¢1:¼èÆÀ) 19 include_ref_logs: 0, // ¥ê¥Õ¥¡¥é¤Î¥í¥°¾ðÊó¼èÆÀ(0:¤Ê¤·¡¢1:¼èÆÀ) 20 hide_rank : 0, // ¥í¥®¥ó¥°¤Ï¤¹¤ë¤±¤ÉÈóɽ¼¨(0:ɽ¼¨¡¢1:Èóɽ¼¨) 21 page_name : '', // Ǥ°Õ¤Î¥Ú¡¼¥¸Ì¾¾Î 22 exclude_page : 0, // ¥«¥ì¥ó¥È¥Ú¡¼¥¸½ü³°¥Õ¥é¥°(0:¥«¥¦¥ó¥È¡¢1:½ü³°) 23 exclude_top : 1, // ¥È¥Ã¥×¥Ú¡¼¥¸½ü³°¥Õ¥é¥°(0:¥«¥¦¥ó¥È¡¢1:½ü³°) 24 ranking_max : 10, // ¥é¥ó¥¥ó¥°É½¼¨¿ô 25 ranking_type : 2, // ¥é¥ó¥¥ó¥°É½¼¨·Á¼°(0:Èóɽ¼¨¡¢1:¥«¥¦¥ó¥¿É½¼¨¡¢2:¥Ñ¡¼¥»¥ó¥Æ¡¼¥¸É½¼¨) 26 enable_cookie : 1, // Cookie͸ú¡¿Ìµ¸ú¥Õ¥é¥°(0:̵¸ú¡¢1:͸ú) 27 target : '' // ¥ê¥ó¥¯¤Î¥¿¡¼¥²¥Ã¥È°À('_blank', '_self') 28 }, opt || {}); 29 30 if ('' == opt.page_name) { 31 var name_split = document.title.split('#'); 32 opt.page_name = name_split[0]; 33 } 34 35 //opt.page_name = pagerank_espace(opt.page_name.replace(' - ¥µ¥¤¥È̾¾Î', '')); 36 opt.page_name = pagerank_espace(opt.page_name); 37 opt.post_url = [opt.script_url, 'rank_post.php'].join(''); 38 opt.loader = [opt.script_url, 'ajax-loader.gif'].join(''); 39 40 this.each(function() { 41 var mode = 0x01; 42 var location = document.location.href.replace(/#.*/,''); 43 44 location = location.replace(/index.*$/,''); 45 46 if (opt.enable_cookie) { 47 if (!check_cookie(location)) mode = 0x00; 48 } 49 50 if (opt.exclude_page) mode |= 0x02; 51 if (opt.exclude_top && opt.blog_url == location) mode |= 0x02; 52 if (opt.include_ref_logs) mode = 0x40; 53 if (opt.include_all_logs) mode = 0x80; 54 55 var me = $(this); 56 var params = { 57 blogid : opt.blog_id, 58 blogurl: opt.blog_url, 59 url : encodeURI(location), 60 title : encodeURIComponent(opt.page_name), 61 max : opt.ranking_max, 62 mode : mode, 63 referer: encodeURI(document.referrer) 64 }; 65 66 if (!opt.hide_rank) ShowLoader(me, true); 67 $.getJSON(opt.post_url, params, function(json) { 68 if (opt.hide_rank) return false; 69 ShowLoader(me, false); 70 71 var elem = []; 72 var clastbl = [' rank_list_eve', ' rank_list_odd']; 73 var record = ''; 74 75 76 elem.push('<ul class="ranking">'); 77 78 for (var i = 0;json.count > i;i++) { 79 record = json.record[i].split('<>'); 80 81 elem.push(['<li class="border"><a title="', record[2], '" href="', record[1], '" target="', opt.target, '">'].join('')); 82 83 if (opt.ranking_type) { 84 if (2 == opt.ranking_type) { 85 round = (record[0] / json.total) * 100; 86 round = Math.round(round); 87 val = [round, '%'].join(''); 88 } 89 else { 90 val = record[0]; 91 } 92 93 elem.push(['<span class="right">', val, '</span>'].join('')); 94 } 95 /////// 96 elem.push(['<img src="',opt.blog_url,'common/images/s_ranking_',i+1,'.gif" width="25" height="15" alt="',i+1,'°Ì" class="mgr10" />'].join('')); 97 /////// 98 99 elem.push([record[2], '</a></li>'].join('')); 100 } 101 102 elem.push(['</ul>'].join('')); 103 me.html(elem.join('')); 104 }); 105 }); 106 107 function ShowLoader(me, enable) { 108 if (enable) { 109 me.html('') 110 .show() 111 .css({'height':'100px', 'background':['transparent url(', opt.loader, ') no-repeat center center'].join('')}); 112 } 113 else { 114 me.css({'height':'auto', 'background':'none'}); 115 } 116 }; 117 118 function pagerank_espace(text) { 119 text = text.split("&").join("&" ); 120 text = text.split("<").join("<" ); 121 text = text.split(">").join(">" ); 122 text = text.split('"').join("""); 123 text = text.split("{").join("{"); 124 text = text.split("}").join("}"); 125 text = text.split("'").join("'"); 126 return text; 127 }; 128 129 function set_cookie(name, value, expire) { 130 expire = expire.toGMTString(); 131 132 var cookieval = [escape(name), '=', escape(value), '; path=/; expires=', expire].join(''); 133 document.cookie = cookieval; 134 }; 135 136 function get_cookie(name) { 137 var prefix = [escape(name), '='].join(''); 138 var c = document.cookie; 139 var nullstring = ''; 140 var cookieStartIndex = c.indexOf(prefix); 141 142 if (-1 == cookieStartIndex) return nullstring; 143 var cookieEndIndex = c.indexOf(';', cookieStartIndex + prefix.length); 144 if (-1 == cookieEndIndex) cookieEndIndex = c.length; 145 return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex)); 146 }; 147 148 function get_datestr(date) { 149 var yy = date.getYear(); if (yy < 1900) { yy += 1900; } 150 var mm = date.getMonth() + 1; if (mm < 10) { mm = ['0', mm].join(''); } 151 var dd = date.getDate(); if (dd < 10) { dd = ['0', dd].join(''); } 152 var str = [yy, mm, dd].join(''); 153 return str; 154 }; 155 156 function check_cookie(name) { 157 var now = new Date(); 158 now.setHours(0); 159 now.setMinutes(0); 160 now.setSeconds(0); 161 162 var str = get_datestr(now); 163 var expires = get_cookie(name); 164 165 if (expires) { 166 if (expires > str) return false;
167 } 168 169 now.setTime(now.getTime() + 1 * 24 * 60 * 60 * 1000); 170 set_cookie(name, get_datestr(now), now); 171 172 return true; 173 }; 174}; 175}) (jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.