PersonalSkipper

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

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

  1. // ==UserScript==
  2. // @name PersonalSkipper
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.21
  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タグのjqueryオブジェクトを受け取り、hrefのアドレスに遷移する
  19. function gotoHref(a) {
  20. if(a[0]){
  21. location.href = a.attr('href');
  22. // [http://~~/]の部分が記載されていないリンクの場合の対応
  23. // TODO この処理はいずれ整理
  24. if(location.href.indexOf('http://matome-alpha.com/') != -1) {
  25. location.href = location.protocol + '//' + location.hostname + '/' + a.find('.entry_title_eid a').attr('href');
  26. }
  27. }
  28. else{
  29. console.log("no link found");
  30. }
  31. }
  32. // クエリ文字列の指定したパラメータを取得
  33. function getQueryParam(key) {
  34. if(location.search.length === 0 || key.length === 0) {
  35. return "";
  36. }
  37. var params = location.search.slice(1).split('&');
  38. var i;
  39. for(i = 0; i < params.length; i++) {
  40. var pair = params[i].split('=');
  41. if(pair[0] == key) {
  42. return pair[1];
  43. }
  44. }
  45. return "";
  46. }
  47.  
  48. // ----------------------main----------------------
  49. var i;
  50. for(i = 0; i < 10; i++) {
  51. if(location.href.indexOf('http://gihyo.jp') != -1){
  52. if($("#skip a")[0]){
  53. var event = document.createEvent("MouseEvents");
  54. event.initEvent("click", false, true);
  55. $("#skip a")[0].dispatchEvent(event);
  56. }
  57. }
  58. else if(location.href.indexOf('http://newmofu.doorblog.jp/archives') != -1) {
  59. $(".title_link a").each(function(){
  60. if($(this).is(':visible')){
  61. gotoHref($(".title_link a"));
  62. }
  63. });
  64. }
  65. else if(location.href.indexOf('http://newser.cc/date-20160505.html') != -1) {
  66. var id = getQueryParam('ni');
  67. $(".news-link").each(function(){
  68. if($(this).attr('data-id') === id) {
  69. gotoHref($(this).find('a'));
  70. }
  71. });
  72. }
  73. else if(location.href.indexOf('http://matome-alpha.com/') != -1) {
  74. $(".entry_list_box").each(function(){
  75. if($(this).attr('ei') == getQueryParam('eid')) {
  76. gotoHref($(this).find('.entry_title_eid a'));
  77. }
  78. });
  79. }
  80. else if(location.href.indexOf('http://2ch-c.net/') != -1) {
  81. gotoHref($('.widget-content a[style="color: rgb(255, 85, 85); font-weight: bold;"]'));
  82. }
  83. }
  84. })();