Created
August 27, 2017 13:57
-
-
Save Potherca/c60cbbb64a0a37315c5fb6c2ef7f3769 to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ /* Add dependencies needed to call `addPageToStorage` */ $('head').append('<script src="chrome-extension://eiimnmioipafcokbfikbljfdeojpcgbh/options.js"></script>'); $('body').append('<span id="login_label" style="display:none;"></span>'); trackButton = function(){}; init = function(){}; /* Define our custom event handler */ function handleLoginEvent(event) { if(event.keyCode === undefined || event.keyCode === 13){ if (passwordIsCorrect()) { bgPage.actualBlockedActive = true; addPageToStorage(); location.href = bgPage.actualBlockedFullUrl; }else{ document.getElementById('login_error').innerHTML=translate('wrongpasswd'); } } }; /* Remove original event-handlers */ $('#login_password, #login_button').unbind(); /* Add form field used by `addPageToStorage` */ $('body').append('<input type="hidden" id="block_page" value="' + bgPage.cropUrl(bgPage.actualBlockedFullUrl).split('/')[0] + '"/>'); $('#main').append('<p><em>'+$('#block_page').val()+'</em></p>'); /* Add our custom event-handler */ $('#login_button').on('click', handleLoginEvent); $('#login_password').on('keydown', handleLoginEvent); /* Restore original event-handlers */ login(); /*DONE*/