Skip to main content
replaced http://meta.stackoverflow.com/ with https://meta.stackoverflow.com/
Source Link
edited tags
Link
Tim Stone
  • 4.7k
  • 3
  • 22
  • 32
added 628 characters in body
Source Link
pascalhein
  • 211
  • 1
  • 3
// ==UserScript==
// @name        Add Timeline Button
// @namespace   none
// @description Adds a "View Timeline" Button to StackOverflow
// @include    @match http://*stackoverflow.com/questions*
// @include     http://*serverfault*.askubuntu.com/questions*questions/*
// @include@match       http://*superuser*.onstartups.com/questions*questions/*
// @include@match       http://*stackexchange*.serverfault.com/questions*questions/*
// @include@match       http://*askubuntu*.stackapps.com/questions*questions/*
// @include@match       http://*answers*.onstartupsstackexchange.com/questions*questions/*
// @include    @match http://*mathoverflow.net/questions*
// @include     http://discuss.area51*.stackexchangestackoverflow.com/questions/*
// @include@match       http://stackapps*.superuser.com/questions*questions/*
// @author      csharpler
// @version     0.12
// ==/UserScript==

/*
 * Version History
 *      * 0.1 (2013-06-11): First release
 *      * 0.2 (2013-06-12): * changed includes
 *                          * improved regex
 *                          - removed unsafeWindow, replaced with function wrapper
 */

withPages_jQuery(run);

function withPages_jQuery (NAMED_FunctionToRun) {
    //--- Use named functions for clarity and debugging...
if    var funcText        = NAMED_FunctionToRun.toString (typeof);
 unsafeWindow !  var funcName        = 'undefined'funcText.replace (/^function\s+(\w+){\s*\((.|\n|\r)+$/, "$1");
    $var script          = unsafeWindowdocument.$;createElement ("script");
}    script.textContent  = funcText + "\n\n";
    script.textContent += 'jQuery(document).ready( function () {' + funcName + '(jQuery);} );';
run    document.body.appendChild (script);
};

function run(){
    var uri = unsafeWindow.location.href;
    var matchpost = urilocation.pathname.match(/(https?:\/\/[^\/]*\questions\/)questions(\/\d+\/\d+)[a-zA-Z\-]+$\D/i);
    var newuri = match[1]"";
    if(post && post.length > 1){
        newuri = location.protocol + "posts""//" + match[2]location.host + "timeline";"/posts/" + post[1] + "/timeline";
    }
    $(".favoritecount").after("<a href='" + newuri + "'>View Timeline</a>");
}
    
// ==UserScript==
// @name        Add Timeline Button
// @namespace   none
// @description Adds a "View Timeline" Button to StackOverflow
// @include     http://*stackoverflow.com/questions*
// @include     http://*serverfault.com/questions*
// @include     http://*superuser.com/questions*
// @include     http://*stackexchange.com/questions*
// @include     http://*askubuntu.com/questions*
// @include     http://*answers.onstartups.com/questions*
// @include     http://*mathoverflow.net/questions*
// @include     http://discuss.area51.stackexchange.com/questions/*
// @include     http://stackapps.com/questions*
// @author      csharpler
// @version     0.1
// ==/UserScript==

/*
 * Version History
 *      * 0.1 (2013-06-11): First release
 */
 
if(typeof unsafeWindow != 'undefined'){
    $ = unsafeWindow.$;
}

run();

function run(){
    var uri = unsafeWindow.location.href;
    var match = uri.match(/(https?:\/\/[^\/]*\/)questions(\/\d+\/)[a-zA-Z\-]+$/);
    var newuri = match[1] + "posts" + match[2] + "timeline";
    $(".favoritecount").after("<a href='" + newuri + "'>View Timeline</a>");
}
// ==UserScript==
// @name        Add Timeline Button
// @namespace   none
// @description Adds a "View Timeline" Button to StackOverflow
// @match       http://*.askubuntu.com/questions/*
// @match       http://*.onstartups.com/questions/*
// @match       http://*.serverfault.com/questions/*
// @match       http://*.stackapps.com/questions/*
// @match       http://*.stackexchange.com/questions/*
// @match       http://*.stackoverflow.com/questions/*
// @match       http://*.superuser.com/questions/*
// @author      csharpler
// @version     0.2
// ==/UserScript==

/*
 * Version History
 *      * 0.1 (2013-06-11): First release
 *      * 0.2 (2013-06-12): * changed includes
 *                          * improved regex
 *                          - removed unsafeWindow, replaced with function wrapper
 */

withPages_jQuery(run);

function withPages_jQuery (NAMED_FunctionToRun) {
    //--- Use named functions for clarity and debugging...
    var funcText        = NAMED_FunctionToRun.toString ();
    var funcName        = funcText.replace (/^function\s+(\w+)\s*\((.|\n|\r)+$/, "$1");
    var script          = document.createElement ("script");
    script.textContent  = funcText + "\n\n";
    script.textContent += 'jQuery(document).ready( function () {' + funcName + '(jQuery);} );';
    document.body.appendChild (script);
};

function run(){
    var uri = location.href;
    var post = location.pathname.match(/questions\/(\d+)\D/i);
    var newuri = "";
    if(post && post.length > 1){
        newuri = location.protocol + "//" + location.host + "/posts/" + post[1] + "/timeline";
    }
    $(".favoritecount").after("<a href='" + newuri + "'>View Timeline</a>");
}
    
Source Link
pascalhein
  • 211
  • 1
  • 3
Loading