Easy Analysis Extension

Easy Analysis Extension(http://analyzeit.azurewebsites.net/)

目前為 2015-12-09 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Easy Analysis Extension
// @version      1.2
// @description  Easy Analysis Extension(http://analyzeit.azurewebsites.net/)
// @icon         https://www.microsoft.com/favicon.ico?v2
// @license      GPL version 3
// @encoding     utf-8
// @date         12/08/2015
// @modified     12/08/2015
// @author       Myfreedom614 <[email protected]>
// @supportURL   http://openszone.com/
// @match        https://social.msdn.microsoft.com/Forums/*
// @match        https://social.technet.microsoft.com/Forums/*
// @exclude        https://social.msdn.microsoft.com/Forums/*/home*
// @exclude        https://social.technet.microsoft.com/Forums/*/home*
// @grant        none
// @copyright	 2015,Myfreedom614
// @namespace https://greasyfork.org/users/4544
// ==/UserScript==

(function() {
    'use strict';
    function UserException(message) {
        this.message = message;
        this.name = "UserException";
    }

    function OpenLinkNewTab(link) {
        window.open(link, '_blank');
    }

    try {
        var siteurl = document.URL;
        var regSite = "social..*.microsoft.com/Forums/.*/({{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}}{0,1})";
        var re = new RegExp(regSite);
        if (siteurl.match(re)) {
            //alert("Successful match");
            var myArray = re.exec(siteurl);
            var isAdded = document.getElementById('earedirect');
            if(isAdded === null)
            {
                var div = document.getElementById('threadPageContainer').getElementsByTagName('h1')[0];
                div.innerHTML += "<a id='earedirect' target='_blank' href='http://analyzeit.azurewebsites.net/Redirection/Navigate/"+ myArray[1] +"?external=mt' style='cursor: pointer;margin-left: -10px;'><img src='http://findicons.com/icon/download/263492/tag_purple/32/png' class='icon' style='width: 25px;height: 25px;'></a>";
            }
        }
        //else {
            //alert("No match");
            //throw new UserException("Can't extract the case id");
        //}
    }
    catch(err) {
        //alert(err.message);
        if (confirm(err.message + ', report it now ?')) {
            OpenLinkNewTab("https://github.com/dream-365/easy-analysis/issues");
        } else {
            // Do nothing!
        }
    }
})();