// Google SSL
// Modified from SSL Certificates Pro
//z 2011-12-29 8:59 AM is2120@csdn : reader,calendar
// ==UserScript==
// @name        Google SSL
// @namespace   http://raychow.info/
// @version     2.1.2
// @description 强制 Google 使用安全连接。
//
// @include     https://www.google.com/
// @include     https://www.google.com/webhp?*
// @include     https://www.google.com/search?*

// @include     https://encrypted.google.com/
// @include     https://encrypted.google.com/webhp?*
// @include     https://encrypted.google.com/search?*

// @include     https://webcache.googleusercontent.com/search?*
//
// @include     http://www.google.com.hk/search?*
// @include     http://www.google.com/
// @include     http://www.google.com/webhp?*
// @include     http://www.google.com/search?*
//
// @include     http://www.google.com/accounts*
// @include     http://www.google.com/bookmarks*
// @include     http://www.google.com/calendar*
// @include     http://www.google.com/contacts*
// @include     http://www.google.com/dictionary*
// @include     http://www.google.com/finance*
// @include     http://www.google.com/history*
// @include     http://www.google.com/notebook*
// @include     http://www.google.com/preferences*
// @include     http://www.google.com/profiles*
// @include     http://www.google.com/reader*
// @include     http://www.google.com/webmasters/tools*
// @include     http://www.google.com/voice*
// @include     http://checkout.google.com*
// @include     http://gmail.google.com*
// @include     http://mail.google.com*
// @include     http://sites.google.com*
// @include     http://*.googleusercontent.com*
// @include     http://groups.google.com*
// @include     http://reader.google.com*
// @include     http://calendar.google.com*
// ==/UserScript==

// 如果需要指定搜索语言,请修改 defaultLanguage 变量。
// If you need to specify the language of Google Search, please modify the defaultLanguage variable.
// 示例 / Example :
// var defaultLanguage = 'zh-CN';
var defaultLanguage = 'zh-CN';

function selectNodes(query) {
    return document.evaluate (
        query,
        document,
        null,
        XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
        null);
}

function addgbar() {
    var gog = selectNodes("//div[@id='gog']").snapshotItem(0);
  gog.innerHTML = '<div id="gbar"><nobr>' + 
    '<a href="https://encrypted.google.com/search?tab=ww" οnclick="gbar.qs(this)" class="gb1">Web</a> ' + 
    '<a href="http://www.google.com/images??tab=wi" οnclick="gbar.qs(this)" class="gb1">Images</a> ' + 
    '<a href="https://encrypted.google.com/search?tbs=vid:1&amp;tab=wv" οnclick="gbar.qs(this)" class="gb1">Videos</a> ' + 
    '<a href="http://maps.google.com/maps?tab=wl" οnclick="gbar.qs(this)" class="gb1">Maps</a> ' + 
    '<a href="https://encrypted.google.com/search?tbs=nws:1&amp;tab=wn" οnclick="gbar.qs(this)" class="gb1">News</a> ' + 
    '<a href="http://www.google.com/products?tab=wf" οnclick="gbar.qs(this)" class="gb1">Shopping</a> ' + 
    '<a href="https://mail.google.com/mail/?tab=wm" class="gb1">Gmail</a> ' + 
    '<a href="http://www.google.com/intl/en/options/" οnclick="this.blur();gbar.tg(event);return !1" aria-haspopup="true" class="gb3"><u>more</u> <small>▼</small></a>' + 
    '<div class="gbm" id="gbi">' + 
    '<a href="http://www.google.com/search?tbs=bks:1&amp;tab=wp" οnclick="gbar.qs(this)" class="gb2">Books</a> ' + 
    '<a href="https://www.google.com/finance?tab=we" οnclick="gbar.qs(this)" class="gb2">Finance</a> ' + 
    '<a href="http://translate.google.com/translate_t?tab=wT" οnclick="gbar.qs(this)" class="gb2">Translate</a> ' + 
    '<a href="http://scholar.google.com/scholar?tab=ws" οnclick="gbar.qs(this)" class="gb2">Scholar</a> ' + 
    '<a href="https://encrypted.google.com/search?tbs=blg:1&amp;tab=wb" οnclick="gbar.qs(this)" class="gb2">Blogs</a> ' + 
    '<div class="gb2"><div class="gbd"></div></div>' + 
    '<a href="http://www.youtube.com/results?tab=w1" οnclick="gbar.qs(this)" class="gb2">YouTube</a> ' + 
    '<a href="https://www.google.com/calendar/render?tab=wc" class="gb2">Calendar</a> ' + 
    '<a href="http://picasaweb.google.com/lh/view?tab=wq" οnclick="gbar.qs(this)" class="gb2">Photos</a> ' + 
    '<a href="https://docs.google.com/?tab=wo" class="gb2">Documents</a> ' + 
    '<a href="https://www.google.com/reader/view/?tab=wy" class="gb2">Reader</a> ' + 
    '<a href="https://sites.google.com/?tab=w3" class="gb2">Sites</a> ' + 
    '<a href="https://groups.google.com/groups?tab=wg" οnclick="gbar.qs(this)" class="gb2">Groups</a> ' + 
    '<div class="gb2"><div class="gbd"></div></div>' + 
    '<a href="http://www.google.com/intl/en/options/" class="gb2">even more »</a> ' + 
    '</div></nobr></div>' + gog.innerHTML;
}

var locationProtocol = window.location.protocol;
if (locationProtocol == 'http:'{
    if (window.location.href == 'http://www.google.com/' || window.location.href.indexOf('http://www.google.com/webhp?') == 0) {
        var sslLinkNode = document.createElement('a');
        sslLinkNode.href = 'https://www.google.com/';
        sslLinkNode.className = 'gb1';
        sslLinkNode.textContent = 'SSL';
        var gbar = selectNodes("//div[@id='gbar']/nobr").snapshotItem(0);
        gbar.appendChild(document.createTextNode(' '));
        gbar.appendChild(sslLinkNode);
    } else if (window.location.host == 'www.google.com.hk'{
        var iframe = document.createElement('iframe');
        iframe.id = 'ncr';
        iframe.src = 'https://www.google.com/ncr';
        iframe.setAttribute('style''display: none');
        document.body.appendChild(iframe);
        iframe.addEventListener('load'function(){
            var searchHref = 'https://encrypted.google.com/search' + window.location.search;
            if (defaultLanguage.length > 0)
                if (searchHref.indexOf('hl=') < 0)
                    searchHref += '&hl=' + defaultLanguage;
            window.location.href = searchHref + '#sl';
        }false);
    } else if (!window.location.href.indexOf('http://www.google.com/search?')) {
        window.location.href = 'https://encrypted.google.com/search' + window.location.search;
    } else {
        window.location.href = window.location.href.replace(/http:/'https:');
    }       
} else if (locationProtocol == 'https:'{
    var nodes, thisNode;
    if (window.location.href == 'https://www.google.com/' || window.location.href.indexOf('https://www.google.com/webhp?') == 0 || window.location.href == 'https://encrypted.google.com/' || window.location.href.indexOf('https://encrypted.google.com/webhp?') == 0) {
        if (!selectNodes("//div[@id='gbar']").snapshotItem(0))
            addgbar();
        nodes = selectNodes("//div[@id='gbar']");
        thisNode = nodes.snapshotItem(0);
        thisNode.style.display = 'inline';
    } else if (window.location.host == 'webcache.googleusercontent.com'{
        nodes = selectNodes("//a[starts-with(@href, 'http://webcache.googleusercontent.com')]");
        for (var i=0; i < nodes.snapshotLength; i++) {
            thisNode = nodes.snapshotItem(i);
            thisNode.href = thisNode.href.replace(/http:/'https:');
        } 
    } else if (window.location.href.indexOf('https://encrypted.google.com/search?') == 0) {
        if (!selectNodes("//div[@id='gbar']").snapshotItem(0))
            addgbar();
        nodes = selectNodes("//span[@class='gl']/a[starts-with(@href, 'http://webcache.googleusercontent.com')]");
        for (var i=0; i < nodes.snapshotLength; i++) {
            thisNode = nodes.snapshotItem(i);
            thisNode.href = thisNode.href.replace(/http:/'https:');
            thisNode.removeAttribute('onmousedown');
        }
        if (window.location.href.indexOf('#sl') >= 0) {
            var cStat, cEnd, prefCookie;
            if (document.cookie.length > 0) {
                cStart = document.cookie.indexOf('PREF=');
                if (cStart >= 0) { 
                    cStart += 5;
                    cEnd = document.cookie.indexOf(';', cStart);
                    if (cEnd < 0) cEnd = document.cookie.length;
                    prefCookie = document.cookie.substring(cStart, cEnd);
                    var useLanguage = '', locationHref = document.location.href;
                    cStart = locationHref.indexOf('hl=');
                    if (cStart >= 0) {
                        cStart += 3;
                        cEnd = locationHref.indexOf('&', cStart);
                        if (cEnd < 0) cEnd = locationHref.length - 3;
                        useLanguage = locationHref.substring(cStart, cEnd);
                        }
                    if (useLanguage.length == 0) useLanguage = defaultLanguage;
                    if (useLanguage.length > 0) {
                        cStart = prefCookie.indexOf('LD=');
                        if (cStart < 0) {
                            prefCookie += ':LD=' + useLanguage;
                        } else {
                            cStart += 3;
                            cEnd = prefCookie.indexOf(':', cStart);
                            if (cEnd < 0) cEnd = prefCookie.length;
                            prefCookie = prefCookie.substring(0, cStart) + useLanguage + prefCookie.substring(cEnd, prefCookie.length);
                            var exdate = new Date();
                            exdate.setDate(exdate.getDate() + 365);
                            document.cookie = 'PREF=' + prefCookie + ';expires=' + exdate.toGMTString() + ';domain=.google.com';
                        }
                    }
                } 
            }
            
        }
    }
}

转载于:https://www.cnblogs.com/IS2120/archive/2011/12/29/6745962.html

Google SSL zz相关推荐

  1. 从谷歌(Google)首页变化看互联网十三年风云

    中国有句成语,叫"察言观色",意为通过观察别人脸色以揣摩其心意.同样的,我们可以通过观察一个公司的门面,来考察这个公司的运作.今天,谷歌众包论坛就与大家一起品味一下互联网巨人Goo ...

  2. 在Google搜索结果显示原始链接

    使用Google的https搜索的时候,我们会发现搜索结果虽然可以显示,但是有时候结果的链接却无法打开.这里的原因是因为Google的https的搜索结果链接往往使用的是http的方式打开,因此有时候 ...

  3. google hosts 设置

    # http://just-ping.com/ #Time:2012.01.11##Google Service ##Chrome 网上应用店 203.208.46.146 chrome.google ...

  4. Android开发环境搭建(eclipse)

    使用的Eclipse的版本为:eclipse-java-indigo-SR2-win32     下载eclipse 点击菜单"Help" - "Install New ...

  5. [图文讲解]强大的谷歌搜索技巧,百度360搜狗什么的就是渣渣

    首先推荐篇关于谷歌搜索的大体文章给大家看看,望大家对谷歌搜索有个初步的印象和了解 谷歌免翻墙地址: 请戳我吧,我是传送门 善用GOOGLE  --  從入門到精通 (DOC 簡體字版由網站下載,原作者 ...

  6. 利用配置组策略解决Chrome浏览器第三方扩展被停用的问题

    首先根据以下代码生成文件chrome.adm CLASS MACHINECATEGORY !!googleCATEGORY !!googlechromeKEYNAME "Software\P ...

  7. SUSE Linux 11里Nginx+Resin+JSP+Memcached+MySQL安装配置整合

    服务器运维与网站架构|Linux运维|X研究 let's face reality,loyalty to an ideal! 首页 Linux Nginx Security Shell 服务器架构 互 ...

  8. Socket 短连接、长连接_YTmarkit的空间_百度空间

    Socket 短连接.长连接_YTmarkit的空间_百度空间 Socket 短连接.长连接_YTmarkit的空间_百度空间 Socket 短连接.长连接 socket Socket协议的形象描述 ...

  9. Google对Gmail的所有通信进行SSL加密

    news · 2014/03/21 15:30 恐怕没有其他公司能够像Google一样对NSA获取数据的手法更为了解的了,Google在最近的几个月对其基础架构做了一系列的改变,使得其他人更难获取到用 ...

最新文章

  1. [原创] Easy SysLite V1.2 (2016.5.29更新,新增加WIN10支持,一个程序适配所有系统减肥)...
  2. asp打开exe执行本地程序._基于QT应用程序打包成可执行程序exe
  3. python获得命令行参数的方法
  4. 实现EventHandler的监测
  5. java 反射内部匿名内部类_android-反射的使用(反射静态内部类、非静态内部类、匿名内部类等)...
  6. $* $@ $# $? $$ $! $0 $_
  7. ThinkPHP中的find和select的区别
  8. c语言单字符输入和输出函数分别为,第03章单元总练习-实训-知识拓展.doc
  9. php get获取腾讯视频vid,获取腾讯视频源地址链接的方法
  10. 面试中的排序算法总结
  11. java---键盘输入,写入到本地硬盘的数据
  12. 纷杂的Spring-boot-starter: 2 快速 Web 应用 开发 与 spring- boot- starter- web
  13. 一文读懂数字通信系统的本质
  14. uva-10177 - (2/3/4)-D Sqr/Rects/Cubes/Boxes?
  15. 第十一次 Java作业
  16. linux 查看dhcp dns,RHEL6 DNS+DHCP+DDNS
  17. 地信实验一利用矢量化软件AutoCAD对栅格文件矢量化
  18. QT在QML下实现多国语言翻译
  19. 基于单片机的电子秤(计价时钟播报)系统设计(#0444)
  20. 2018年广东工业大学文远知行杯新生程序设计竞赛 1010 温柔的手彼此相系β

热门文章

  1. MFC学习之路之多媒体 --(1) DirectShow
  2. Thread的run()与start()的区别
  3. python rest 框架_python-更新用户REST框架Django
  4. vue 兄弟组件之间的传值
  5. AUTOSAR从入门到精通100讲(三十九)-AUTOSAR 通信服务-Com模块两部曲-概念详解
  6. 产品经理思维模型:从品牌营销的角度看用户
  7. android 使用javascript,可以在Android中使用JavaScript吗?
  8. python通讯录综合_Python通讯录作业
  9. java7代码示例_Java中的七种排序方式代码示例
  10. 查看oracle自动优化,使用索引查询更快,优化器为何不能自动识别