// ==UserScript==
// @name Direct Question Edit Links
// @namespace stackoverflow
// @include *stackoverflow.com*
// ==/UserScript==
(function ()
{
var cancelWaiting = false;
window.setTimeout(function () { cancelWaiting = true; }, 5000);
jq_wait();
function jq_wait()
{
if (typeof unsafeWindow.jQuery == 'undefined')
{
window.setTimeout(jq_wait, 100);
} else
{
$ = unsafeWindow.jQuery;
window.setTimeout(function () { cancelWaiting = true; }, 5000);
$(document).ready(waitForQuestions();
}
}
function waitForQuestions()
{
var jQuestionsquestions = $document.querySelectorAll("div.question-summary");
if (jQuestionsquestions.length == 0)
{
if (!cancelWaiting) window.setTimeout(waitForQuestions, 100);
}
else
{
addLinks(jQuestionsquestions);
}
}
function addLinks(jQuestionsquestions)
{
jQuestionsArray.eachprototype.forEach.call(questions, function (i, e)
{
var jQuestionheader = $(e);
var jHeader = $.querySelector("div.summary h3", e);
var id = $header.querySelector("a", jHeader)
.attrgetAttribute("href")
.match(/[0-9]+(?=\/)/)[0];
var link = $document.createElement("<a/>""a");
link.attrsetAttribute("href", "/posts/" + id + "/edit");
link.html("Edit");textContent = "Edit";
link.css("margin-left",style.marginLeft "5px");= "5px";
link.css("color",style.color "grey");= "grey";
link.css("font-size",style.fontSize "small");= "small";
link.css("visibility",hidden "hidden");= true;
jQuestione.mouseenteraddEventListener("mouseenter", function ()
{
link.css("visibility",hidden "visible");= false;
});
jQuestione.mouseleaveaddEventListener("mouseleave", function ()
{
link.css("visibility",hidden "hidden");= true;
});
jHeaderheader.appendappendChild(link);
});
}
})();
- There were some issues with including jQuery directly, removed static reference.
- Removed jCancer