├── .gitignore
├── LICENSE
├── README.md
├── autocomplete.php
├── config.php
├── google_avaiable_ip.txt
├── google_search.class.php
├── index.php
├── res
├── favicon.ico
├── google-alias.css
├── google-alias.js
├── logo11w.png
├── nav_logo195.png
└── search.png
└── view.class.php
/.gitignore:
--------------------------------------------------------------------------------
1 | *.html
2 | .idea/
3 | *.*~
4 | test*.php
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
]+>(.*?)@s', $this->content, $r, PREG_SET_ORDER); 250 | if(count($r) > 0){ 251 | $this->results['related'] = array(); 252 | foreach($r as $v){ 253 | $this->results['related'][] = $v[1]; 254 | } 255 | } 256 | else{ 257 | $this->results['related'] = FALSE; 258 | } 259 | return $this; 260 | } 261 | 262 | /** 263 | * return current page number; 264 | * @return int 265 | */ 266 | public function get_page(){ 267 | return floor($this->paras['start'] / $this->paras['num']) + 1; 268 | } 269 | 270 | /** 271 | * use by view class, this is url builder, not original url; 272 | * @param array $paras 273 | * @param string key 274 | * @param string value 275 | * @return string url 276 | */ 277 | public function get_url($paras = null, $key = null, $val = null){ 278 | $tmp = $this->paras_m; 279 | if(is_array($paras)){ 280 | foreach($paras as $k => $v){ 281 | $tmp[$k] = $v; 282 | } 283 | } 284 | elseif($key !== null && $val !== null){ 285 | $tmp[$key] = $val; 286 | } 287 | if(opt('ENCRYPT')){ 288 | $tmp[opt('GET_Q')] = encrypt($tmp[opt('GET_Q')], opt('ENCRYPT_K')); 289 | } 290 | return './?'.$this->arr2url($tmp); 291 | } 292 | public function get_key(){ 293 | return $this->paras['q']; 294 | } 295 | public function get_key_url($key){ 296 | $paras = array(); 297 | if(isset($this->paras_m[opt('GET_NUM')])) 298 | $paras[opt('GET_NUM')] = $this->paras_m[opt('GET_NUM')]; 299 | if(isset($this->paras_m[opt('GET_LANG')])) 300 | $paras[opt('GET_LANG')] = $this->paras_m[opt('GET_LANG')]; 301 | if(isset($this->paras_m[opt('GET_TIME')])) 302 | $paras[opt('GET_TIME')] = $this->paras_m[opt('GET_TIME')]; 303 | $paras[opt('GET_Q')] = $this->e ? encrypt($key, opt('ENCRYPT_K')) : $key; 304 | return './?'.$this->arr2url($paras); 305 | } 306 | public function get_commit_paras(){ 307 | $paras = array(); 308 | if(isset($this->paras_m[opt('GET_NUM')])) 309 | $paras[opt('GET_NUM')] = $this->paras_m[opt('GET_NUM')]; 310 | if(isset($this->paras_m[opt('GET_LANG')])) 311 | $paras[opt('GET_LANG')] = $this->paras_m[opt('GET_LANG')]; 312 | if(isset($this->paras_m[opt('GET_TIME')])) 313 | $paras[opt('GET_TIME')] = $this->paras_m[opt('GET_TIME')]; 314 | return $paras; 315 | } 316 | }; -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | show(); 21 | } 22 | else{ 23 | require_once 'google_search.class.php'; 24 | require_once 'view.class.php'; 25 | $q = $_GET[opt('GET_Q')]; 26 | $h = isset($_GET[opt('GET_LANG')]) ? $_GET[opt('GET_LANG')] : FALSE; 27 | $p = isset($_GET[opt('GET_PAGE')]) ? $_GET[opt('GET_PAGE')] : 0; 28 | $d = isset($_GET[opt('GET_TIME')]) ? $_GET[opt('GET_TIME')] : FALSE; 29 | $n = isset($_GET[opt('GET_NUM')]) ? (int) $_GET[opt('GET_NUM')] : FALSE; 30 | if(substr($q, 0, 3) == '%FF' && opt('ENCRYPT')) 31 | $q = decrypt($q, opt('ENCRYPT_K')); 32 | $g = new search($q); 33 | if($n) 34 | $g->set_num($n); 35 | if($p) 36 | $g->set_page($p); 37 | if($d) 38 | $g->set_time($d); 39 | if($h) 40 | $g->set_lang($h); 41 | $g->load(); 42 | $g->get_results(); 43 | $s = new view($g); 44 | $s->show(); 45 | } -------------------------------------------------------------------------------- /res/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Celend/google-alias/6e28ef099ace47d97504badc7a6eea0486b704f6/res/favicon.ico -------------------------------------------------------------------------------- /res/google-alias.css: -------------------------------------------------------------------------------- 1 | html { 2 | height: 100%; 3 | overflow: hidden; 4 | } 5 | 6 | body { 7 | margin: 0; 8 | height: 100%; 9 | font-family: arial,sans-serif; 10 | overflow: auto; 11 | } 12 | 13 | .i-search { 14 | margin: 0 auto; 15 | margin-top: 10%; 16 | } 17 | 18 | .i-logo { 19 | width: 300px; 20 | margin: 0 auto; 21 | } 22 | 23 | .i-logo-img { 24 | background: url("./logo11w.png") no-repeat; 25 | background-size: 300px 105px; 26 | position: relative; 27 | margin: 0 auto; 28 | width: 300px; 29 | height: 105px; 30 | } 31 | 32 | .alias { 33 | position: relative; 34 | color: #777; 35 | font-size: 20px; 36 | left: 256px; 37 | top: -25px; 38 | font-weight: bold; 39 | } 40 | 41 | .i-search-bar { 42 | margin: 15px; 43 | text-align: center; 44 | } 45 | 46 | .i-q { 47 | width: 100%; 48 | height: 29px; 49 | padding: 4px 6px 2px 4px; 50 | border: 1px solid #b9b9b9; 51 | font: -webkit-small-control; 52 | box-sizing: border-box; 53 | font-size: 17px; 54 | min-width: 230px; 55 | max-width: 600px; 56 | } 57 | 58 | .i-q:hover { 59 | border-color: #a3a3a3; 60 | } 61 | 62 | .i-q:focus { 63 | border-color: #5f8be8; 64 | } 65 | 66 | .i-search-bu { 67 | border: none; 68 | font-family: "Microsoft YaHei", "微软雅黑"; 69 | border-radius: 2px; 70 | background-color: #4d90fe; 71 | font-size: 1.05em; 72 | padding: .2em 1.1em 1.5em 1.1em; 73 | margin: 0 15px 0 15px; 74 | color: #FFF; 75 | height: 27px; 76 | cursor: pointer; 77 | } 78 | .s-search-bu{ 79 | background: url("./search.png") no-repeat center center; 80 | margin-left: 10px; 81 | border: none; 82 | border-radius: 2px; 83 | background-color: #4d90fe; 84 | height: 27px; 85 | width: 60px; 86 | display: inline-block; 87 | vertical-align: top; 88 | } 89 | 90 | /*result page*/ 91 | .s-logo { 92 | margin-top: 20px; 93 | margin-left: 15px; 94 | width: 110px; 95 | display: inline-block; 96 | vertical-align: middle; 97 | } 98 | 99 | .s-logo-img { 100 | width: 110px; 101 | } 102 | 103 | .s-top-bar { 104 | width: 100%; 105 | overflow: auto; 106 | background: #f1f1f1; 107 | border-bottom: 1px #e5e5e5 solid; 108 | } 109 | 110 | .s-logo-alias { 111 | position: relative; 112 | top: -12px; 113 | left: 90px; 114 | color: #777; 115 | font-size: .7em; 116 | } 117 | 118 | .s-q { 119 | width: 530px; 120 | font-size: 28px; 121 | height: 27px; 122 | padding: 0 0 0 6px ; 123 | border: 1px solid #b9b9b9; 124 | font: 17px arial,sans-serif; 125 | box-sizing: border-box; 126 | line-height: 1.25em !important; 127 | } 128 | 129 | .s-q:hover { 130 | border-color: #a3a3a3; 131 | } 132 | 133 | .s-q:focus { 134 | border-color: #5f8be8; 135 | } 136 | 137 | .s-search-bar { 138 | margin-top: 20px; 139 | margin-left: 16px; 140 | display: inline-block; 141 | } 142 | 143 | .search-res { 144 | position: relative; 145 | top: 20px; 146 | width: 540px; 147 | margin-left: 145px; 148 | } 149 | 150 | .search-res ul { 151 | padding: 0; 152 | } 153 | 154 | .search-tool-bar { 155 | position: relative; 156 | height: 40px; 157 | width: 100%; 158 | border-bottom: 1px #e5e5e5 solid; 159 | background: #fff; 160 | } 161 | 162 | em { 163 | color: #dd4b39; 164 | font-style: normal; 165 | } 166 | 167 | .s-box { 168 | display: block; 169 | margin-bottom: 20px; 170 | } 171 | 172 | .s-title { 173 | font-size: 1.2em; 174 | } 175 | 176 | .s-title:hover { 177 | text-decoration: underline; 178 | } 179 | .s-disc { 180 | line-height: 1.4; 181 | word-wrap: break-word; 182 | color: #545454; 183 | font-size: small; 184 | } 185 | 186 | .s-title-link { 187 | color: #006621; 188 | font-style: normal; 189 | font-size: 13px; 190 | display: block; 191 | margin-top: -2px; 192 | } 193 | 194 | a:link { 195 | color: #1a0dab; 196 | text-decoration: none; 197 | } 198 | 199 | a:visited { 200 | color: #609; 201 | } 202 | 203 | .f { 204 | color: #808080; 205 | } 206 | /*pages bar*/ 207 | .navcnt{ 208 | width: 100%; 209 | height: 55px; 210 | } 211 | .nav-t{ 212 | margin: 25px auto 0 auto; 213 | } 214 | .nav-a{ 215 | display: block; 216 | color: #1a0dab; 217 | font-size: .8em; 218 | } 219 | .nav-a:visited{ 220 | color: #1a0dab; 221 | } 222 | .s-prev{ 223 | width: 74px; 224 | height: 55px; 225 | } 226 | .t-prev{ 227 | float: left; 228 | } 229 | .t-prev:hover, .t-next:hover{ 230 | text-decoration: underline; 231 | } 232 | .t-next{ 233 | text-decoration: none; 234 | float: right; 235 | } 236 | .s-next{ 237 | width: 88px; 238 | height: 55px 239 | } 240 | .nav-n{ 241 | margin-left: -4px; 242 | text-align: center; 243 | display: block; 244 | width: 20px; 245 | } 246 | .nav-n:hover{ 247 | text-decoration: underline; 248 | } 249 | .csb{ 250 | background: url("./nav_logo195.png") no-repeat left; 251 | height: 40px; 252 | display: block; 253 | margin-left: -4px; 254 | text-align: center; 255 | } 256 | .c-g{ 257 | background-position: 0 0; 258 | width: 52px; 259 | margin-left: 0; 260 | float: right; 261 | } 262 | .c-o1{ 263 | background-position: -52px 0; 264 | width: 22px; 265 | } 266 | .c-o2{ 267 | background-position: -74px 0; 268 | width: 22px; 269 | } 270 | .c-gle{ 271 | background-position: -96px 0; 272 | width: 70px; 273 | display: block; 274 | } 275 | .tool-box{ 276 | position: relative; 277 | margin: 12px 0 0 145px; 278 | width: 445px; 279 | display: inline-block; 280 | } 281 | .search-info{ 282 | line-height: 2.8em; 283 | color: #808080; 284 | font-size: .95em; 285 | } 286 | .no-sel{ 287 | -moz-user-select: none; 288 | -webkit-user-select: none; 289 | -ms-user-select: none; 290 | -khtml-user-select: none; 291 | user-select: none; 292 | } 293 | .tool-btn-b{ 294 | cursor: pointer; 295 | color: #777; 296 | margin-top: 4px; 297 | display: inline-block; 298 | } 299 | .tool-btn{ 300 | padding: 8px 8px 5px 8px; 301 | } 302 | .tool-btn:hover{ 303 | border: 1px solid #c6c6c6; 304 | padding: 7px 8px 6px 7px; 305 | border-radius: 2px ; 306 | background: #f1f1f1; 307 | } 308 | .tool-btn-press{ 309 | padding: 7px 8px 6px 7px; 310 | box-shadow: inset 0 1px 2px 0 rgba(0,0,0,0.1); 311 | background: -webkit-linear-gradient(top,#eee,#e0e0e0); 312 | border: 1px solid #d7d7d7; 313 | border-radius: 2px ; 314 | } 315 | #tool-panel{ 316 | margin-top: 9px; 317 | display: none; 318 | } 319 | .left-tool-box{ 320 | 321 | } 322 | .tf{ 323 | min-height: 100%; height: auto; margin-left: 145px; width: 450px;float: left; 324 | } 325 | .tool{ 326 | font-size: .95em; 327 | color:#777; 328 | display: inline-block; 329 | height: 20px; 330 | padding: 0 0 0 25px; 331 | cursor: pointer; 332 | } 333 | .tool:hover{ 334 | color:#333; 335 | } 336 | .tool-time{ 337 | position: relative; 338 | left: -25px; 339 | margin-right: -25px; 340 | } 341 | .dwn-tri{ 342 | font-size: .7em; 343 | display: inline; 344 | margin: -2px 0 0 2px; 345 | } 346 | .tool-al{ 347 | position: absolute; 348 | background: #ffffff; 349 | min-width: 95px; 350 | margin: -8px 0 0 -30px; 351 | z-index: 6; 352 | border: 1px solid #d9d9d9; 353 | padding: 5px 0 5px 0; 354 | color:#777; 355 | } 356 | .opt{ 357 | padding: 5px 0 5px 15px; 358 | margin: 2px 0 2px 0; 359 | } 360 | .opt:hover{ 361 | background: #D9D9D9; 362 | } 363 | .t-l, .t-l:link, .t-l:visited{ 364 | color: #777; 365 | } 366 | .t-l:active{ 367 | color: #de3937; 368 | } 369 | .med { 370 | color: gray; 371 | font-style: normal; 372 | font-size: 17px; 373 | line-height: 1.3; 374 | font-weight: 400; 375 | } 376 | ._e4b { 377 | margin: 0; 378 | white-space:nowrap; 379 | padding-top: 5px; 380 | min-width: 120px; 381 | } 382 | ._e4b:hover{ 383 | text-decoration: underline; 384 | } 385 | .row{ 386 | display: inline-block; 387 | width: auto; 388 | max-width: 280px; 389 | overflow: hidden; 390 | margin-right: 20px; 391 | } 392 | #clear{ 393 | letter-spacing: 2px; 394 | color: #db4823; 395 | padding: 8px 9px 5px 8px; 396 | list-style: none; 397 | float: right; 398 | margin: -6px 10px 0 0; 399 | } 400 | #clear:hover{ 401 | border: 1px solid #c6c6c6; 402 | padding: 7px 8px 5px 8px; 403 | border-radius: 2px ; 404 | background: #f1f1f1; 405 | } 406 | .fbar{ 407 | bottom: 0;left: 0; right: 0;height: 40px;background: #F2F2F2;margin-top: 56px;border-top: 1px solid #E4E4E4; 408 | } 409 | .fa{ 410 | display: inline-block; 411 | margin-right: 50px; 412 | } 413 | .fa:link, .fa:visited{ 414 | color: #777; 415 | } 416 | .fa:hover{ 417 | color: #444; 418 | } 419 | .fb{ 420 | line-height: 40px; margin-left: 145px; 421 | } 422 | .loading{ 423 | height: 100%; 424 | } 425 | .loading .cont{ 426 | display: none; 427 | } 428 | .loading-mes{ 429 | font-size: 2em;text-align: center; color: #CCC; line-height: 16em; height: 100%; 430 | } 431 | .i-box{ 432 | margin: 0 auto 0 auto; width: 50% 433 | } 434 | ul{ 435 | margin: 0; 436 | padding: 0; 437 | } 438 | #tool-time{ 439 | display: none;left:165px; 440 | } 441 | #tool-num{ 442 | display: none;left: 272px; 443 | } 444 | #tool-lang{ 445 | display: none;left: 375px; 446 | } 447 | .button-bar{ 448 | margin: 20px auto 0 auto; width: auto; 449 | } 450 | @media screen and (max-width: 780px){ 451 | .s-logo { 452 | display: block; 453 | margin-left: auto; 454 | margin-right: auto; 455 | } 456 | 457 | .s-top-bar { 458 | text-align: center; 459 | } 460 | 461 | .s-logo { 462 | text-align: left; 463 | } 464 | 465 | .s-search-bar { 466 | width: 95%; 467 | margin: 0; 468 | } 469 | 470 | .s-q { 471 | width: 72%; 472 | max-width: 400px; 473 | } 474 | 475 | .search-res { 476 | width: 90%; 477 | margin: 0 auto; 478 | max-width: 580px; 479 | } 480 | .s-prev{ 481 | width: 40px; 482 | height: 55px; 483 | } 484 | .s-next{ 485 | width: 50px; 486 | height: 55px 487 | } 488 | .nav-t{ 489 | margin: 25px auto 0 auto; 490 | width: 90%; 491 | } 492 | .tf{ 493 | margin-left: 5%; font-size: .9em; width: auto; 494 | } 495 | #tool-time{ 496 | left: 35px; 497 | } 498 | #tool-num{ 499 | left: 135px; 500 | } 501 | #tool-lang{ 502 | left: 225px; 503 | } 504 | .fb{ 505 | margin-left: 15px; 506 | } 507 | .contactme{ 508 | display: none; 509 | } 510 | .i-q{ 511 | widows: 10; 512 | } 513 | .i-box{ 514 | width:90% 515 | } 516 | .fa{ 517 | margin: 0 5px 0 5px; 518 | } 519 | .i-search-bu{ 520 | margin: 0 6px 0 6px; 521 | padding: .3em .9em 1.5em .9em; 522 | font-size: .95em; 523 | } 524 | #tool-panel{ 525 | margin-top: 12px; 526 | } 527 | .search-info{ 528 | line-height: 3.1em; 529 | } 530 | } 531 | @media screen and (max-height: 350px){ 532 | .i-search{ 533 | margin-top: 4%; 534 | } 535 | .i-search-bar{ 536 | margin: 0 0 0 0; 537 | } 538 | .i-q{ 539 | display: inline-block; 540 | width: auto; 541 | min-width: 50%; 542 | max-width: 300px; 543 | margin: 0; 544 | } 545 | .button-bar{ 546 | display: inline-block; 547 | margin-top: 10px; 548 | } 549 | .i-search-bu{ 550 | margin: 0 3px 0 3px; 551 | } 552 | } -------------------------------------------------------------------------------- /res/google-alias.js: -------------------------------------------------------------------------------- 1 | /** 2 | * javascript 3 | * @license GNU LGPL Ver 3.0 4 | * @package google-alias 5 | * @author celend 6 | * @date 14-10-15 7 | */ 8 | this.searchtype = 0; 9 | 'use strict';(function(d){function h(a,b,e){var c="rgb"+(d.support.rgba?"a":"")+"("+parseInt(a[0]+e*(b[0]-a[0]),10)+","+parseInt(a[1]+e*(b[1]-a[1]),10)+","+parseInt(a[2]+e*(b[2]-a[2]),10);d.support.rgba&&(c+=","+(a&&b?parseFloat(a[3]+e*(b[3]-a[3])):1));return c+")"}function f(a){var b;return(b=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(a))?[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16),1]:(b=/#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(a))?[17*parseInt(b[1],16),17*parseInt(b[2],16),17*parseInt(b[3],16),1]:(b=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(a))?[parseInt(b[1]),parseInt(b[2]),parseInt(b[3]),1]:(b=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(a))?[parseInt(b[1],10),parseInt(b[2],10),parseInt(b[3],10),parseFloat(b[4])]:l[a]}d.extend(!0,d,{support:{rgba:function(){var a=d("script:first"),b=a.css("color"),e=!1;if(/^rgba/.test(b))e=!0;else try{e=b!=a.css("color","rgba(0, 0, 0, 0.5)").css("color"), 10 | a.css("color",b)}catch(c){}return e}()}});var k="color backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor outlineColor".split(" ");d.each(k,function(a,b){d.Tween.propHooks[b]={get:function(a){return d(a.elem).css(b)},set:function(a){var c=a.elem.style,g=f(d(a.elem).css(b)),m=f(a.end);a.run=function(a){c[b]=h(g,m,a)}}}});d.Tween.propHooks.borderColor={set:function(a){var b=a.elem.style,e=[],c=k.slice(2,6);d.each(c,function(b,c){e[c]=f(d(a.elem).css(c))});var g=f(a.end); 11 | a.run=function(a){d.each(c,function(d,c){b[c]=h(e[c],g,a)})}}};var l={aqua:[0,255,255,1],azure:[240,255,255,1],beige:[245,245,220,1],black:[0,0,0,1],blue:[0,0,255,1],brown:[165,42,42,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgrey:[169,169,169,1],darkgreen:[0,100,0,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkviolet:[148,0,211,1],fuchsia:[255,0,255,1],gold:[255,215,0,1],green:[0,128,0,1],indigo:[75,0,130,1],khaki:[240,230,140,1],lightblue:[173,216,230,1],lightcyan:[224,255,255,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],magenta:[255,0,255,1],maroon:[128,0,0,1],navy:[0,0,128,1],olive:[128,128,0,1],orange:[255,165,0,1],pink:[255,192,203,1],purple:[128,0,128,1],violet:[128,0,128,1],red:[255,0,0,1],silver:[192,192,192,1],white:[255,255,255,1],yellow:[255,255,0,1],transparent:[255,255,255,0]}})(jQuery); 12 | !function(a){"use strict";var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,b=a.Base64,c="2.1.4";"undefined"!=typeof module&&module.exports&&(d=require("buffer").Buffer),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=function(a){var c,d,b={};for(c=0,d=a.length;d>c;c++)b[a.charAt(c)]=c;return b}(e),g=String.fromCharCode,h=function(a){var b;return a.length<2?(b=a.charCodeAt(0),128>b?a:2048>b?g(192|b>>>6)+g(128|63&b):g(224|15&b>>>12)+g(128|63&b>>>6)+g(128|63&b)):(b=65536+1024*(a.charCodeAt(0)-55296)+(a.charCodeAt(1)-56320),g(240|7&b>>>18)+g(128|63&b>>>12)+g(128|63&b>>>6)+g(128|63&b))},i=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,j=function(a){return a.replace(i,h)},k=function(a){var b=[0,2,1][a.length%3],c=a.charCodeAt(0)<<16|(a.length>1?a.charCodeAt(1):0)<<8|(a.length>2?a.charCodeAt(2):0),d=[e.charAt(c>>>18),e.charAt(63&c>>>12),b>=2?"=":e.charAt(63&c>>>6),b>=1?"=":e.charAt(63&c)];return d.join("")},l=a.btoa?function(b){return a.btoa(b)}:function(a){return a.replace(/[\s\S]{1,3}/g,k)},m=d?function(a){return new d(a).toString("base64")}:function(a){return l(j(a))},n=function(a,b){return b?m(a).replace(/[+\/]/g,function(a){return"+"==a?"-":"_"}).replace(/=/g,""):m(a)},o=function(a){return n(a,!0)},p=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g"),q=function(a){switch(a.length){case 4:var b=(7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3),c=b-65536;return g((c>>>10)+55296)+g((1023&c)+56320);case 3:return g((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return g((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},r=function(a){return a.replace(p,q)},s=function(a){var b=a.length,c=b%4,d=(b>0?f[a.charAt(0)]<<18:0)|(b>1?f[a.charAt(1)]<<12:0)|(b>2?f[a.charAt(2)]<<6:0)|(b>3?f[a.charAt(3)]:0),e=[g(d>>>16),g(255&d>>>8),g(255&d)];return e.length-=[0,0,2,1][c],e.join("")},t=a.atob?function(b){return a.atob(b)}:function(a){return a.replace(/[\s\S]{1,4}/g,s)},u=d?function(a){return new d(a,"base64").toString()}:function(a){return r(t(a))},v=function(a){return u(a.replace(/[-_]/g,function(a){return"-"==a?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},w=function(){var c=a.Base64;return a.Base64=b,c},a.Base64={VERSION:c,atob:t,btoa:l,fromBase64:v,toBase64:n,utob:j,encode:n,encodeURI:o,btou:r,decode:v,noConflict:w},"function"==typeof Object.defineProperty&&(x=function(a){return{value:a,enumerable:!1,writable:!0,configurable:!0}},a.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",x(function(){return v(this)})),Object.defineProperty(String.prototype,"toBase64",x(function(a){return n(this,a)})),Object.defineProperty(String.prototype,"toBase64URI",x(function(){return n(this,!0)}))})}(this); 13 | $( document ).ready(function(){ 14 | $('.tool-btn').on('click', function(e){ 15 | $('.tool-al').hide(); 16 | if(!$('#tool-panel').is(':visible')){ 17 | $(this).removeClass('tool-btn').addClass('tool-btn-press'); 18 | $('#tool-panel').show(); 19 | $('#search-info').animate({ 20 | 'marginTop': '-40px' 21 | }, 150); 22 | } 23 | else{ 24 | $(this).removeClass('tool-btn-press').addClass('tool-btn'); 25 | $('#search-info').animate({ 26 | 'marginTop': 0 27 | }, 150, function(){ 28 | $('#tool-panel').hide(); 29 | }); 30 | } 31 | }); 32 | $('.tool').on('click', function(e){ 33 | var type = $(this).attr('id'); 34 | $('.tool-al').not('#tool-'+type).hide(); 35 | var ele = $('#tool-'+type); 36 | if(ele.is(':visible')) 37 | ele.hide(); 38 | else 39 | ele.show(); 40 | $('body').one('click', function(e){ 41 | ele.hide(); 42 | }); 43 | return false; 44 | }); 45 | $('#clear').on('click', function(){ 46 | $('.hd-fd').remove(); 47 | $(this).hide(0, function(){ 48 | $(this).remove(); 49 | $('.s-q').css('color', '#FFF'); 50 | $('.s-q').animate({ 51 | 'backgroundColor': '#F00' 52 | }, 50, function(){ 53 | $('.s-q').animate({ 54 | 'color' : '#000', 55 | 'backgroundColor': '#FFF' 56 | }, 1000); 57 | }) 58 | }); 59 | }) 60 | }); 61 | function encrypt(str, key){ 62 | var s = ''; 63 | var t = ''; 64 | for(var i = 0; i < str.length; ++i){ 65 | if(encodeURI(str[i]) == str[i]){ 66 | s += str[i]; 67 | } 68 | else{ 69 | var c = encodeURI(str[i]); 70 | c = c.split('%'); 71 | var f = []; 72 | for(var j = 1; j < c.length; ++j){ 73 | t = parseInt(parseInt(c[j], 16) - key).toString(16).toLocaleUpperCase(); 74 | if(t.length == 1) 75 | t = '0' + t; 76 | f.push(t); 77 | } 78 | s += '%' + f.join('%'); 79 | } 80 | } 81 | return '%FF' + s; 82 | } 83 | //extend 84 | $.fn.decrypt = function(key){ 85 | try{ 86 | this.html(decrypt(this.html(), key)); 87 | } 88 | catch(e){ 89 | console.log(e); 90 | } 91 | return this; 92 | } 93 | var table = {'40':'@', '23':'#', '24':'$', '26':'&', '2F':'/', '3B':';', '3A':':', '3F':'?', '2C':',', '3D':'='}; 94 | function decrypt(str, key){ 95 | if(str.substr(0, 3) == '%FF'){ 96 | str = str.substr(3); 97 | } 98 | var t = ''; 99 | var s = ''; 100 | for(var i = 0; i < str.length; ++i){ 101 | if(str[i] == '+'){ 102 | s += ' '; 103 | } 104 | else if(str[i] != '%'){ 105 | s += str[i]; 106 | } 107 | else{ 108 | t = parseInt(parseInt(str.substr(i + 1, 2), 16) + key).toString(16).toLocaleUpperCase(); 109 | if(t.length == 1){ 110 | s = '0' + t; 111 | } 112 | if(table[t] != undefined){ 113 | s += table[t]; 114 | } 115 | else{ 116 | s += '%' + t; 117 | } 118 | i += 2; 119 | } 120 | } 121 | return decodeURI(s); 122 | }; 123 | 124 | var avaip = ''; 125 | var ips = []; 126 | var ip_k = 0; 127 | function index(modify){ 128 | if(typeof modify == 'string' && modify.length > 6){ 129 | avaip = modify; 130 | return true; 131 | } 132 | if(modify){ 133 | if(ips.length <= 1){ 134 | $('.fa:eq(2)').html('暂无可用IP'); 135 | return false; 136 | } 137 | ips.splice(0, modify); 138 | ip_k = 0; 139 | } 140 | else{ 141 | $('.i-q').focus(); 142 | } 143 | var inUse = false; 144 | function testip(state, callback){ 145 | if(state){ 146 | avaip = ips[ip_k]; 147 | console.info('now google ip is:' + avaip); 148 | if(callback) 149 | callback(); 150 | return true; 151 | } 152 | else{ 153 | ip_k++; 154 | ping(callback) 155 | } 156 | } 157 | function ping(callback){ 158 | if(!inUse){ 159 | var img = new Image(); 160 | inUse = true; 161 | img.onload = function(){ 162 | if(inUse){ 163 | inUse = false; 164 | testip(true, callback); 165 | } 166 | } 167 | img.onerror = function(){ 168 | if(inUse){ 169 | inUse = false; 170 | testip(true, callback); 171 | } 172 | } 173 | img.src = 'http://' + ips[ip_k] + '/images/srpr/logo11w.png'; 174 | setTimeout(function(){ 175 | if(inUse){ 176 | inUse = false; 177 | testip(false, callback); 178 | } 179 | }, 500); 180 | } 181 | } 182 | if(modify){ 183 | ping(function(){ 184 | $('.i-q').stop().animate({ 185 | 'backgroundColor': '#F00' 186 | }, 50, function(){ 187 | $(this).animate({ 188 | 'backgroundColor': '#FFF' 189 | }, 1000); 190 | }); 191 | }); 192 | } 193 | else{ 194 | $.ajax({ 195 | 'type': 'get', 196 | 'url': './google_avaiable_ip.txt', 197 | 'success': function(d){ 198 | ips = d.split('|'); 199 | ips.sort(function(){ return 0.5 - Math.random() }); 200 | ping(function(){ 201 | $('.i-search-bu')[0].innerHTML = 'Google搜索'; 202 | }); 203 | }, 204 | 'error': function(){ 205 | alert('从服务器获取可用IP失败, 请联系管理员'); 206 | } 207 | }); 208 | } 209 | } 210 | function commit1(){ 211 | if($('.i-q')[0].value == '') 212 | return false; 213 | if(searchtype === 0){ 214 | if(avaip == ''){ 215 | return false; 216 | } 217 | window.open('http://' + avaip + '/search?newwindow=1&q=' + encodeURI($('.i-q')[0].value), '_blank'); 218 | return false; 219 | } 220 | else if(searchtype === 1){ 221 | $('#hdq').attr('value', encrypt($('.i-q')[0].value, Number($('meta[name=urlencrypt]').attr('content')))); 222 | $('#i-f').submit(); 223 | } 224 | return true; 225 | } 226 | function commit2(){ 227 | if($('.s-q')[0].value == '') 228 | return false; 229 | $('#hdq').attr('value', encrypt($('.s-q')[0].value, Number($('meta[name=urlencrypt]').attr('content')))); 230 | return true; 231 | } 232 | function search(s){ 233 | var k = Number($('meta[name=conencrypt]').attr('content')); 234 | $('.s-q').attr('value', decrypt($('.s-q').attr('value-t'), k)); 235 | if($('meta[name=conencrypt]').attr('content') != 'FALSE'){ 236 | $('title').decrypt(k); 237 | if($('#rel').length > 0) 238 | $('#rel').decrypt(k); 239 | var s = $('.s-title'); 240 | for(var i = 0; i < s.length; ++i){ 241 | $(s[i]).attr('href', decrypt($(s[i]).decrypt(k).attr('href'), k)); 242 | 243 | } 244 | s = $('.s-disc'); 245 | for(i = 0; i < s.length; ++i){ 246 | $(s[i]).decrypt(k); 247 | } 248 | s = $('.rel_a'); 249 | for(i = 0; i < s.length; ++i){ 250 | $(s[i]).decrypt(k); 251 | } 252 | s = $('.s-title-link'); 253 | for(i = 0; i < s.length; ++i){ 254 | $(s[i]).decrypt(k); 255 | } 256 | $('.loading-mes').fadeOut(100, function(){ 257 | $('.loading-mes').remove(); 258 | $('.cont').fadeIn(300, function(){ 259 | $('.search-res').removeClass('loading'); 260 | }); 261 | }); 262 | } 263 | $('.s-q').focus(); 264 | var s = $('.s-q')[0]; 265 | if(s.setSelectionRange){ 266 | s.setSelectionRange(s.value.length, s.value.length); 267 | } 268 | else{ 269 | var r = s.createTextRange(); 270 | r.collapse(true); 271 | r.moveStart('character', s.value.length); 272 | r.select(); 273 | } 274 | }; 275 | window.onkeydown = function(e){ 276 | if($('.s-q').is(':focus') || $('.i-q').is(':focus')) 277 | return true; 278 | if(e.altKey && (e.key == 'j' || 'j'.charCodeAt(0) - 32 == e.keyCode) && !e.shiftKey){ 279 | if($('.i-q').length > 0) 280 | $('.i-q').focus(); 281 | else{ 282 | $('.s-q').focus(); 283 | } 284 | } 285 | else if(e.altKey && (e.key == 'i' || 'i'.charCodeAt(0) - 32 == e.keyCode) && !e.shiftKey){ 286 | if($('.i-q').length > 0) 287 | $('.i-q').focus()[0].value = ''; 288 | else{ 289 | $('.s-q').focus()[0].value = ''; 290 | } 291 | } 292 | return true; 293 | } 294 | -------------------------------------------------------------------------------- /res/logo11w.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Celend/google-alias/6e28ef099ace47d97504badc7a6eea0486b704f6/res/logo11w.png -------------------------------------------------------------------------------- /res/nav_logo195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Celend/google-alias/6e28ef099ace47d97504badc7a6eea0486b704f6/res/nav_logo195.png -------------------------------------------------------------------------------- /res/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Celend/google-alias/6e28ef099ace47d97504badc7a6eea0486b704f6/res/search.png -------------------------------------------------------------------------------- /view.class.php: -------------------------------------------------------------------------------- 1 | 16 | 17 |
18 | 19 |