Kiss Insights Goodbye

Remove KissInsights dialogs from all web sites.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name           Kiss Insights Goodbye
// @namespace      https://github.com/johan/
// @description    Remove KissInsights dialogs from all web sites.
// @match          https://*/*
// @match          http://*/*
// @run-at         document-start
// @version 0.0.1.20140419225638
// ==/UserScript==

var start = +new Date
  , kmode = localStorage.KissInsights
  , quiet = kmode === 'quiet'
  , is_ki = /^\/\/s3\.amazonaws\.com\/(ki\.js|r\.kissinsights\.com)\//
  , edits = { childList: true
            , subtree: true
            }
  ;

if (quiet || !kmode)
  (new WebKitMutationObserver(removeKissInsights)).observe(document, edits);

function removeKissInsights(mutations) {
  for (var i = 0, m; m = mutations[i]; i++)
    for (var j = 0, a = m.addedNodes, n; n = a[j]; j++)
      if (n.id === 'ki_container')
        nuke('Kiss Insights container removed: ', n);
      else if (n.src && /^script$/i.test(n.nodeName) &&
               is_ki.test(n.getAttribute('src')))
        nuke('Kiss Insights script removed: ', n);
}

function nuke(msg, n) {
  n.parentNode.removeChild(n);
  if (quiet) return;
  var args = [].slice.call(arguments)
    , help = '\nTo enable for this site, set localStorage.KissInsights = true;'
    ;
  console.warn.apply(console, [+new Date - start +'ms:'].concat(args, help));
}