Greasemonkey script in Firefox 4, want to change one line of code on webpage

岁酱吖の 提交于 2019-12-08 01:14:21

问题


Alright, I will try to make this is as simple as possible, without being too vague. I want to change one of line of code on a webpage in hopes of preventing a preview pane from appearing.

Original line of code

<div id="previewpane" class="previewpane" sytle="height: 139px;">

I want to replace the above line with

<div id="previewpane" class="previewpane previewpane-hide" style="height:139px;">

I have previously written one Greasemonkey script but unfortunately I am have having difficulty applying the techniques learned from that script into this new one, thus this post.

cheers
-Chris


回答1:


That's pretty easy. Here's a complete script that should work (change the include line).

// ==UserScript==
// @name            Easy Page tweaker
// @description     Hides pane?
// @include         http://stackoverflow.com/*
// @require         http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js
// ==/UserScript==

$("#previewpane").addClass ("previewpane-hide");


来源:https://stackoverflow.com/questions/5670868/greasemonkey-script-in-firefox-4-want-to-change-one-line-of-code-on-webpage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!