-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #2 extension source code structure
- Loading branch information
Showing
13 changed files
with
679 additions
and
678 deletions.
There are no files selected for viewing
This file contains 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 characters
File renamed without changes
File renamed without changes
File renamed without changes
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/*chrome.browserAction.setBadgeText({ | ||
text: "save" | ||
/*chrome.browserAction.setBadgeText({ | ||
text: "save" | ||
});*/ |
File renamed without changes.
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,64 @@ | ||
/** | ||
* Common functions library | ||
* Version 1.0 | ||
* Copyright (c) 2015 Kostyantyn Didenko. All rights reserved. | ||
* This software is distributed under GNU GPL v2 licence | ||
* For feedbacks and questions please feel free to contact me at kdidenko@gmail.com | ||
*/ | ||
|
||
/** | ||
* An alias to test the variables and objects | ||
*/ | ||
function isset(v) { return (v != 'undefined' && v != '' && v != null); } | ||
|
||
|
||
/** | ||
* Timer object for managing the flow when using asynchronous calls | ||
* @deprecated | ||
*/ | ||
var timer = (function () { | ||
/** | ||
* private flag to manage the flow - wait or continue | ||
*/ | ||
var _wait = true; | ||
/** | ||
* private default timeout for flow to wait = 5 seconds | ||
*/ | ||
var _timeout = 5000; | ||
/** | ||
* private flag to determine if timer is running or not | ||
*/ | ||
var _running = false; | ||
/** | ||
* return the timer object instance itself | ||
*/ | ||
return { | ||
/** | ||
* wait() for milliseconds specified | ||
* @param timeout | ||
* @return time waiting | ||
*/ | ||
wait: function (timeout) { | ||
// set the timeout value | ||
_timeout = isset(timeout) && (timeout % 1 === 0) && (timeout > 0) ? timeout : _timeout; | ||
// rememebr when started | ||
var start = new Date().getTime(); | ||
// set timer's state as running | ||
_running = true; | ||
// wait until stopped or timout is reached | ||
while (((new Date().getTime() - start) < _timeout) && _wait) { continue } | ||
// set timer's states as stopped | ||
_running = false; | ||
_wait = true; | ||
// return how much time waited | ||
alert('stopped in : ' + (new Date().getTime() - start) + 'ms.'); | ||
return new Date().getTime() - start; | ||
}, | ||
/** | ||
* stop() waiting | ||
*/ | ||
stop: function () { | ||
if(_running) { alert('stopping'); _wait = false } | ||
} | ||
}; | ||
})(); | ||
/** | ||
* Common functions library | ||
* Version 1.0 | ||
* Copyright (c) 2015 Kostyantyn Didenko. All rights reserved. | ||
* This software is distributed under GNU GPL v2 licence | ||
* For feedbacks and questions please feel free to contact me at kdidenko@gmail.com | ||
*/ | ||
|
||
/** | ||
* An alias to test the variables and objects | ||
*/ | ||
function isset(v) { return (v != 'undefined' && v != '' && v != null); } | ||
|
||
|
||
/** | ||
* Timer object for managing the flow when using asynchronous calls | ||
* @deprecated | ||
*/ | ||
var timer = (function () { | ||
/** | ||
* private flag to manage the flow - wait or continue | ||
*/ | ||
var _wait = true; | ||
/** | ||
* private default timeout for flow to wait = 5 seconds | ||
*/ | ||
var _timeout = 5000; | ||
/** | ||
* private flag to determine if timer is running or not | ||
*/ | ||
var _running = false; | ||
/** | ||
* return the timer object instance itself | ||
*/ | ||
return { | ||
/** | ||
* wait() for milliseconds specified | ||
* @param timeout | ||
* @return time waiting | ||
*/ | ||
wait: function (timeout) { | ||
// set the timeout value | ||
_timeout = isset(timeout) && (timeout % 1 === 0) && (timeout > 0) ? timeout : _timeout; | ||
// rememebr when started | ||
var start = new Date().getTime(); | ||
// set timer's state as running | ||
_running = true; | ||
// wait until stopped or timout is reached | ||
while (((new Date().getTime() - start) < _timeout) && _wait) { continue } | ||
// set timer's states as stopped | ||
_running = false; | ||
_wait = true; | ||
// return how much time waited | ||
alert('stopped in : ' + (new Date().getTime() - start) + 'ms.'); | ||
return new Date().getTime() - start; | ||
}, | ||
/** | ||
* stop() waiting | ||
*/ | ||
stop: function () { | ||
if(_running) { alert('stopping'); _wait = false } | ||
} | ||
}; | ||
})(); |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
|
||
function translate(id, attribute, text) { | ||
var el = document.getElementById(id); | ||
// check if element exists | ||
if(el !== null && el !== 'undefined' && el !== '') { | ||
if(attribute !== 'innerHTML') { | ||
el.setAttribute(attribute, text); | ||
} else { | ||
el.innerHTML = text; | ||
} | ||
} else { | ||
console.log ('could not find element with id: ' + id); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* entry point for internationalization functionality | ||
*/ | ||
function i18n() { | ||
var title = chrome.i18n.getMessage("title"); | ||
translate('title', 'innerHTML', title); | ||
var ext_name = chrome.i18n.getMessage("ext_name"); | ||
translate('ext_name', 'innerHTML', ext_name); | ||
var save_btn = chrome.i18n.getMessage("save_btn"); | ||
translate('save_btn', 'innerHTML', save_btn); | ||
var open_btn = chrome.i18n.getMessage("open_btn"); | ||
translate('open_btn', 'innerHTML', open_btn); | ||
var ssn_sess = chrome.i18n.getMessage("ssn_sess"); | ||
translate('ssn_sess', 'innerHTML', ssn_sess); | ||
var inpt_name = chrome.i18n.getMessage("inpt_name"); | ||
translate('inpt_name', 'placeholder', inpt_name); | ||
var save = chrome.i18n.getMessage("save"); | ||
translate('save', 'value', save); | ||
/*** v 1.0.9 ***/ | ||
/* removed at v 1.1.3 | ||
var list_action_choose = chrome.i18n.getMessage("list_action_choose"); | ||
translate('list_action_choose', 'innerHTML', list_action_choose); | ||
*/ | ||
var list_action_select = chrome.i18n.getMessage("list_action_select"); | ||
translate('list_action_select', 'innerHTML', list_action_select); | ||
var list_action_clear = chrome.i18n.getMessage("list_action_clear"); | ||
translate('list_action_clear', 'innerHTML', list_action_clear); | ||
var list_action_toggle = chrome.i18n.getMessage("list_action_toggle"); | ||
translate('list_action_toggle', 'innerHTML', list_action_toggle); | ||
/*** v 1.0.9 ***/ | ||
} | ||
|
||
/** | ||
* Event listener to handle document onload | ||
*/ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
i18n(); | ||
|
||
function translate(id, attribute, text) { | ||
var el = document.getElementById(id); | ||
// check if element exists | ||
if(el !== null && el !== 'undefined' && el !== '') { | ||
if(attribute !== 'innerHTML') { | ||
el.setAttribute(attribute, text); | ||
} else { | ||
el.innerHTML = text; | ||
} | ||
} else { | ||
console.log ('could not find element with id: ' + id); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* entry point for internationalization functionality | ||
*/ | ||
function i18n() { | ||
var title = chrome.i18n.getMessage("title"); | ||
translate('title', 'innerHTML', title); | ||
var ext_name = chrome.i18n.getMessage("ext_name"); | ||
translate('ext_name', 'innerHTML', ext_name); | ||
var save_btn = chrome.i18n.getMessage("save_btn"); | ||
translate('save_btn', 'innerHTML', save_btn); | ||
var open_btn = chrome.i18n.getMessage("open_btn"); | ||
translate('open_btn', 'innerHTML', open_btn); | ||
var ssn_sess = chrome.i18n.getMessage("ssn_sess"); | ||
translate('ssn_sess', 'innerHTML', ssn_sess); | ||
var inpt_name = chrome.i18n.getMessage("inpt_name"); | ||
translate('inpt_name', 'placeholder', inpt_name); | ||
var save = chrome.i18n.getMessage("save"); | ||
translate('save', 'value', save); | ||
/*** v 1.0.9 ***/ | ||
/* removed at v 1.1.3 | ||
var list_action_choose = chrome.i18n.getMessage("list_action_choose"); | ||
translate('list_action_choose', 'innerHTML', list_action_choose); | ||
*/ | ||
var list_action_select = chrome.i18n.getMessage("list_action_select"); | ||
translate('list_action_select', 'innerHTML', list_action_select); | ||
var list_action_clear = chrome.i18n.getMessage("list_action_clear"); | ||
translate('list_action_clear', 'innerHTML', list_action_clear); | ||
var list_action_toggle = chrome.i18n.getMessage("list_action_toggle"); | ||
translate('list_action_toggle', 'innerHTML', list_action_toggle); | ||
/*** v 1.0.9 ***/ | ||
} | ||
|
||
/** | ||
* Event listener to handle document onload | ||
*/ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
i18n(); | ||
}); |
Oops, something went wrong.