|
Post by Nnelg on Jan 17, 2014 2:12:08 GMT
It doesn't seem to be working for me (on Firefox 26.0).
|
|
|
Post by goldenknots on Jan 17, 2014 3:52:44 GMT
I don't execute any sort of code from people I don't know.
|
|
|
Post by Daedalus on Jan 17, 2014 4:39:03 GMT
I don't execute any sort of code from people I don't know. This is true. Though it seems innocuous, and I am sorry to distrust, but I do not trust my meager coding skills enough to use this code. Especially when no description is given for how it should function.
|
|
|
Post by Señor Goose on Jan 17, 2014 8:07:08 GMT
We need a certified Code Monkey in the Party Hat Rule Thread.
|
|
|
Post by Señor Goose on Jan 17, 2014 8:13:00 GMT
I can confirmt hat it does seem to place a Party Hat in your browser. Further research is necessary.
|
|
|
Post by jasmijn on Jan 17, 2014 8:35:51 GMT
Yeah, I'm confident it does only Party Hat-related things, and in particular that there's no nasty things going on. (I used my epic code reading skills.)
On the other hand, applause for the people who didn't run this, because better safe than sorry.
|
|
|
Post by Gotolei on Jan 17, 2014 9:18:21 GMT
Well the only link it loads is i.imgur.com/4I6EZCO.png. Looks like it creates an image element of ^ link (absolute positioning makes it movable independent of page content, z-index 2000 draws it above the page). When it's clicked it checks if either shift or ctrl are pressed and modifies a variable accordingly, then the variable is added to the object's height and the image I guess holds its aspect ratio. It also grabs the cursor's coordinates. The last part onMouseUp checks where the cursor is, compares it to where it was when the click started and modifies X,Y accordingly. ..and I don't even know Javascript speaking of bookmarklets >.>
|
|
|
Post by Xan on Jan 17, 2014 9:31:18 GMT
I'm a web developer, and I made this for a coworker. We decided it deserved needed to be shared with the world. Unfortunately BBCode makes it more difficult to share, but create a new bookmark and put the following in the URL: javascript:(function(){function s(){e.setAttribute('style',t+'top:'+r+'px;left:'+n+'px;width:'+i*100+'px;height:'+i*126+'px;')}var e=document.createElement('img');var t='position:absolute;display:block;z-index:2000;';e.src='http://i.imgur.com/4I6EZCO.png';var n=0,r=window.scrollY;var i=.5;s();var o=document.getElementsByTagName('body')[0];o.appendChild(e);var u=undefined;var a,f;e.onmousedown=function(t){if(t.button==0){if(t.shiftKey){i+=.1;s();t.preventDefault();return}else if(t.ctrlKey){i-=.1;s();t.preventDefault();return}u=e;a=t.clientX-n;f=t.clientY-r}};e.onmousemove=e.onmouseleave=function(t){if(u==e){n=t.clientX-a;r=t.clientY-f;s();t.preventDefault()}};e.onmouseup=function(e){if(e.button==0){u=false;e.preventDefault()}}})() an appropriate name for this "bookmarklet" would be Party Hat Rule. The dragging isn't perfect, I did this in about ten minutes. Shift-click and Ctrl-click resize. Hopefully this will brighten someone's day. I can provide the unminified source code if anyone wants. Lacks ability to rotate. Hm. I might try to make a Chrome extension that does all this..
|
|
|
Post by quinnius on Jan 17, 2014 14:09:16 GMT
Sorry, I put that up at the end of a long day and didn't realise how sketchy it would seem.
Here's the uncompressed source for anyone who wants to review it:
(function() {
var hat = document.createElement('img');
var baseStyle = "position:absolute;display:block;z-index:2000;"
hat.src = "http://i.imgur.com/4I6EZCO.png";
var x = 0, y = window.scrollY;
var scale = 0.5;
function setPos()
{
hat.setAttribute("style", baseStyle + "top:" + y + "px;left:"+ x + "px;width:"+scale*100+"px;height:"+(scale*126)+"px;");
}
setPos();
var body = document.getElementsByTagName("body")[0];
body.appendChild(hat);
var dragging = undefined;
var diffX, diffY;
hat.onmousedown = function(ev)
{
if (ev.button == 0)
{
if (ev.shiftKey)
{
scale += 0.1;
setPos();
ev.preventDefault();
return;
}
else if (ev.ctrlKey)
{
scale -= 0.1;
setPos();
ev.preventDefault();
return;
}
dragging = hat;
diffX = ev.clientX - x;
diffY = ev.clientY - y;
}
};
hat.onmousemove = hat.onmouseleave = function(ev)
{
if (dragging == hat)
{
x = ev.clientX - diffX;
y = ev.clientY - diffY;
setPos();
ev.preventDefault();
}
};
hat.onmouseup = function(ev)
{
if (ev.button == 0)
{
dragging = false;
ev.preventDefault();
}
};
})(); edit: thus showing the necessity of javascript minification for production bookmarklets.
|
|
|
Post by Señor Goose on Jan 17, 2014 15:58:22 GMT
Yeah, I'm confident it does only Party Hat-related things, and in particular that there's no nasty things going on. (I used my epic code reading skills.) On the other hand, applause for the people who didn't run this, because better safe than sorry. Hey if it wasn't for people like you would have no idea which mushrooms were good to eat.
|
|
|
Post by Xan on Jan 22, 2014 17:29:39 GMT
Lacks ability to rotate. Hm. I might try to make a Chrome extension that does all this.. Well, would you look at that. I did it. Enjoy!
|
|
|
Post by GK Sierra on Jan 22, 2014 19:03:01 GMT
A recent XKCD comes to mind...
|
|
|
Post by Xan on Jan 22, 2014 19:22:19 GMT
A recent XKCD comes to mind...[snip] Spot on. The hat code was built quite quickly. The menu.. It's very quirky to inject into existing pages without breaking. Still not 100% functioning as it should.
|
|
|
Post by Gotolei on Jan 22, 2014 20:40:22 GMT
Aaand it only works in Chrom* now. Wonderful
|
|
|
Post by Chancellor on Jan 22, 2014 20:41:31 GMT
Haha.
|
|
|
Post by Xan on Jan 22, 2014 21:09:22 GMT
Aaand it only works in Chrom* now. Wonderful Sorry about that, but it's the only browser I have experience writing extensions for.
|
|
|
Post by Señor Goose on Jan 22, 2014 21:35:34 GMT
Lacks ability to rotate. Hm. I might try to make a Chrome extension that does all this.. Well, would you look at that. I did it. Enjoy! You brilliant bastard.
|
|
|
Post by Xan on Jan 22, 2014 23:08:57 GMT
|
|
|
Post by freeformline on Jan 23, 2014 1:35:16 GMT
Lacks ability to rotate. Hm. I might try to make a Chrome extension that does all this.. Well, would you look at that. I did itThis is the best thing since ad-blockers. You are truly a giant of the modern internet. I cannot thank you enough.
|
|
|
Post by Señor Goose on Jan 23, 2014 1:42:01 GMT
Myahhr!
|
|
|
Post by GK Sierra on Jan 23, 2014 1:42:44 GMT
...Firefox version, mayhaps?
|
|
|
Post by quinnius on Jan 23, 2014 2:55:12 GMT
So did I succeed in brightening some people's days? That's really all I was hoping to do.
|
|
|
Post by Chancellor on Jan 23, 2014 4:02:53 GMT
|
|
|
Post by Daedalus on Jan 23, 2014 5:35:03 GMT
You have indeed.
|
|
|
Post by feraldog on Jan 23, 2014 6:38:40 GMT
Langstrom needed some cheering up. I don't think it worked... Attachments:
|
|
|
Post by george on Jan 25, 2014 2:48:26 GMT
10/10 great plugin. Can you add lasers?
|
|
|
Post by Señor Goose on Jan 25, 2014 4:10:16 GMT
10/10 great plugin. Can you add lasers?
|
|
|
Post by george on Jan 27, 2014 4:05:13 GMT
10/10 great plugin. Can you add lasers? Maybe each eye/laser combo is its own entity like an individual party hat.
|
|
|
Post by mglvna on Feb 7, 2014 20:40:39 GMT
Isn't it embarrassing when you show up wearing the same thing as somebody else?
|
|
|
Post by spritznar on Feb 12, 2014 8:48:02 GMT
...
|
|