您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
原始的 PTT 網頁用 Evernote Web Clipper 擷取,圖片會跑版,此為替換原本的自動開圖區塊
当前为
- // ==UserScript==
- // @name PTT reformat for Evernote
- // @namespace https://greasyfork.org/zh-TW/users/79288
- // @version 1.6
- // @description 原始的 PTT 網頁用 Evernote Web Clipper 擷取,圖片會跑版,此為替換原本的自動開圖區塊
- // @author jlhg
- // @match https://www.ptt.cc/bbs/*/*.html
- // @match https://www.ptt.cc/man/*.html
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- let imageStyle = "max-height:none;max-width:800px";
- ['.jpg', '.JPG', '.png', '.PNG', '.jpeg', '.JPEG', '.gif', '.GIF'].forEach(function(ext) {
- let images = document.querySelectorAll('a[href$="' + ext + '"]');
- for (let i = 0; i < images.length; i++) {
- let imageUrl = images[i].href;
- imageUrl = imageUrl.replace('https://i.imgur', 'http://i.imgur');
- imageUrl = imageUrl.replace('https://imgur', 'http://imgur');
- images[i].innerHTML += '<br><img src="' + imageUrl + '" style="'+ imageStyle + '"><br>';
- images[i].style.boxShadow = 'none';
- }
- });
- let images = document.querySelectorAll('a[href^="https://imgur.com/"]');
- for (let i = 0; i < images.length; i++) {
- if (images[i].href.indexOf("https://imgur.com/a/") >= 0 || /\.(jpg|png)$/i.test(images[i].href)) {
- continue;
- }
- images[i].innerHTML += '<br><img src="' + images[i].href.replace('https://imgur.com/', 'http://i.imgur.com/') + '.jpg" style="' + imageStyle + '"><br>';
- images[i].style.boxShadow = 'none';
- }
- let richcontents = document.querySelectorAll('.richcontent');
- for (let i = 0; i < richcontents.length; i++) {
- richcontents[i].remove();
- }
- })();