Basically, I have a bookmarklet with code in it that I can and want to update later.
Is it possible to make the bookmark update itself if it is out of date? I don't want to force my users to always manually update it.
I have tried to look it up but the results are either chrome extensions adding/updating the bookmark, or just putting javascript in bookmarks, which I already know how to do.
Is it possible to do what I am trying to do? Or do I have to store the main code in localStorage and update that?
(Ignoring the problem about detecting the version and fetching the updated code, I got that covered)
Related
I need to create a Chrome extension that will work only for one webpage with specific URL. It will monitor changes to list of items (orders) located on page and if new order appears, it will read some values from order and do something with them. It also may be neccessary to refresh the page from time to time (using timer, maybe).
What architechture will be suitable to accomplish such a task?
Now - to thoughts I have so far. I think now of using only one content script bound to page URL. Will it be enough? Or should I introduce some background script also? Or anything else?
As #wOxxOm said in the comments, creating one content script must be sufficient for reading the values and page refreshing.
So Lets say I have a site like this one http://www.worldtimeserver.com/
and I want somehow to get the value of the time every second and write that value in a .txt file. I was going to use a OCR(optical character recognition) software for this job but ..... in the end this option wasn a good choice because I could not rely on exact position of the clock.
Then I started to think "is there a way to inject/put some code in the browser that would do this?". When I inspect the web-page (in Chrome) I saw that the Div containing the time has an id="theTime". So is there a way to do this? I have some basic experience in JS & DOM ... but this I have no idea how to do or from where to start. Also i would like to point out that I need to rely that the script will do this job for hours and hours and that the value of the clock is set by outside (a server).
If the value does not require the browser to refresh to change the value.. you can save it using localstorage and later copy paste it in a txt file
this is a possible duplicate.
Get value of input field inside an iframe
use an iframe (you can hide it if you don't want users to see it).
I am trying to find out a way to write an external script that will run on my computer and preform a specific action. The script needs to access my google chrome, a specific tab, and check the code of the website for a button property change. Ones the button's property changes i want the script to press the button. I am sure that the detection itself is easy, I'm just not sure how to write an external scrip that will access Chrome.
If you want an outside code to do things for you (read, automate), and you are trying to do it on a website, I suggest looking into Selenium.
After reading the comments i came to the conclusion you just want your button to be clicked when it hits 0 (which it seems you have already done) if that is the case: (sorry if read it wrong question is not very clear)
you can use 2 different ways one is
javascript
var l = document.getElementById('your-button-id');
l.click();
another is using the trigger functionality with jQuery
$(document).ready(function(){
$("yourbuttonid").trigger("click");
});
I know very little, but...
I have a function that checks userProperties variables before it runs each part of the code. That's cool.
Right now I set userProperties at the top of the function, but what I want is to have check boxes in an HTML sidebar where the user can decide what they want to do. (once the user sets their preferences, I want that to persist to the next time they open that doc and not have the defaults over write it each time).
My question is two-fold.
What's a good way to have default settings in a script?
and what I really really want to know:
How do you hook up a checkbox to write to userProperties?
The Add-on 5-Minute Quick Start includes a decent example of updating & using properties to manage user preferences. It sets the preferences as a by-product of running a translation, but that workflow can be easily adapted to be an explicit save operation.
I need to capture the current visual state of a webpage. I have seen a few different solutions such as HTML2canvas or node-webshot. The problem is that I need to be able to capture the current state of the page rather than just the html from a given url.
E.g if a user goes to a URL and clicks on a few options which change the UI through ajax I need to be able to capture the page as it is to the user at any given time.
Basically I need to take a screenshot ( most likely using javascript ) of the current state of a web page. Im wondering if anyone has an suggestions as to what the best way to go about doing this would be?