Skip to content
This repository has been archived by the owner on May 30, 2021. It is now read-only.

Commit

Permalink
Copy post link Userscript
Browse files Browse the repository at this point in the history
  • Loading branch information
Felizolinha committed Feb 6, 2015
1 parent e82cf8d commit 5326775
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions originals/TheGameBuilder/postLink.user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// ==UserScript==
// @name Copy post link
// @namespace https://felizolinha.github.io
// @version 1.0
// @description Copies post links to your clipboard when you click the post's number
// @author TheGameBuilder
// @match *://scratch.mit.edu/discuss/*
// @run-at document-end
// https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @grant GM_setClipboard
// ==/UserScript==
$(document).ready(function() {
for (var i = 0; i < 20; i++) {
var n = $(".conr:gt(0):lt(20)" + ":eq(" + i + ")"),
nID = n.parent().parent().parent().attr('id');

n.wrap('<a data-post-ID="#' + nID + '"></a>');
n.parent().click(function() {
location.hash = $(this).attr('data-post-ID');
if(confirm("Do you really want to copy the link to this post?"))
GM_setClipboard(location.href);
});
}
});

0 comments on commit 5326775

Please sign in to comment.