I've found examples of bookmarklets that select a URL from a page at
random, but I'd like one that generates part of the URL at random.
If you have a bunch of images that are named:
mydomain.com/images/abcd.jpg where abcd is can be any combination of 4
lowercase letters - is there a way of having the bookmarklet generate
the letters randomly when clicked?
I'm able to do it using AppleScript & Safari but would like it to work
from within Safari - which is missing the "Scripts" menu that most Apple
apps have :(
It looks as if bookmarklets are the only option, but I've only ever used
javascript to select randomly from existing arrays of images and don't
fancy typing in the names of a couple of thousand images...
I have a bookmarklet which copies a marked set of characters into a searchpage in our dictionary. If nothing is copied, a window opens where you can type a word.
BTW, it is for firefox 2.0.
javascript:s=window.getSelection();if(s=='')for(i= 0;i<frames.length;i++){s=frames[i].document.getSelection();if(s)break;}if(!s)void(s= prompt('some text.',''));if(s){test=open('URL/search.pl?searchphrase='+escape(s));test.focus();} This works well.
We have another search /command which needs to be finished with &search= after the searchphrase
searchphrase="here comes the markedtyped set of characters"&search=
Can anyone of you help me changing the bookmarklet or point me to a site where I can read more about this?
Download the attached file, rename it read.html and open it. Drag the "read" link onto your Favorites|Links toolbar, and acknowlege the warning dialog. Then, from anyone's page, click the "read" bookmarklet and read along with it.
My basic premise is that vowels and digits make for a place to pause momentarily (90ms) during reading. If it reads too fast or slow, you can adust the delay factor accordingly.
When publishing bookmarklets, we put the bookmarklet code in anchor tag like this:
<a href="javascript: alert('test');"name </a>
Some characters of the code need to be escaped. For example, double quotes need to be escaped as %22 like in this example: <a href="javascript: var doubleQuote = '%22' alert(doubleQuote);"> name </a>
Question: Is double quotes the only thing that need to be escaped?
I have seen examples of escaping spaces as %20, but it seems unnecessary in most browsers i have used.
I'm using the following javascript bookmarklet for creating del.icio.us posts, and it works fine, but i've been trying to augment it with "document.getSelection" and have not gotten it to work.
the code is: javascript:q=location.href;p=document.title;void(open('http://del.icio.us/fogboy?v=3&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title),'delicious%20',%20'toolbar=no,width=740,height=700'))
and it works fine (to test of course you'd have to change the del.icio.us username in there), except it doesn't have the "document.getSelection" syntax which would make it so highlighted text on a page was put in the "notes" field. i've tried about 5 different ways of writing that, based on other versions i've seen around. i would love to know exactly the right syntax to use to get this working.
I found this bookmarklet which I'm using in Firefox Would anyone here be willing to modify it to display its results in a new tab, instead of using the current tab?
Code: javascript:q = "" + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text); if (!q) q = prompt("You didn't select any text. Enter a search phrase:", ""); if (q!=null) location=("http://www.google.com/search?num=100&q=site:" + escape(location.hostname) + " "" + escape(q.replace(/"/g,"")) + """).replace(/ /g, "+"); void 0
I have bookmarklets with a # in their urls but safari changes the # to %23. And unfortunately, the bookmarklet does not work with %23. You need to change it back manually to #.
I need this bookmarklet (below) to open in a new window and display the info there. It needs to work in both FF and IE. It would be in one line in the bookmarklet but I expanded it for readability. It should work against our site: [URL]
Its the "To English" bookmarklet as featured on lifehacker (http://lifehacker.com/5168984/to-english-bookmarklet-quickly-easily-translates-any-text-with-one-click).
I'm trying to use Javascript to have an array of images that load randomly AND work in a slideshow manner so change every 3 seconds (in a logical order). The code I have below presents a random image but how do I get them to continue from the random image and change to the next every 3 seconds?
I have found a script for opening all linked images of one page in a new window and displaying all images in full size inline. It works so far, however:
I want the images to be displays in the current window i am in instead of opening a new window.
I am trying to make a twitter bookmarklet that will tweet the current page, I currently have this code: Javascript:window.open('[URL]'+self.location) But when I try it, it changes the page its tweeting to just show [object Window].
I'm not very well versed in javascript. I'm trying to make a bookmarklet that when I click it will either append text to what I've already written or insert the predefined text at the cursor's position in a textarea. Also the browser I'm trying to do this on is Chromium.
Here's what I have:javascript:void((function(){document.getElementsByTagName('textarea')[0].value='ಠ_ಠ'})())
but this of course changes the entire value of the text field to: ಠ_ಠ ...rather than appending or inserting at the cursor position. I'm guessing append would be the simplest, though cursor position would be most efficient.
I've looked for a solution to this issue, but it seems like a little different scenario than other situations. I made a system for generating friend requests on Facebook. I have a grid that is 6 x 3, for a total of 18 cells. Each cell has a picture in it, and the picture is linked to the Facebook friend request page. My problem is that since each cell is populated at random from the array, I'm getting lots of repeats. For example, some picutures are in 5 cells, and some are in none. I'm trying to figure out how to make it so that once a picture is used once in the grid, it does not get used again in the same grid.I still want every cell filled at random on each page load, I just want to prevent the repeating.
Here's my current code: <script type="text/javascript"> var vip_list=new Array( new Array('http://profile.ak.fbcdn.net/v225/1616/88/s1220771654_2158.jpg','http://www.facebook.com/addfriend.php?id=1220771654'), new Array('http://profile.ak.fbcdn.net/v223/1233/29/s904885342_9055.jpg','http://www.facebook.com/addfriend.php?id=904885342'),
In pre-Windows XP Internet Explorer, adding a bookmarklet for a user was really simple. All I add to do was create a link that executed addFavorite().
Internet Explorer under Windows XP won't allow that due to its new security measures.
How can I make adding a bookmarklet convenient for my Windows XP IE users without having them to do surgery on their security preferences?
Right now I'm having them Ctrl-D to add a new bookmark. Right-click the new bookmark to get the Properties dialog, and then pasting in the contents of my bookmarklet. This is quite messy as you can imagine. In addition, when they save the bookmarklet, they have to hit "Yes" to an error box telling them that "javascript:" does not have a registered program associated with it, do they want to save the bookmark anyways?
I am trying to write a bookmarklet that will let me know an object.For the most part, it works as best I could hope until I try it on a real page.For the purposes of understanding, I am using the Bookmarklet builder here [URL] for testing.
Here is the code:
(function (){ var theObjStr = prompt('What Object would you like to know?',''); var theObj = eval(theObjStr);
[code]....
I compress the code, and test it via the link on the bottom of the page and everything works magically.Add the Bookmarklet to your favorites, and go to [URL] and try to run it in IE7.I am getting an access denied error when the code gets to the line:
var wHndDoc = jjPopWin.document; I have tried everything including just calling a straight jjPopWin.document.write(); with the same results.
I am on Windows XP SP3, Using IE7 (works great in Firefox 2 &3).
It would be easier to explain this if you play mafia wars (or any game that includes intra-game exchange of gifts/items between members) but the actual scripting doesn't require any knowledge of the game.
Background Information Mafia Wars is a game on Facebook (and myspace, yahoo etc.) that among other things allows its players to send gifts to each other. Now because different people end up with more things of one type and are short of things of another type, the players have evolved a trading dynamic. Where x number of Item 1 is traded for y number of Item 2. A simple marketplace. And with this territory come scammers.
Essentially a player who doesn't go through with his end of the deal. good player sends item to bad player. bad player removes good player from mafia and blocks him for ever contacting him through his facebook profile. This has given rise to my group, among many others, that lists these scammers (identified with their facebook profile ids) as they are reported every day. Now over time the list has grown and it has become difficult and unrealistic to expect people to know who is on the list and who is not.
The Requirement A javascript bookmarklet (there are many already servicing different needs of the players) that sits on the browser and tells the user if the person he is about to trade with is a listed scammer or not.
The Breakdown The user will click the bookmarklet when he is on the facebook profile of the person he is about to trade with. When clicked the script will pull the facebook profile id from the current page, and then scan a text file located on a third-party server and return with a pop-up box message that reports if the id is listed as a scammer or not.
For my website I would like to create a famous last words generator (randomized), and random page generator (within my site). What is the code for random quotes and random links?
I am new to javascript but have been using java for quite a while. I am looking to make a random quote (out of ten possible quotes) appear in my h2 tag in a page i am working on. In java, i would make a random number generator, in javascript it looks like this:
Code: var randomnumber=Math.floor(Math.random()*11) Then make an if statement: Code: if randomnumber=1 { var quote="Live long and prosper" }
document.write(var quote); Could someone more experienced than me tell me if my code looks good and how would a go about getting "var quote" in my h2 tag?
I need a java bookmarklet that does a real simple thing. I need to take the current URL (ie, where the user is when they click the bookmarklet) and append it to a static URL and return the text on the resulting page.For example:
The user is at http:[url]....
The user clicks the bookmarklet.
the bookmarklet takes http:[url].... and appends it to http:[url]... HERE where you see the URL HERE text.That PHP script echos a simple line of text (a shortened URL actually).Then I want that result from the outside_create.php file to be displayed in a window back to the user.Is this even possible? Basically I need to know how to append location.href to a static URL and how to get the resulting content from the static URL..