Initial commit.
This commit is contained in:
52
src/app/config.js
Normal file
52
src/app/config.js
Normal file
@@ -0,0 +1,52 @@
|
||||
var visjs_options = {
|
||||
nodes: {
|
||||
color: {
|
||||
border: '#bbb',
|
||||
background: '#fff',
|
||||
highlight: {
|
||||
border: '#fff',
|
||||
background: '#dd3'
|
||||
},
|
||||
hover: {
|
||||
border: '#2B7CE9',
|
||||
background: '#D2E5FF'
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
edges: {
|
||||
color: {
|
||||
color:'rgba(255, 255, 255, 0.15)',
|
||||
highlight:'#dd3',
|
||||
hover: '#0000FF'
|
||||
},
|
||||
style: "arrow",
|
||||
width: 1.5,
|
||||
arrowScaleFactor: 0.25
|
||||
},
|
||||
|
||||
tooltip: {
|
||||
delay: 300,
|
||||
fontColor: "#fff",
|
||||
fontSize: 14, // px
|
||||
fontFace: "verdana",
|
||||
color: {
|
||||
border: "#000",
|
||||
background: "rgba(0,0,0,0.5)"
|
||||
}
|
||||
},
|
||||
|
||||
physics: {
|
||||
barnesHut: {
|
||||
enabled: true,
|
||||
gravitationalConstant: -2000,
|
||||
centralGravity: 0.2,
|
||||
springLength: 95,
|
||||
springConstant: 0.04,
|
||||
damping: 0.15
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var seed_url = 'http://www.scopus.com/results/results.url?sort=plf-f&src=s&st1=urea+permeation+immobilized&sid=B0FE19FE3CFF4CCF86DD857756E90636.FZg2ODcJC9ArCe8WOZPvA%3a1400&sot=b&sdt=b&sl=34&s=TITLE%28urea+permeation+immobilized%29&origin=searchbasic&txGid=B0FE19FE3CFF4CCF86DD857756E90636.FZg2ODcJC9ArCe8WOZPvA%3a140';
|
||||
|
||||
80
src/app/crawler.js
Normal file
80
src/app/crawler.js
Normal file
@@ -0,0 +1,80 @@
|
||||
function ScholarCrawler(parser, node_ids, nodes, edges)
|
||||
{
|
||||
this.stack = [];
|
||||
|
||||
this.node_ids = node_ids;
|
||||
this.parser = parser;
|
||||
this.nodes = nodes;
|
||||
this.edges = edges;
|
||||
|
||||
this.delay = 1000;
|
||||
this.max_depth = 2;
|
||||
this.minimum_citations = 0;
|
||||
};
|
||||
|
||||
ScholarCrawler.prototype.formatArticle = function(node)
|
||||
{
|
||||
node.label = '';
|
||||
node.shape = "dot";
|
||||
node.original_title = node.title;
|
||||
node.title =
|
||||
"<span class='node_tooltip'>" + node.authors +
|
||||
"<emph> " + node.title + ".</emph> " +
|
||||
node.source + ", " + node.year + ".</span>";
|
||||
node.mass = node.n_citations/2 + 1;
|
||||
node.radius = 3*Math.pow(node.n_citations, 0.8) + 3;
|
||||
return node;
|
||||
};
|
||||
|
||||
ScholarCrawler.prototype.process = function(url, parent_node)
|
||||
{
|
||||
var crawler = this;
|
||||
|
||||
this.parser.parse(url, function(children)
|
||||
{
|
||||
for(i=0; i<children.length; i++)
|
||||
{
|
||||
var child = crawler.formatArticle(children[i]);
|
||||
|
||||
if(parent_node == null)
|
||||
{
|
||||
child['depth'] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
child['depth'] = parent_node['depth'] + 1;
|
||||
crawler.edges.add({"from": child['id'], "to": parent_node['id']});
|
||||
}
|
||||
|
||||
if(child['n_citations'] < crawler.minimum_citations)
|
||||
continue;
|
||||
|
||||
if(crawler.node_ids.indexOf(child['id']) == -1)
|
||||
{
|
||||
crawler.node_ids.push(child['id']);
|
||||
crawler.nodes.add(child);
|
||||
|
||||
if(child['depth'] < crawler.max_depth) {
|
||||
crawler.push(child['citations_url'], child);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ScholarCrawler.prototype.push = function(url, parent_node)
|
||||
{
|
||||
this.stack.push([url, parent_node]);
|
||||
};
|
||||
|
||||
ScholarCrawler.prototype.start = function()
|
||||
{
|
||||
if(this.stack.length > 0)
|
||||
{
|
||||
var args = this.stack.pop();
|
||||
this.process.apply(this, args);
|
||||
}
|
||||
|
||||
var crawler = this;
|
||||
setTimeout(function() { crawler.start() }, this.delay);
|
||||
};
|
||||
7
src/app/main.js
Normal file
7
src/app/main.js
Normal file
@@ -0,0 +1,7 @@
|
||||
var gui = require('nw.gui');
|
||||
var win = gui.Window.get();
|
||||
|
||||
win.maximize();
|
||||
|
||||
var view = new MainMenuView();
|
||||
view.render(document.getElementById("main"));
|
||||
58
src/app/scopus.js
Normal file
58
src/app/scopus.js
Normal file
@@ -0,0 +1,58 @@
|
||||
function ScopusParser() {};
|
||||
|
||||
ScopusParser.prototype.parse = function(url, callback)
|
||||
{
|
||||
var iframe = document.createElement("iframe");
|
||||
$(iframe).hide();
|
||||
document.body.appendChild(iframe);
|
||||
iframe.src = url;
|
||||
$(iframe).load(function()
|
||||
{
|
||||
var articles = [];
|
||||
var ibody = $(iframe).contents()[0];
|
||||
|
||||
var select_pages = $(ibody.getElementsByName("resultsPerPage").item(0));
|
||||
if(select_pages.val() != 200) {
|
||||
select_pages.val(200);
|
||||
select_pages.change();
|
||||
}
|
||||
|
||||
$(ibody).find(".resultItemLists li").each(function(index, li)
|
||||
{
|
||||
var article = {};
|
||||
|
||||
$(li).find(".docTitle a").each(function(index, tag) {
|
||||
article['url'] = tag.href;
|
||||
article['title'] = $(tag).text();
|
||||
});
|
||||
|
||||
$(li).find("a[href*='citedby']").each(function(index, tag) {
|
||||
article['citations_url'] = tag.href;
|
||||
article['n_citations'] = parseInt($(tag).text());
|
||||
});
|
||||
|
||||
$(li).find('.hidden-label').each(function(index, tag) {
|
||||
if($(tag).text().indexOf("Year") == 0)
|
||||
article['year'] = parseInt($.trim($(tag).next().text()));
|
||||
|
||||
if($(tag).text().indexOf("Authors") == 0)
|
||||
article['authors'] = $.trim($(tag).next().text());
|
||||
|
||||
if($(tag).text().indexOf("Source") == 0)
|
||||
article['source'] = $.trim($(tag).next().text());
|
||||
});
|
||||
|
||||
if(!('n_citations' in article)) {
|
||||
article['citations_url'] = undefined;
|
||||
article['n_citations'] = 0;
|
||||
}
|
||||
|
||||
article['id'] = $.md5(article['title'] + article['authors']);
|
||||
|
||||
articles.push(article);
|
||||
});
|
||||
|
||||
callback(articles);
|
||||
document.body.removeChild(iframe);
|
||||
});
|
||||
}
|
||||
6
src/app/templates/main_menu.html
Normal file
6
src/app/templates/main_menu.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<div class="frame">
|
||||
<h1>Scholarium</h1>
|
||||
<form action="">
|
||||
<input name="url" autocomplete="off"></input>
|
||||
</form>
|
||||
</div>
|
||||
20
src/app/views/main_menu.js
Normal file
20
src/app/views/main_menu.js
Normal file
@@ -0,0 +1,20 @@
|
||||
function MainMenuView() {};
|
||||
|
||||
MainMenuView.prototype.render = function(container)
|
||||
{
|
||||
var main_menu_div = document.createElement("div");
|
||||
$(main_menu_div).addClass("main_menu");
|
||||
|
||||
$(main_menu_div).load("app/templates/main_menu.html", function() {
|
||||
document.forms[0].onsubmit = function() {
|
||||
var seed_url = $("input[name=url]").val();
|
||||
var view = new ShowMapView(seed_url);
|
||||
view.render(container);
|
||||
return false;
|
||||
};
|
||||
});
|
||||
|
||||
$(container).empty();
|
||||
$(container).removeClass();
|
||||
container.appendChild(main_menu_div);
|
||||
}
|
||||
34
src/app/views/show_map.js
Normal file
34
src/app/views/show_map.js
Normal file
@@ -0,0 +1,34 @@
|
||||
function ShowMapView(seed_url) {
|
||||
this.seed_url = seed_url;
|
||||
};
|
||||
|
||||
ShowMapView.prototype.render = function(container)
|
||||
{
|
||||
var node_ids = [];
|
||||
var edges = new vis.DataSet();
|
||||
var nodes = new vis.DataSet();
|
||||
|
||||
var parser = new ScopusParser();
|
||||
var crawler = new ScholarCrawler(parser, node_ids, nodes, edges);
|
||||
crawler.push(this.seed_url, null);
|
||||
crawler.start();
|
||||
|
||||
var network_div = document.createElement('div');
|
||||
$(network_div).addClass("mynetwork");
|
||||
$(container).empty();
|
||||
container.appendChild(network_div)
|
||||
|
||||
var data = { nodes: nodes, edges: edges };
|
||||
var network = new vis.Network(network_div, data, visjs_options);
|
||||
|
||||
network.on('doubleClick', function(params) {
|
||||
gui.Shell.openExternal(nodes.get(params.nodes[0]).url)
|
||||
});
|
||||
|
||||
network.on("resize", function(params) {
|
||||
var height = $(window).height();
|
||||
var width = $(window).width();
|
||||
$(".mynetwork").css("width", width);
|
||||
$(".mynetwork").css("height", height);
|
||||
});
|
||||
};
|
||||
29
src/css/main.css
Normal file
29
src/css/main.css
Normal file
@@ -0,0 +1,29 @@
|
||||
@import url(http://fonts.googleapis.com/css?family=Dosis:400,700&subset=latin,latin-ext);
|
||||
|
||||
body {
|
||||
background-color: #066;
|
||||
}
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: 'Dosis';
|
||||
}
|
||||
|
||||
#scopus-iframe {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.node_tooltip {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.node_tooltip emph {
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
}
|
||||
36
src/css/main_menu.css
Normal file
36
src/css/main_menu.css
Normal file
@@ -0,0 +1,36 @@
|
||||
.main_menu {
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
font-family: sans;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.main_menu input {
|
||||
color: #000;
|
||||
background-color: #fff;
|
||||
border: 0;
|
||||
border: 2px solid #fff;
|
||||
|
||||
font-size: 20px;
|
||||
min-width: 600px;
|
||||
padding: 8px 12px;
|
||||
outline: 0;
|
||||
|
||||
}
|
||||
|
||||
.main_menu h1 {
|
||||
color: #fff;
|
||||
font-size: 60px;
|
||||
}
|
||||
|
||||
.main_menu .frame {
|
||||
margin: 0 auto;
|
||||
padding: 1px 1px 50px 1px;
|
||||
background-color: rgba(0,0,0,0);
|
||||
box-shadow: 2px 2px 100px #388;
|
||||
width: 800px;
|
||||
|
||||
top: 50%;
|
||||
position: relative;
|
||||
-webkit-transform: translateY(-50%);
|
||||
}
|
||||
25
src/index.html
Normal file
25
src/index.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Scholar Explorer</title>
|
||||
|
||||
<script type="text/javascript" src="lib/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="lib/vis.js"></script>
|
||||
<script type="text/javascript" src="lib/md5.js"></script>
|
||||
|
||||
<script type="text/javascript" src="app/scopus.js"></script>
|
||||
<script type="text/javascript" src="app/crawler.js"></script>
|
||||
<script type="text/javascript" src="app/config.js"></script>
|
||||
|
||||
<script type="text/javascript" src="app/views/show_map.js"></script>
|
||||
<script type="text/javascript" src="app/views/main_menu.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/main.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/main_menu.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="main"></div>
|
||||
<script type="text/javascript" src="app/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
4
src/lib/jquery.min.js
vendored
Normal file
4
src/lib/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
269
src/lib/md5.js
Normal file
269
src/lib/md5.js
Normal file
@@ -0,0 +1,269 @@
|
||||
/*
|
||||
* jQuery MD5 Plugin 1.2.1
|
||||
* https://github.com/blueimp/jQuery-MD5
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://creativecommons.org/licenses/MIT/
|
||||
*
|
||||
* Based on
|
||||
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
|
||||
* Digest Algorithm, as defined in RFC 1321.
|
||||
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
|
||||
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
||||
* Distributed under the BSD License
|
||||
* See http://pajhome.org.uk/crypt/md5 for more info.
|
||||
*/
|
||||
|
||||
/*jslint bitwise: true */
|
||||
/*global unescape, jQuery */
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
||||
* to work around bugs in some JS interpreters.
|
||||
*/
|
||||
function safe_add(x, y) {
|
||||
var lsw = (x & 0xFFFF) + (y & 0xFFFF),
|
||||
msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
||||
return (msw << 16) | (lsw & 0xFFFF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bitwise rotate a 32-bit number to the left.
|
||||
*/
|
||||
function bit_rol(num, cnt) {
|
||||
return (num << cnt) | (num >>> (32 - cnt));
|
||||
}
|
||||
|
||||
/*
|
||||
* These functions implement the four basic operations the algorithm uses.
|
||||
*/
|
||||
function md5_cmn(q, a, b, x, s, t) {
|
||||
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
|
||||
}
|
||||
function md5_ff(a, b, c, d, x, s, t) {
|
||||
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
|
||||
}
|
||||
function md5_gg(a, b, c, d, x, s, t) {
|
||||
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
|
||||
}
|
||||
function md5_hh(a, b, c, d, x, s, t) {
|
||||
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
|
||||
}
|
||||
function md5_ii(a, b, c, d, x, s, t) {
|
||||
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
||||
*/
|
||||
function binl_md5(x, len) {
|
||||
/* append padding */
|
||||
x[len >> 5] |= 0x80 << ((len) % 32);
|
||||
x[(((len + 64) >>> 9) << 4) + 14] = len;
|
||||
|
||||
var i, olda, oldb, oldc, oldd,
|
||||
a = 1732584193,
|
||||
b = -271733879,
|
||||
c = -1732584194,
|
||||
d = 271733878;
|
||||
|
||||
for (i = 0; i < x.length; i += 16) {
|
||||
olda = a;
|
||||
oldb = b;
|
||||
oldc = c;
|
||||
oldd = d;
|
||||
|
||||
a = md5_ff(a, b, c, d, x[i], 7, -680876936);
|
||||
d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
|
||||
c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
|
||||
b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
||||
a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
|
||||
d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
||||
c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
||||
b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
|
||||
a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
||||
d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
||||
c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
|
||||
b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
||||
a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
||||
d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
|
||||
c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
||||
b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
||||
|
||||
a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
|
||||
d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
||||
c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
|
||||
b = md5_gg(b, c, d, a, x[i], 20, -373897302);
|
||||
a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
|
||||
d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
|
||||
c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
|
||||
b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
|
||||
a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
|
||||
d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
||||
c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
|
||||
b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
||||
a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
||||
d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
|
||||
c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
||||
b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
||||
|
||||
a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
|
||||
d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
||||
c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
||||
b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
|
||||
a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
||||
d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
||||
c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
|
||||
b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
||||
a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
|
||||
d = md5_hh(d, a, b, c, x[i], 11, -358537222);
|
||||
c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
|
||||
b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
|
||||
a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
|
||||
d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
|
||||
c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
|
||||
b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
|
||||
|
||||
a = md5_ii(a, b, c, d, x[i], 6, -198630844);
|
||||
d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
||||
c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
||||
b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
|
||||
a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
||||
d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
||||
c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
|
||||
b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
||||
a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
||||
d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
|
||||
c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
||||
b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
||||
a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
|
||||
d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
||||
c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
|
||||
b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
|
||||
|
||||
a = safe_add(a, olda);
|
||||
b = safe_add(b, oldb);
|
||||
c = safe_add(c, oldc);
|
||||
d = safe_add(d, oldd);
|
||||
}
|
||||
return [a, b, c, d];
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert an array of little-endian words to a string
|
||||
*/
|
||||
function binl2rstr(input) {
|
||||
var i,
|
||||
output = '';
|
||||
for (i = 0; i < input.length * 32; i += 8) {
|
||||
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a raw string to an array of little-endian words
|
||||
* Characters >255 have their high-byte silently ignored.
|
||||
*/
|
||||
function rstr2binl(input) {
|
||||
var i,
|
||||
output = [];
|
||||
output[(input.length >> 2) - 1] = undefined;
|
||||
for (i = 0; i < output.length; i += 1) {
|
||||
output[i] = 0;
|
||||
}
|
||||
for (i = 0; i < input.length * 8; i += 8) {
|
||||
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the MD5 of a raw string
|
||||
*/
|
||||
function rstr_md5(s) {
|
||||
return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the HMAC-MD5, of a key and some data (raw strings)
|
||||
*/
|
||||
function rstr_hmac_md5(key, data) {
|
||||
var i,
|
||||
bkey = rstr2binl(key),
|
||||
ipad = [],
|
||||
opad = [],
|
||||
hash;
|
||||
ipad[15] = opad[15] = undefined;
|
||||
if (bkey.length > 16) {
|
||||
bkey = binl_md5(bkey, key.length * 8);
|
||||
}
|
||||
for (i = 0; i < 16; i += 1) {
|
||||
ipad[i] = bkey[i] ^ 0x36363636;
|
||||
opad[i] = bkey[i] ^ 0x5C5C5C5C;
|
||||
}
|
||||
hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
|
||||
return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a raw string to a hex string
|
||||
*/
|
||||
function rstr2hex(input) {
|
||||
var hex_tab = '0123456789abcdef',
|
||||
output = '',
|
||||
x,
|
||||
i;
|
||||
for (i = 0; i < input.length; i += 1) {
|
||||
x = input.charCodeAt(i);
|
||||
output += hex_tab.charAt((x >>> 4) & 0x0F) +
|
||||
hex_tab.charAt(x & 0x0F);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode a string as utf-8
|
||||
*/
|
||||
function str2rstr_utf8(input) {
|
||||
return unescape(encodeURIComponent(input));
|
||||
}
|
||||
|
||||
/*
|
||||
* Take string arguments and return either raw or hex encoded strings
|
||||
*/
|
||||
function raw_md5(s) {
|
||||
return rstr_md5(str2rstr_utf8(s));
|
||||
}
|
||||
function hex_md5(s) {
|
||||
return rstr2hex(raw_md5(s));
|
||||
}
|
||||
function raw_hmac_md5(k, d) {
|
||||
return rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d));
|
||||
}
|
||||
function hex_hmac_md5(k, d) {
|
||||
return rstr2hex(raw_hmac_md5(k, d));
|
||||
}
|
||||
|
||||
$.md5 = function (string, key, raw) {
|
||||
if (!key) {
|
||||
if (!raw) {
|
||||
return hex_md5(string);
|
||||
} else {
|
||||
return raw_md5(string);
|
||||
}
|
||||
}
|
||||
if (!raw) {
|
||||
return hex_hmac_md5(key, string);
|
||||
} else {
|
||||
return raw_hmac_md5(key, string);
|
||||
}
|
||||
};
|
||||
|
||||
}(typeof jQuery === 'function' ? jQuery : this));
|
||||
32484
src/lib/vis.js
Normal file
32484
src/lib/vis.js
Normal file
File diff suppressed because it is too large
Load Diff
12
src/package.json
Normal file
12
src/package.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "Scholarium",
|
||||
"version": "0.1-pre",
|
||||
"main": "index.html",
|
||||
"window": {
|
||||
"toolbar": false,
|
||||
"min_width": 400,
|
||||
"min_height": 400,
|
||||
"width": 900,
|
||||
"height": 600
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user