Greasy Fork

adshorte.shorte

adshorte.com用

目前为 2017-06-16 提交的版本。查看 最新版本

// ==UserScript==
// @name        adshorte.shorte
// @namespace   http://adshorte/
// @include     *://adshorte.com/*
// @version     1.3
// @description adshorte.com用
// @grant       none
// @run-at      document-end
// ==/UserScript==
(function() {
  var iframes = document.getElementsByTagName('iframe');
  for(var iframe of iframes){
    if(iframe.src.indexOf("dailymotion") != -1){
      iframe.parentNode.removeChild(iframe);
    }
  }
})();
function openSesame() {
  if (grecaptcha.getResponse(0) !== "") {
    document.getElementById("link-view").submit();
    clearInterval(b);
  }
}
var b = setInterval(openSesame, 500);

if (document.getElementById("go-link") !== null) {
  var goForm = $("#go-link");
  var submitButton = goForm.find('button');
  $.ajax({
    dataType: 'json',
    type: 'POST',
    url: goForm.attr('action'),
    data: goForm.serialize(),
    success: function(result, status, xhr) {
      if (result.url) {
        location.href = result.url;
      } else {
        console.info(result.message);
      }
    },
    error: function(xhr, status, error) {
      console.log("An error occured: " + xhr.status + " " + xhr.statusText);
    },
    complete: function(xhr, status) {
    }
  });
}