I'm trying to code my first chrome extension, it's supossed to simple autosort for tabs by url name but I'm getting "Unexpected End of Input" at the end of this block of code. It only showed up after I added the listener of onClicked.
chrome.browserAction.onClicked.addListener(function apllyOrder(tabs) {
// gets reference array of sorted tabs
reference = sortTabsUrl(tabs);
console.log("Reference array loaded");
// gets amount of pinned tabs to skip them
pinned = tabsPinned(tabs);
console.log("Pinned tabs identified");
//iterates through reference array
for(var i = 0, len = reference.length; i < len; i++){
//iterates through tabs starting from first unpinned tabs
for(var x = pinned, leng = tabs.length; x < leng; x++){
//If the id matches AND reference index is different than current index than it moves the tab
if(tabs[x].id == reference[i].id && x != (i +pinned)){
// tabs is moved based on x(current index) + i(reference index)
chrome.tabs.move(tabs[x].id, i + x)
}
}
}
});
My manifest file is this:
{
"manifest_version": 2,
"name": "Tab Organizer",
"description": "Auto Organizes Tabs",
"version": "1.0",
"background": {
"scripts": ["tabOrganizer.js"],
"persistent": false
},
"permissions": [
"tabs",
"<all_urls>"
],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
}
}
I imagine I'm making a dumb mistake since I'm new at this but thanks in advance!