-
Notifications
You must be signed in to change notification settings - Fork 0
/
gmlify.js
54 lines (49 loc) · 1.89 KB
/
gmlify.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* jQuery Bookmarklet - version 1.0
* Originally written by: Brett Barros
* With modifications by: Paul Irish
*
* If you use this script, please link back to the source
*
* Copyright (c) 2010 Latent Motion (http://latentmotion.com/how-to-create-a-jquery-bookmarklet/)
* Released under the Creative Commons Attribution 3.0 Unported License,
* as defined here: http://creativecommons.org/licenses/by/3.0/
*
*/
//GMLify: this helper script loads jQuery, THREE.js and our main JS.
window.bookmarklet = function(opts){fullFunc(opts)};
window.bookmarklet({
css:[],
js:['https://raw.github.com/feesta/GMLify/master/gmlify_3drender.js','https://raw.github.com/mrdoob/three.js/master/build/Three.js'],
ready:function(){
$("<div id='gmlify_loader'>Downloading GML... please wait.</div>").css({
position:'fixed',
left:0,
top:0,
'font-size':18,
padding:10,
'font-family':'Helvetica',
'font-weight':'bold',
color:'black',
'background-color':'white',
'z-index':999999999999
}).appendTo("body");
$('a').click(function(){
var href = $(this).attr('href');
console.info('a click: ' + href);
var callback = function(){
location.href = href;
};
renderGML(callback);
return false;
});
getGMLJSON(function(){
console.info("GML downloaded");
$("#gmlify_loader").html('Click a link.');
});
}
})
function fullFunc(a){function d(b){if(b.length===0){a.ready();return false}$.getScript(b[0],function(){d(b.slice(1))})}function e(b){$.each(b,function(c,f){$("<link>").attr({href:f,rel:"stylesheet"}).appendTo("head")})}a.jqpath="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js";(function(b){var c=document.createElement("script");c.type="text/javascript";c.src=b;c.onload=function(){d(a.js)};document.body.appendChild(c)})(a.jqpath)};