-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrepropedia-wp.js
57 lines (53 loc) · 1.48 KB
/
repropedia-wp.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
55
56
57
/*
* Wordpress Repropedia Tooltip Loader
*
* Written for Northwestern University by gmazin (github.com/gmazin)
*
*/
(function($){
$(document).ready(function(){
var $ = document;
var cssId = 'repropediaCss';
if (!$.getElementById(cssId))
{
var head = $.getElementsByTagName('head')[0];
var link = $.createElement('link');
link.id = cssId;
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'https://raw.github.com/nuamps/RepropediaJS/master/css/repropedia.css';
link.media = 'all';
head.appendChild(link);
}
var jsId = 'repropediaJsf';
if (!$.getElementById(jsId))
{
var head = $.getElementsByTagName('head')[0];
var link = $.createElement('script');
link.id = jsId;
link.type = 'text/javascript';
link.src = 'https://raw.github.com/nuamps/RepropediaJS/master/js/repropedia.js';
head.appendChild(link);
}
});
})(jQuery);
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent( function() {
Repropedia.init({
'CONSUMER_KEY' : 'YOUR_OAUTH_KEY_HERE',
'field_css_class' : 'post-data',
'regions' : [':not(wp-admin) .post-data']
});
});