PersonalSkipper

2chアンテナサイトをスキップ。広告画面の「スキップ」ボタンを自動で押す

目前为 2016-05-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name PersonalSkipper
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.20
  5. // @description 2chアンテナサイトをスキップ。広告画面の「スキップ」ボタンを自動で押す
  6. // @author You
  7. // @match http://gihyo.jp/*?*ard=*
  8. // @match http://newmofu.doorblog.jp/*
  9. // @match http://newser.cc/date-20160505.html*
  10. // @match http://matome-alpha.com/*
  11. // @match http://2ch-c.net/*
  12. // @require https://code.jquery.com/jquery-2.2.3.min.js
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18. // aタグのセレクタを渡して、hrefのアドレスに遷移する
  19. // あまり短くならないので微妙?
  20. function gotoHref(aTag) {
  21. location.href = $(aTag).attr('href');
  22. }
  23. // クエリ文字列の指定したパラメータを取得
  24. function getQueryParam(key) {
  25. if(location.search.length === 0 || key.length === 0) {
  26. return "";
  27. }
  28. var params = location.search.slice(1).split('&');
  29. var i;
  30. for(i = 0; i < params.length; i++) {
  31. var pair = params[i].split('=');
  32. if(pair[0] == key) {
  33. return pair[1];
  34. }
  35. }
  36. return "";
  37. }
  38. var count = 0;
  39. var loop = setInterval(function(){
  40. count++;
  41. if(count > 10){
  42. clearInterval(loop);
  43. }
  44. if(location.href.indexOf('http://gihyo.jp') != -1){
  45. if($("#skip a")[0]){
  46. var event = document.createEvent("MouseEvents");
  47. event.initEvent("click", false, true);
  48. $("#skip a")[0].dispatchEvent(event);
  49. clearInterval(loop);
  50. }
  51. }
  52. else if(location.href.indexOf('http://newmofu.doorblog.jp/archives') != -1) {
  53. $(".title_link a").each(function(){
  54. if($(this).is(':visible')){
  55. gotoHref(".title_link a");
  56. clearInterval(loop);
  57. }
  58. });
  59. }
  60. else if(location.href.indexOf('http://newser.cc/date-20160505.html') != -1) {
  61. var id = getQueryParam('ni');
  62. $(".news-link").each(function(){
  63. if($(this).attr('data-id') === id) {
  64. location.href = $(this).find('a').attr('href');
  65. clearInterval(loop);
  66. }
  67. });
  68. }
  69. else if(location.href.indexOf('http://matome-alpha.com/') != -1) {
  70. $(".entry_list_box").each(function(){
  71. if($(this).attr('ei') == getQueryParam('eid')) {
  72. location.href = location.protocol + '//' + location.hostname + '/' + $(this).find('.entry_title_eid a').attr('href');
  73. clearInterval(loop);
  74. }
  75. });
  76. }
  77. else if(location.href.indexOf('http://2ch-c.net/') != -1) {
  78. location.href = $('.widget-content a[style="color: rgb(255, 85, 85); font-weight: bold;"]').attr('href');
  79. clearInterval(loop);
  80. }
  81. }, 300);
  82. })();