javascript - Uncaught SyntaxError: Unexpected end of input on popup.html file in Chrome Extension -
i'm making chrome extension first time. when right click extension icon , inspect popup error i'm getting.
uncaught syntaxerror: unexpected end of input myextension/popup.html
and fact it's failing on html file making me confused. looked through 10 other similar questions , of time it's apparently syntax error in javascript file. i've linted mine couple different linters , still nothing showing up. me spot mistake here? it's 62 lines:
function updatepopup(){ listofbad = json.parse(localstorage["badguys"]); $('#dumpster').empty(); var = 0; for(i = 0; < listofbad.length; = i+1){ $('#dumpster').append( listofbad[i] + "<br>"); } } $(document).ready(function(){ if(localstorage["badguys"] != undefined){ var namesthe = json.parse(localstorage["badguys"]); updatepopup(); chrome.tabs.query({ active: true, currentwindow: true }, function(tabs) { /* ...and send request dom info... */ console.log("sending message popup content"); chrome.tabs.sendmessage( tabs[0].id, {from: 'popup', subject: 'dominfo', newnames: namesthe} ); } ); } }); function save_options() { var thenames = []; if( localstorage["badguys"] != undefined ){ thenames = json.parse(localstorage["badguys"]); } console.log("jsonparse: " + thenames.tostring()); //thenames = ["aidenator", "moobot", "nightbot", "teamevilmaster"]; var elname = document.getelementbyid("namebox").value; if( $.inarray(elname, thenames) > -1 ){ return false; } thenames.push(elname); localstorage["badguys"] = json.stringify(thenames); updatepopup(); chrome.tabs.query({ active: true, currentwindow: true }, function(tabs) { /* ...and send request dom info... */ console.log("sending message popup content"); chrome.tabs.sendmessage( tabs[0].id, {from: 'popup', subject: 'dominfo', newnames: thenames} ); }); } document.getelementbyid('namebutton').addeventlistener('click', save_options); function clearlist() { localstorage["badguys"] = []; updatepopup(); } document.getelementbyid('clearbutton').addeventlistener('click', clearlist );
here's small html goes along too:
<!doctype html> <head> <title>extension options</title> <script src="jquery.js" type="text/javascript"></script> </head> <body> <div id='status'></div> annoying person's name: <input type='text' id="namebox"></input> <button id="namebutton">add</button> <button id="clearbutton">clear list</button> <hr> <center> <i>list of removed people:</i> </center> <div id="dumpster"></div> <hr> <center> <img src="carlton.jpg" width="50px"> </center> <script type="text/javascript" src="popup.js"></script> </body> </html>
maybe i've been staring @ screen long spot typos, if me out here, that'd great. chrome extension business has been quite frustrating.
Comments
Post a Comment