Skip to content

Commit 6654ac1

Browse files
committed
v1.0.4
Fix eruda script not opening
1 parent 44fea4f commit 6654ac1

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "Floatly",
4-
"version": "1.0.3",
4+
"version": "1.0.4",
55
"description": "Floatly is an awesome floating button that brings quick actions to any website.",
66
"permissions": ["tabs", "clipboardWrite","storage","activeTab","http://*/","https://*/","bookmarks"],
77
"background": {
@@ -20,6 +20,7 @@
2020
"default_icon": "src/png/icon256.png"
2121
},
2222
"web_accessible_resources": [
23+
"src/js/eruda_init.js",
2324
"src/js/eruda.min.js",
2425
"src/js/eruda_toggle.js"
2526
],

src/js/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
3232
if (!response || !response.success) {
3333
chrome.runtime.lastError.message;
3434
chrome.tabs.executeScript(sender.tab.id, {
35-
file: 'eruda_init.js'
35+
file: './src/js/eruda_init.js'
3636
});
3737
}
3838
});

src/js/content.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,7 @@ var acDivs = [
105105
ac17: function() {chrome.runtime.sendMessage({book:true,url:window.location.href ,title:document.title});},
106106
ac18: function() {try {navigator.share({url:window.location.href})} catch(err) {console.log(err)}}
107107
};
108-
chrome.runtime.onMessage.addListener(
109-
function(request, sender) {
110-
if(request.bookmarked!=undefined){
111-
if(request.bookmarked)document.getElementById("ac17").innerHTML='<svg fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path></svg>';
112-
else document.getElementById("ac17").innerHTML='<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"></path></svg>';
113-
}
114-
});
108+
115109
var splist,posf;
116110
// Get use options and inject
117111
chrome.storage.local.get({
@@ -154,6 +148,16 @@ chrome.storage.local.get({
154148
}
155149
}
156150
});
151+
chrome.runtime.onMessage.addListener(
152+
function(request, sender) {
153+
if(request.bookmarked!=undefined){
154+
const v=document.getElementById("ac17");
155+
if(v){
156+
if(request.bookmarked)v.innerHTML='<svg fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"></path></svg>';
157+
else v.innerHTML='<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"></path></svg>';
158+
}
159+
}
160+
});
157161
// Swipe Up / Down / Left / Right
158162
var initialX = null;
159163
var initialY = null;

src/js/eruda_init.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
22
if (request.action === "eruda_toggle") {
33
sendResponse({ success: true });
4-
if (document.getElementById('eruda_toggle.js'))
5-
document.getElementById('eruda_toggle.js').remove();
6-
addScriptToHead('eruda_toggle.js');
4+
if (document.getElementById('./src/js/eruda_toggle.js'))
5+
document.getElementById('./src/js/eruda_toggle.js').remove();
6+
addScriptToHead('./src/js/eruda_toggle.js');
77
}
88
});
9-
addScriptToHead('eruda.min.js');
10-
addScriptToHead('eruda_toggle.js');
9+
addScriptToHead('./src/js/eruda.min.js');
10+
addScriptToHead('./src/js/eruda_toggle.js');
1111
function addScriptToHead(url) {
1212
const script = document.createElement('script');
1313
script.id = url;

src/options/options.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ <h4>You can use keywords or hosts . For example "github" will block all website
161161
</main>
162162
<footer>
163163
<div class="grid">
164-
<div>Floatly v1.0.3 </div>
164+
<div>Floatly v1.0.4 </div>
165165
<div>Licensed under <b><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">(CC BY-NC-SA
166166
4.0)</a></b></div>
167167
<div><a href="https://heroicons.dev/">Heroicons</a> licensed under <b><a

0 commit comments

Comments
 (0)