bookmarklet

Find and replace in a webpage using javascript [duplicate]

瘦欲@ 提交于 2019-11-30 08:45:28
问题 This question already has an answer here : Replace many text terms, using Tampermonkey, without affecting URLs and not looking for classes or ids (1 answer) Closed 2 years ago . What I want to do is replace all instances of 'foo' in a webpage with 'bar' in a JS bookmarklet/greasemonkey script. How can I do this? I suppose jQuery works, as there're hacks to include those in both bookmarklets and greasemonkey scripts. 回答1: This script iterates through each element in the document and replaces

JavaScript bookmarklet to delete all cookies within a given domain

爱⌒轻易说出口 提交于 2019-11-30 08:17:42
I am testing a web app that writes cookies to subdomain.thisdomain.com and several subfolders within that. I'm looking for JavaScript that I can put into a bookmarklet that will delete all cookies under that subdomain, regardless of the folder in which they exist. Any ideas? Robert J. Walker Derived from my answer here : javascript:new function(){var c=document.cookie.split(";");for(var i=0;i<c.length;i++){var e=c[i].indexOf("=");var n=e>-1?c[i].substr(0,e):c[i];document.cookie=n+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT";}}(); return void(0); Due to browser security issues, this will only work

unable to run an external javascript using a bookmarklet

南楼画角 提交于 2019-11-30 07:03:59
问题 Totally newbie about JS. I need to use an external script which modifies some elements in the current page accessing it as a bookmarklet. If I modify the html source code of the web page inserting the following < script > lines: s=document.createElement('script'); s.type='text/javascript'; s.src='script.js'; document.getElementsByTagName('head')[0].appendChild(s); it works fine. But if I create a javascript: bookmarklet with the same lines, I obtain a blank page with the following string:

Allowing cross-origin requests in Yesod

别来无恙 提交于 2019-11-30 05:07:53
My application uses a bookmarklet, and I need to allow CORS for MyRouteR so my bookmarklet code can use this route for AJAX requests. In my first draft of config/routes I gave MyRouteR support for only one request method, PUT. But it turned out (duh) that I'd need to support the OPTIONS method as well, which browsers use for CORS preflight requests. I ended up with the following in config/routes: /myroute MyRouteR PUT OPTIONS I was kind of hoping there would be some relevant machinery in the Template Haskell that processes config/routes so that the addition of OPTIONS to this route's method

Bookmarklet to edit current URL

余生颓废 提交于 2019-11-30 03:30:11
I'm looking for a simple bookmarklet to take the current URL of my website and refresh it with a couple of changes. For example: Take the current page: http://www.example.com/pages/ and change it to: https://admin.example.com/pages/ then load that new URL. I tried searching for a bookmarklet that can do this but I couldn't find one. Can anyone point me in the right direction? Even a bookmarklet that does something like this that I can edit to suit my needs. Just change window.location , e.g. window.location=window.location.toString().replace(/^http:\/\/www\./,'https://admin.') javascript

easier bookmarklet development

十年热恋 提交于 2019-11-30 02:29:28
Here's how I make develop a bookmarklet: I write a javascript function, pass that to Bookmarklet Builder to make a bookmarklet, add the bookmarklet to my browser, load my test webpage, test the bookmarklet, and then something doesn't work, so I try to find what's wrong and change my javascript function accordingly and the tedious cycle starts again. How can I make this cycle less tedious? use the firebug console to develop and test your function, and turn it into a bookmarklet once you've got it working like you want to. These days I prefer to edit a file on my webserver, then load that using

highlight a DOM element on mouse over, like inspect does

心不动则不痛 提交于 2019-11-30 02:22:07
We have a bookmarklet, and the user clicks a button and an inspect like highligther needs to kick in. We want to this to be cross browser. For this we need to detect the DOM element during the mouse move, and once we have this element we need to highlight with CSS. We have problems detecting the DOM element by mouse move, can you guide us how this is done? Once we have this DOM element, on user click we need to extract XPath. You can hook mousemove on document or document.body , then use the target property of the event object to find out the topmost element the mouse is over. Then applying

Gmail conversation view toggle bookmarketlet / favelet / “scriptlet”

北城余情 提交于 2019-11-29 16:58:01
问题 I noticed that if I have a gmail tab open with conversation view on/off, and then I open another tab and change the conversation view setting, my original tab stays in the conversation view state it started in such as when doing new searches etc. and the new tab uses the setting I just changed it to. This led me to think there might be some JavaScript bookmarklet / favelet / "scriptlet" that could easily let us change the setting for a given gmail tab temporarily without having to go into the

Bookmarklet: Append hidden iframe to page and load url

时间秒杀一切 提交于 2019-11-29 14:18:13
问题 I have a bookmarklet for resetting my router. I just need to visit and let the page finish loading, then my router starts resetting. javascript:(function(){w=window.open("http://192.168.0.1/goform/formReboot","","width=1,height=1");self.focus();window.onload=w.close();})(); But it opens in a popup window. My new idea is to dynamically append an hidden iframe to the page I'm on using a javascript bookmaklet, and then open the url in the hidden iframe. Is this even possible? I'm open for better

JavaScript bookmarklet to delete all cookies within a given domain

本秂侑毒 提交于 2019-11-29 11:29:20
问题 I am testing a web app that writes cookies to subdomain.thisdomain.com and several subfolders within that. I'm looking for JavaScript that I can put into a bookmarklet that will delete all cookies under that subdomain, regardless of the folder in which they exist. Any ideas? 回答1: Derived from my answer here: javascript:new function(){var c=document.cookie.split(";");for(var i=0;i<c.length;i++){var e=c[i].indexOf("=");var n=e>-1?c[i].substr(0,e):c[i];document.cookie=n+"=;expires=Thu, 01 Jan