// ==UserScript== // @name elecfans 电子发烧网 阅读全文 // @namespace http://tampermonkey.net/ // @version 0.14 // @description 自动点击分页的全文按钮,并展开全文。去除部分广告。 // @author 萱萱的饭 // @match http://www.elecfans.com/* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; /* 该网站使用的是ajax判断用户是否登陆 如果未登录则缩起文章并添加上阅读全文按钮 */ $(document).ready(function(){ // 这里判断 ajax后 未登录则缩起文章 改变css样式 若改变则还原 // 电子说 http://www.elecfans.com/d/* var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;//浏览器兼容 var config = { attributes: true, childList: true}//配置对象 $("div.simditor-body").each(function(){ var _this = $(this); var observer = new MutationObserver(function(mutations) {//构造函数回调 mutations.forEach(function(record) { if(record.type == "attributes"){//监听属性 //console.log("html的属性发生了变化"); $('div.simditor-body').css('height','100%'); $('.seeHide').remove(); } if(record.type == 'childList'){//监听结构发生变化 //console.log("html的结构发生了变化") } }); }); observer.observe(_this[0], config); }); // 电子常识 http://www.elecfans.com/dianzichangshi/* // 点击阅读全文并展开 $('.article-content').css('height','100%'); $('.seeHide').remove(); $('html body.article-page div#header div.advertising.clearfix').remove(); $('a.page-next').each(function(i){if($(this).text()=='全文'){ $(this)[0].click(); }}); // 去掉广告 $('.sub-adbt').remove(); }); // Your code here... })();