Skip to content

Commit

Permalink
v1.0.4
Browse files Browse the repository at this point in the history
Fix eruda script not opening
  • Loading branch information
d3ward committed Apr 12, 2021
1 parent 44fea4f commit 6654ac1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
3 changes: 2 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Floatly",
"version": "1.0.3",
"version": "1.0.4",
"description": "Floatly is an awesome floating button that brings quick actions to any website.",
"permissions": ["tabs", "clipboardWrite","storage","activeTab","http://*/","https://*/","bookmarks"],
"background": {
Expand All @@ -20,6 +20,7 @@
"default_icon": "src/png/icon256.png"
},
"web_accessible_resources": [
"src/js/eruda_init.js",
"src/js/eruda.min.js",
"src/js/eruda_toggle.js"
],
Expand Down
2 changes: 1 addition & 1 deletion src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
if (!response || !response.success) {
chrome.runtime.lastError.message;
chrome.tabs.executeScript(sender.tab.id, {
file: 'eruda_init.js'
file: './src/js/eruda_init.js'
});
}
});
Expand Down
18 changes: 11 additions & 7 deletions src/js/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,7 @@ var acDivs = [
ac17: function() {chrome.runtime.sendMessage({book:true,url:window.location.href ,title:document.title});},
ac18: function() {try {navigator.share({url:window.location.href})} catch(err) {console.log(err)}}
};
chrome.runtime.onMessage.addListener(
function(request, sender) {
if(request.bookmarked!=undefined){
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>';
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>';
}
});

var splist,posf;
// Get use options and inject
chrome.storage.local.get({
Expand Down Expand Up @@ -154,6 +148,16 @@ chrome.storage.local.get({
}
}
});
chrome.runtime.onMessage.addListener(
function(request, sender) {
if(request.bookmarked!=undefined){
const v=document.getElementById("ac17");
if(v){
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>';
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>';
}
}
});
// Swipe Up / Down / Left / Right
var initialX = null;
var initialY = null;
Expand Down
10 changes: 5 additions & 5 deletions src/js/eruda_init.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.action === "eruda_toggle") {
sendResponse({ success: true });
if (document.getElementById('eruda_toggle.js'))
document.getElementById('eruda_toggle.js').remove();
addScriptToHead('eruda_toggle.js');
if (document.getElementById('./src/js/eruda_toggle.js'))
document.getElementById('./src/js/eruda_toggle.js').remove();
addScriptToHead('./src/js/eruda_toggle.js');
}
});
addScriptToHead('eruda.min.js');
addScriptToHead('eruda_toggle.js');
addScriptToHead('./src/js/eruda.min.js');
addScriptToHead('./src/js/eruda_toggle.js');
function addScriptToHead(url) {
const script = document.createElement('script');
script.id = url;
Expand Down
2 changes: 1 addition & 1 deletion src/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ <h4>You can use keywords or hosts . For example "github" will block all website
</main>
<footer>
<div class="grid">
<div>Floatly v1.0.3 </div>
<div>Floatly v1.0.4 </div>
<div>Licensed under <b><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">(CC BY-NC-SA
4.0)</a></b></div>
<div><a href="https://heroicons.dev/">Heroicons</a> licensed under <b><a
Expand Down

0 comments on commit 6654ac1

Please sign in to comment.