日期:2014-05-16  浏览次数:20457 次

纪念Aaron Swartz JSTOR公有论文解放器发布 &&&一段JS求解????

为了纪念自杀身亡的Aaron Swartz,ArchiveTeam发布了Aaron Swartz Memorial JSTOR Liberator

这是一个基于JavaScript的书签工具,目的是让互联网用户“解救”已属于公有领域的JSTOR论文。

用户在浏览器上运行工具访问JSTOR它就会在上面下载一篇公有领域论文然后上传到ArchiveTeam,以此抗议JSTOR的限制政策。

/img/2013/01/23/104445232.jpg

STOR的服务条款禁止使用聚合软件下载和传播论文,ArchiveTeam的开发者认为,JSTOR没有权力对公有论文施加额外的限制。在Swartz去世之后,美国司法部宣布放弃针对他的指控,电子前哨基金会则呼吁修改过于严厉的计算机犯罪法律。

http://aaronsw.archiveteam.org/

 

 

<a href="javascript:(function(){var s=document.createElement('script');s.type='text/javascript';s.src='http://aaronsw.archiveteam.org/js';document.getElementsByTagName('head')[0].appendChild(s);})();" title="JSTOR liberator" id="bookmarklet">JSTOR liberator</a>

 

s.src='http://aaronsw.archiveteam.org/js'如下:

/**
*
*  Base64 encode / decode
*  http://www.webtoolkit.info/
*
**/

var Base64 = {

	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

	// public method for encoding
	encode : function (byteArray) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;

		// input = Base64._utf8_encode(input);
    // var byteArray = new Uint8Array(input);

		while (i < byteArray.byteLength) {

			chr1 = byteArray[i++];
			chr2 = byteArray[i++];
			chr3 = byteArray[i++];

			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;

			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}

			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

		}

		return output;
	},

	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;

		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		while (i < input.length) {

			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;

			output = output + String.fromCharCode(chr1);

			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}

		}

		output = Base64._utf8_decode(output);

		return output;

	},

	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode(