Skip to content

Commit

Permalink
#11 Refactor AVIMAutoConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkha committed Apr 11, 2015
1 parent 392f611 commit f50867f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/scripts/avim.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* - Make it work inside Chrome Extension
* - Remove unused codes for other browsers (Firefox, IE,...)
* - Add API for setting from popup.html
* - Refactor
*/

/*
Expand All @@ -22,10 +23,8 @@
* 2. You must not claim that you or any other third party is the author
* of this software in any way.
*/

var extension = chrome.extension;

var document = window.document;
var sendRequest = extension.sendMessage;
var AVIMObj = '';

var method = 0, //Default input method: 0=AUTO, 1=TELEX, 2=VNI, 3=VIQR, 4=VIQR*
Expand All @@ -36,12 +35,12 @@ var method = 0, //Default input method: 0=AUTO, 1=TELEX, 2=VNI, 3=VIQR, 4=VIQR*
exclude = ["email"]; //IDs of the fields you DON'T want to let users type Vietnamese in

//Set to true the methods which you want to be included in the AUTO method
var AVIMAutoConfig = {
telex: true,
vni: true,
viqr: false,
viqrStar: false
};
var AVIMAutoConfig = [
true,//telex
true,//vni
false,//viqr
false//viqrStar
];

function AVIM() {
this.attached = [];
Expand Down Expand Up @@ -316,7 +315,7 @@ function start(obj, key) {
AVIMObj.oc=obj;
var telex = "D,A,E,O,W,W".split(','), vni = "9,6,6,6,7,8".split(','), viqr = "D,^,^,^,+,(".split(','), viqr2 = "D,^,^,^,*,(".split(','), a, noNormC;
if(method === 0) { // AUTO Method
var arr = [], check = [AVIMAutoConfig.telex, AVIMAutoConfig.vni, AVIMAutoConfig.viqr, AVIMAutoConfig.viqrStar];
var arr = [], check = AVIMAutoConfig;
var value1 = [telex, vni, viqr, viqr2], uniA = [uni, uni2, uni3, uni4], D2A = ["DAWEO", "6789", "D^+(", "D^*("];
for(a = 0; a < check.length; a++) {
if(check[a]) {
Expand Down

0 comments on commit f50867f

Please sign in to comment.