forked from armandocat/steemit-more-info
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chrome.ext.js
executable file
·129 lines (104 loc) · 3.12 KB
/
chrome.ext.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
document.body.dataset.SteemitMoreInfoExtensionId = chrome.runtime.id;
/*
Listen for messages from the page. For Firefox!
*/
window.addEventListener("message", function(event) {
if (event.source == window &&
event.data &&
event.data.direction == "from-page-script") {
var index = event.data.index;
if(!index){
return;
}
var message = event.data.message;
chrome.runtime.sendMessage(chrome.runtime.id, message, function(response) {
window.postMessage({
direction: "from-content-script",
index: index,
message: response
}, '*');
});
}
});
var s = document.createElement('script');
s.src = chrome.extension.getURL('src/utils/chrome_addons.js');
document.body.appendChild(s);
/* FILES TO LOAD - START */
var cssToLoad = [
'vendor/datatables.min.css',
'vendor/toastr.min.css',
'vendor/justifiedGallery.min.css',
'vendor/jquery.fancybox.min.css',
'src/main.css'
];
var jsToLoad = [
'vendor/steem.min.js',
'vendor/jquery-3.2.1.min.js',
'vendor/jquery.livequery.min.js',
'vendor/lodash.min.js',
'vendor/moment.min.js',
'vendor/history-events.js',
'vendor/compare-versions.js',
'vendor/toastr.min.js',
'vendor/Chart.min.js',
'vendor/remarkable.min.js',
'vendor/sanitize-html.min.js',
'vendor/datatables.min.js',
'vendor/attrchange.js',
'vendor/HtmlReady.js',
'vendor/jquery.justifiedGallery.min.js',
'vendor/linkify.min.js',
'vendor/linkify-string.min.js',
'vendor/linkify-plugin-mention.min.js',
'vendor/jquery.fancybox.min.js',
'vendor/jquery.scrollparent.js',
'src/utils/steem-config.js',
'src/utils/sanitize.js',
'src/utils/notification_popup.js',
'src/utils/utils.js',
'src/utils/events.js',
'src/utils/upvote_me_banner.js'
];
jsToLoad.push('src/profile_banner.js');
jsToLoad.push('src/votes_tab.js');
jsToLoad.push('src/vote_weight_slider.js');
jsToLoad.push('src/post_votes_list.js');
// jsToLoad.push('src/favorite_tags.js');
jsToLoad.push('src/blog_histogram.js');
jsToLoad.push('src/followers_table.js');
jsToLoad.push('src/show_posts_as_grid.js');
jsToLoad.push('src/post_floating_bottom_bar.js');
jsToLoad.push('src/external_links_menu.js');
jsToLoad.push('src/markdown_editor_beautifier.js');
jsToLoad.push('src/userpic_zoom.js');
jsToLoad.push('src/gif_picker.js');
jsToLoad.push('src/post_boost_button.js');
jsToLoad.push('src/wallet_transfer_filter.js');
jsToLoad.push('src/image-gallery.js');
// SETTINGS - LAST ONE
jsToLoad.push('src/settings.js');
/* FILES TO LOAD - END */
function checkUpdate(){
var s = document.createElement('script');
s.src = chrome.extension.getURL('src/utils/check_update.js');
document.body.appendChild(s);
};
cssToLoad.reverse().reduce(function(next, href){
return function(){
var s = document.createElement('link');
s.href = chrome.extension.getURL(href);
s.rel = 'stylesheet';
document.body.appendChild(s);
next && next();
};
}, null)();
jsToLoad.reverse().reduce(function(next, script){
return function(){
var s = document.createElement('script');
s.src = chrome.extension.getURL(script);
s.onload = function() {
next && next();
};
document.body.appendChild(s);
};
}, checkUpdate)();