Created
April 24, 2014 02:05
-
-
Save RadicalZephyr/11239051 to your computer and use it in GitHub Desktop.
Extract the checkin links from a Fossil timeline page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Fossil Time Log | |
// @namespace http://www.zephyrizing.net/gmscripts | |
// @description Generate some time-logs from the fossil timeline page | |
// @include http://scm.ldc.cs.wwu.edu:8888/classfinder/timeline?n=20&y=ci | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js | |
// @require http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
var getLinks = function (limit=100) { | |
var rows = $(".timelineTableCell"); | |
var html = ""; | |
angular.forEach(rows, function (entry, index) { | |
if (index < limit) { | |
html = html + entry.children[0].outerHTML.replace("class=\"timelineHistLink\"", ""); | |
} | |
}); | |
return html; | |
} | |
var container = $("#container").append('<div id="myForm"></div>').append('<div id="myResults" style=\"border: 4px solid green;padding: 10px;\"></div>'); | |
var myForm = $("#myForm") | |
.append('<input type="number" name="numlinks" id="numLinks" value="">') | |
.append('<input type="submit" name="btnSearch" id="btnLinks" value="Get Checkin Links">'); | |
$("#btnLinks").click(function () { | |
var numLinks = $("#numLinks").val(); | |
$("#myResults").append($('<div/>').text(getLinks(parseInt(numLinks))).html()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment