Javascript: want to run my Bookmarklet infinite time - javascript

I have one boomarklet, means javascript code that takes current page's source, search for one string (or i can say hyperlink) and changes the current page to gathered link.
The problem is that
i want to make it run infinite times, if possible pausing in between to let the page load.
This is for just one of RPG i am playing, i am bored of Clicking that Exchange Flower link
again and again and again.
and its not offensive, or i ca say not ethical, they have many bookmarklets for doing some other kinda work, so ..
here is the Code
javascript:window.location.href=document.documentElement.innerHTML.substring(document.documentElement.innerHTML.indexOf("museum.php?rfc="),document.documentElement.innerHTML.indexOf("museum.php?rfc=")+18)+"&step=a2";
Thanks anyway...

It seems like you are asking about running some javascript on page load, since the script is navigating the page. Tools like Greasemonkey (for Firefox) are built for just this.
For Google Chrome, you could try this tool which converts bookmarklets into extensions.

Related

How to write a chrome extension that displays the countdown from a webpage in a pop-up?

I've never posted on here before so I apologize if I'm doing something wrong.
I wanted to know if anyone had any tips on how I should go about creating this chrome extension.
There's an online game I play that has a page where users can collect items when it's "open". When it's closed, there's text on the page that tells you how many minutes are left until it opens again.
I'd like to write an extension that "looks" at the page and basically copies over that text to display so that you can see how many minutes are left without having to visit the page itself. What's the simplest way to do that? I'd like it to be quick enough to eventually work as a kind of alarm when the timer reaches 1 minute so that users know to go to the page & get there right when it opens.
When looking this question up I only really find information about web scrapers which doesn't seem like what I'm looking for. Any help is appreciated, thanks!
That's a pretty cool thing to do! I did it a while back for the MU Away game (don't know if it still exists).
I did it using Python actually, everytime I had an event on their website, it'd send me an email with what I wanted (i.e. Reset time was 0 so I could reset my character and start griding again)
You could use Python 3.8, selenium webdriver and SMTP Lib.
Let me know if you need more specific information.
web scrapers would be the easiest and fastest way of doing it.
1-2h in python or a week with chrome extension, but that might be me though, I'm kinda new to chrome extensions

How to block auto-scroll functionality of full page auto-scroll screenshot extensions?

I have a membership website where I want to prevent people from taking full page screenshots of the wall of text I have in my members area, using auto-scroll screenshot browser extensions like: Fireshot and GoFullPage.
I am looking for a script I can embed in my page that will break the auto-scroll functionality of these screenshot extensions. When the screenshot is being taken if the auto-scroll feature can be somehow broken, it will prevent the whole page from being captured in the screenshot using these extensions.
Not sure if its possible but it will definitely be very useful in stopping people from stealing the text content behind the paywall. I have enabled a script that prevents copy and right click. Now the only thing they can do is take auto-scroll screenshots of the long page. If I can prevent that as well, the only thing pirates can do is take multiple manual screenshots of the long page and manually stitch it together in photoshop. Just trying to make life difficult for them.
Screenshots are not controlled by the web browser, they are controlled by software running on the user's operating system and cannot be remotely controlled by a web server. There's a lot you can do to make it harder (javascript to capture the prtsc key press and return false, flicker different quadrants of the screen at intervals so that it's too fast for human eyes to really tell but so that the whole screen never shows at once, etc) but fundamentally anyone who's even vaguely tech-savy can bypass this in about 5 seconds. Also, a google search should have answered this for you in way less time than it took to ask.
You cannot block the print screen button or the snipping tool in Windows or the Grab application included with Mac OS or any other tool on any other OS. I hope I helped 😊

Possible to run Javascript from address bar (bookmarklet) within Google Chrome's settings panel?

I would like to make a bookmarklet to open google chrome's settings panel and clear my cache with a single click.
For a while now, Ive had a bookmark that opens chrome's settings panel with the 'clear cache' setting already selected. After clicking the bookmark (normally opening it in a new tab) I have to then opent the tab and submit the form. However, when developing this is a task I have to do quite often and these several repeated steps just seem unnecessary.
This link opens the page to clear one's cache (obviously for Chrome users only): chrome://chrome/settings/clearBrowserData#cache
I recently discovered bookmarklets and thought it would be a good way to accomplish the task of clearing my cache with a single click. However, I've discovered that putting even a basic javascript sample in the address bar when on the settings page (linked above) fails to work.
For example, this works in the address bar on any given page, but not from the chrome settings page:
javascript:alert('hello stackoverflow');
Is there a way to execute javascript from the chrome settings page? Are there other options? Im looking for any route to achieve this goal and would love to learn something along the way, even if it means doing some evil. :)
add a bookmark:
javascript:document.write('<form onsubmit="window.open(\'javascript:\'+js_line.value, \'target\');return false;">javascript:<input type=text name=js_line style="width:90%;"/></form><iframe src="" name="target" style="width:100%;height:90%;"/>');
What you want might not be fully possible through a bookmarklet, but it's certainly possible with a Chrome App. There is an app Clear Cache already. I find it pretty useful.

Do links with javascript slow down a page?

Due to an issue that came up with a website I have to use javascript for all of the links on the page.
like so...
<img src="image.png"/>
Will having many links with javascript on the webpage slow it down significantly?
Does the Javascript run when the page initially loads or only when a link is clicked?
EDIT: For those asking why I'm doing this. I'm creating an iPad site, when you use the 'add to home page' button to add the site as an icon, it allows users to view the site with no address bar.
However everytime a link is clicked it reopens Safari in a new window with the address bar back.
The only solution I could find was using javascript instead of an html based link to open the page.
For further reference see...
iPad WebApp Full Screen in Safari
2nd answer
"It only opens the first (bookmarked) page full screen. Any next page will be opened WITH the address bar visible again. Whatever meta tag you put into your page header..."
3rd answer down
"If you want to stay in a browser without launching a new window use this HTML code:
a href="javascript:this.location = 'index.php?page=1'"
"
I can see this adding to the bandwidth needs of a site marginally (very marginally), but the render time and the response time on clicking shouldn't be noticeable.
If it is a large concern I would recommend benchmarking the two different approaches to compare the real impact.
What do you mean by slow it down?
Page load time? Depends on the number of links on your page. It would have to be a LOT to be noticeable. Execution time? Again, not noticeable.
The better question to ask is are you o.k. with effectively deleting your website for those without javascript?
Also, if you are worried about SEO, you will need to take additional measures to ensure your site can still be indexed. (I doubt Google follows those kinds of URLs... could be wrong I guess).
EDIT: Now that you explained your situation above, you could easily just "hide" the address bar. See this SO question.

profiler for showing render statistics for web page?

I'm using a contrib drupal module that hooks into a form. Its presence appears to cause the jquery to render unreasonably slowly, but I'm not entirely sure about that.. I want to do some advanced troubleshooting on it, and I'm looking for a tool like xdebug that will give me an output file that I can view with KCacheGrind.
I've looked at Venkman and Firebug, but I don't want a debugging environment; I'm not at that point yet. I want to see a profile of the page load so I can see where the majority of the time was spent so I can identify where the problem is.
Edit: I'm actually not looking for a profile of the page load, as several folks have pointed out, but actually a profile of the javascript executed on a particular event. Firebug's debugger can grab the execution and step me into the code, but it just puts me at one point in the big ol' script. I think the slowdown involves loops and iterations, so I want to see a profile of the execution path.
Actually I think I should post this as a separate question.
In Firebug, click the "Net" tab. It lists every element it requests from the server, and detailed connection and load information (on hover) with a nice graphic display without hover.
Update
In addition, if actual page load isn't the issue, and you are indeed trying to profile Javascript, the Firebug "Console" tab probably has what you need.
Click "Profile" and then reload the page. Click "Profile" again to see a list of everything the javascript did with duration and timing information. This should show you what is taking the longest.
The chrome developer tools has a javascript profiler, that will profile all of the function calls on your page. The timeline feature (might only be in beta/dev versions) will show how much time the browser spends on various operations (layout and rendering for example) operations.
I believe that firebug also has a JS profiler.
There is a profiler in firebug in the console tab. Click once to start and second to stop the profiler. Chrome has also a profiler press ⌘⌥j. There is also a good profiling tool for internet explorer: dynaTrace ajax editon.
Btw. most of the time jquery is slow depends on wrong use of the selector engine.

Categories