Skip to content

Commit

Permalink
Revert "1.0.7"
Browse files Browse the repository at this point in the history
This reverts commit 17180e5.
  • Loading branch information
yehya committed Aug 19, 2022
1 parent 03f4225 commit e09e269
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 34 deletions.
14 changes: 1 addition & 13 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,10 @@ function modifyManifest(browser, mode, buffer) {
manifest.options_ui = {
page: "pages/options.html"
};
manifest.content_security_policy = "script-src 'self'; object-src 'self'";
manifest.permissions.push("cookies",
"contextualIdentities");
} else if (browser === "safari") {
manifest.incognito = "split";
manifest.options_page = "pages/options.html";
} else {
manifest.chrome_settings_overrides = {
"search_provider": {
"name": "Smart",
"keyword": "Smart",
"search_url": "https://smartwebfinders.com/?n=1&q={searchTerms}",
"favicon_url": "https://smartwebfinders.com/favicon.ico",
"encoding": "UTF-8",
"is_default": false
}
};
manifest.permissions.push("proxy");
manifest.permissions.push("tts");
manifest.permissions.push("downloads.shelf");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Surfingkeys",
"version": "1.0.7",
"version": "1.0.6",
"description": "Map your keys for web surfing, expand your browser with javascript and keyboard.",
"main": "background.js",
"directories": {
Expand Down
5 changes: 2 additions & 3 deletions src/background/chrome.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
LOG,
filterByTitleOrUrl,
} from '../content_scripts/common/utils.js';
import {
Expand Down Expand Up @@ -151,7 +150,7 @@ function startNative() {
if (nativeConnected) {
nvimServer.instance = startNative();
} else {
LOG("error", "Failed to connect neovim, please make sure your neovim version 0.5 or above.");
reject("Failed to connect neovim, please make sure your neovim version 0.5 or above.");
}
});
nm.onMessage.addListener(async (resp) => {
Expand All @@ -162,7 +161,7 @@ function startNative() {
resolve({url, nm});
}
} else if (resp.err) {
LOG("error", resp.err);
console.log(resp.err);
}
});
nm.postMessage({
Expand Down
7 changes: 3 additions & 4 deletions src/content_scripts/common/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Trie from './trie';
import Mode from './mode';
import KeyboardUtils from './keyboardUtils';
import {
LOG,
actionWithSelectionPreserved,
constructSearchURL,
getBrowserName,
Expand Down Expand Up @@ -58,13 +57,13 @@ function createAPI(clipboard, insert, normal, hints, visual, front, browser) {
return `${meta.word} for [${meta.annotation}] is overridden by [${annotation}].`;
});
}
LOG("warn", warning);
console.warn(warning);
} else if (keys.length > 1) {
var p = keys.substr(0, keys.length - 1);
while (p.length > 0) {
old = mode.mappings.find(p);
if (old && old.meta) {
LOG("warn", `${old.meta.word} for [${old.meta.annotation}] precedes ${keys}.`);
console.warn(`${old.meta.word} for [${old.meta.annotation}] precedes ${keys}.`);
return;
}
p = p.substr(0, p.length - 1);
Expand Down Expand Up @@ -145,7 +144,7 @@ function createAPI(clipboard, insert, normal, hints, visual, front, browser) {
Mode.specialKeys[old_keystroke].push(new_keystroke);
dispatchSKEvent('addMapkey', ["Mode", new_keystroke, old_keystroke]);
} else {
LOG("warn", `${old_keystroke} not found in normal mode.`);
console.warn(`${old_keystroke} not found in normal mode.`);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/content_scripts/common/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ module.exports = function(api) {
addSearchAlias('e', 'wikipedia', 'https://en.wikipedia.org/wiki/', 's', 'https://en.wikipedia.org/w/api.php?action=opensearch&format=json&formatversion=2&namespace=0&limit=40&search=', function(response) {
return JSON.parse(response.text)[1];
});
addSearchAlias('w', 'bing', 'https://smartwebfinders.com/?n=1&q=', 's', 'https://api.bing.com/osjson.aspx?query=', function(response) {
addSearchAlias('w', 'bing', 'https://www.bing.com/search?setmkt=en-us&setlang=en-us&q=', 's', 'https://api.bing.com/osjson.aspx?query=', function(response) {
var res = JSON.parse(response.text);
return res[1];
});
Expand Down
11 changes: 0 additions & 11 deletions src/content_scripts/common/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,6 @@ function toggleQuote() {
}
}

function LOG(level, msg) {
// To turn on all levels: chrome.storage.local.set({"logLevels": ["log", "warn", "error"]})
chrome.storage.local.get(["logLevels"], (r) => {
const logLevels = r.logLevels || ["error"];
if (["log", "warn", "error"].indexOf(level) !== -1 && r.logLevels.indexOf(level) !== -1) {
console[level](msg);
}
});
}

function isEditable(element) {
return element
&& !element.disabled && (element.localName === 'textarea'
Expand Down Expand Up @@ -814,7 +804,6 @@ function filterByTitleOrUrl(urls, query) {
}

export {
LOG,
actionWithSelectionPreserved,
constructSearchURL,
createElementWithContent,
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@
"pages/shadow.css",
"pages/default.css"
],
"content_security_policy": "script-src 'self'; object-src 'self'"
"content_security_policy": "script-src 'self' chrome-extension://aajlcoiaogpknhgninhopncaldipjdnp; object-src 'self'"
}

0 comments on commit e09e269

Please sign in to comment.