Skip to content

Commit

Permalink
Finish gulp build #7 and fixbug
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkha committed Apr 9, 2015
1 parent 5b0c7dd commit e678f04
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 105 deletions.
8 changes: 4 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ gulp.task('styles', function() {

//build ditributable and sourcemaps after other tasks completed
gulp.task('zip', ['html', 'scripts', 'styles', 'copy'], function() {
var manifest = require('./src/manifest'),
distFileName = manifest.name + ' v' + manifest.version + '.zip',
mapFileName = manifest.name + ' v' + manifest.version + '-maps.zip';
var manifest = require('./src/manifest.json'),
distFileName = 'avim-chrome-' + manifest.version + '.zip',
mapFileName = 'avim-chrome-' + manifest.version + '-maps.zip';
//collect all source maps
gulp.src('build/scripts/**/*.map')
.pipe(zip(mapFileName))
Expand All @@ -80,4 +80,4 @@ gulp.task('zip', ['html', 'scripts', 'styles', 'copy'], function() {
//run all tasks after build directory has been cleaned
gulp.task('default', ['clean'], function() {
gulp.start('zip');
});
});
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
},
"homepage": "https://github.com/kimkha/avim-chrome",
"devDependencies": {
"gulp-cleanhtml": "0.0.2",
"gulp-clean": "~0.3.1",
"gulp-minify-css": "~0.3.11",
"gulp-uglify": "~1.0.1",
"gulp-jshint": "~1.9.0",
"gulp-zip": "~2.0.2",
"gulp": "~3.8.10",
"gulp-strip-debug": "~1.0.1"
"gulp": "^3.8.11",
"gulp-clean": "^0.3.1",
"gulp-cleanhtml": "^0.1.0",
"gulp-jshint": "^1.10.0",
"gulp-minify-css": "^1.0.0",
"gulp-strip-debug": "^1.0.2",
"gulp-uglify": "^1.1.0",
"gulp-zip": "^3.0.2"
}
}
186 changes: 93 additions & 93 deletions src/scripts/avim.js
Original file line number Diff line number Diff line change
Expand Up @@ -814,40 +814,40 @@
}
word = unV(word);
// TODO: NEW CODE
return;
//return;
// TODO: OLD CODE
//if(!space && !AVIMObj.changed) {
// word += k;
//}
if(!AVIMObj.changed) {
word += k;
}

//var sp = AVIMObj.oc.selectionStart, pos = sp;
//if(!AVIMObj.changed) {
// var sst = AVIMObj.oc.scrollTop;
// pos += k.length;
// if(!AVIMObj.oc.data) {
// AVIMObj.oc.value = AVIMObj.oc.value.substr(0, sp) + k + AVIMObj.oc.value.substr(AVIMObj.oc.selectionEnd);
// AVIMObj.changed = true;
// AVIMObj.oc.scrollTop = sst;
// } else {
// AVIMObj.oc.insertData(AVIMObj.oc.pos, k);
// AVIMObj.oc.pos++;
// AVIMObj.range.setEnd(AVIMObj.oc, AVIMObj.oc.pos);
// AVIMObj.specialChange = true;
// }
//}
//if(!AVIMObj.oc.data) {
// AVIMObj.oc.setSelectionRange(pos, pos);
//}
//if(!ckspell(word, fS)) {
// replaceChar(AVIMObj.oc, i - j, c);
// if(!AVIMObj.oc.data) {
// var a = [AVIMObj.D];
// main(word, fS, pos, a, false);
// } else {
// var ww = mozGetText(AVIMObj.oc), a = [AVIMObj.D];
// main(ww[0], fS, ww[1], a, false);
// }
//}
var sp = AVIMObj.oc.selectionStart, pos = sp;
if(!AVIMObj.changed) {
var sst = AVIMObj.oc.scrollTop;
pos += k.length;
if(!AVIMObj.oc.data) {
AVIMObj.oc.value = AVIMObj.oc.value.substr(0, sp) + k + AVIMObj.oc.value.substr(AVIMObj.oc.selectionEnd);
AVIMObj.changed = true;
AVIMObj.oc.scrollTop = sst;
} else {
AVIMObj.oc.insertData(AVIMObj.oc.pos, k);
AVIMObj.oc.pos++;
AVIMObj.range.setEnd(AVIMObj.oc, AVIMObj.oc.pos);
AVIMObj.specialChange = true;
}
}
if(!AVIMObj.oc.data) {
AVIMObj.oc.setSelectionRange(pos, pos);
}
if(!ckspell(word, fS)) {
replaceChar(AVIMObj.oc, i - j, c);
var a = [AVIMObj.D];
if(!AVIMObj.oc.data) {
main(word, fS, pos, a, false);
} else {
var ww = mozGetText(AVIMObj.oc);
main(ww[0], fS, ww[1], a, false);
}
}
}
}
}
Expand Down Expand Up @@ -890,65 +890,6 @@
}
}

function ifMoz(e) {
// Init code for editable iframes and divs
var code = e.which, avim = AVIMObj.AVIM, cwi = e.target.parentNode.wi;
if(typeof(avim) == "undefined") avim = AVIMObj;
if(typeof(cwi) == "undefined") cwi = e.target.parentNode.parentNode.wi;
if(typeof(cwi) == "undefined") cwi = window;
if(e.ctrlKey || (e.altKey && (code != 92) && (code != 126))) return;

// get current caret and its node
var sel = cwi.getSelection();
var range = sel.getRangeAt(0);
var node = range.endContainer, newPos;

avim.sk = fcc(code);
avim.saveStr = "";
if(checkCode(code) || !range.startOffset || (typeof(node.data) == 'undefined')) return;
node.sel = false;

if(node.data) {
avim.saveStr = node.data.substr(range.endOffset);
if(range.startOffset != range.endOffset) {
node.sel=true;
}
node.deleteData(range.startOffset, node.data.length);
}

if(!node.data) {
range.setStart(node, 0);
range.setEnd(node, range.endOffset);
sel.removeAllRanges();
sel.addRange(range);
return;
}

node.value = node.data;
node.pos = node.data.length;
node.which=code;
start(node, e);
node.insertData(node.data.length, avim.saveStr);
newPos = node.data.length - avim.saveStr.length + avim.kl;

// Set caret back to node
range.setStart(node, newPos);
range.setEnd(node, newPos);
sel.removeAllRanges();
sel.addRange(range);

avim.kl = 0;
if(avim.specialChange) {
avim.specialChange = false;
avim.changed = false;
node.deleteData(node.pos - 1, 1);
}
if(avim.changed) {
avim.changed = false;
e.preventDefault();
}
}

function unV(word) {
var u = repSign(null), b, a;
for(a = 1; a <= word.length; a++) {
Expand Down Expand Up @@ -1021,6 +962,65 @@
AVIMObj.range = sel ? sel.getRangeAt(0) : document.createRange();
}/**/

function ifMoz(e) {
// Init code for editable iframes and divs
var code = e.which, avim = AVIMObj.AVIM, cwi = e.target.parentNode.wi;
if(typeof(avim) == "undefined") avim = AVIMObj;
if(typeof(cwi) == "undefined") cwi = e.target.parentNode.parentNode.wi;
if(typeof(cwi) == "undefined") cwi = window;
if(e.ctrlKey || (e.altKey && (code != 92) && (code != 126))) return;

// get current caret and its node
var sel = cwi.getSelection();
var range = sel.getRangeAt(0);
var node = range.endContainer, newPos;

avim.sk = fcc(code);
avim.saveStr = "";
if(checkCode(code) || !range.startOffset || (typeof(node.data) == 'undefined')) return;
node.sel = false;

if(node.data) {
avim.saveStr = node.data.substr(range.endOffset);
if(range.startOffset != range.endOffset) {
node.sel=true;
}
node.deleteData(range.startOffset, node.data.length);
}

if(!node.data) {
range.setStart(node, 0);
range.setEnd(node, range.endOffset);
sel.removeAllRanges();
sel.addRange(range);
return;
}

node.value = node.data;
node.pos = node.data.length;
node.which=code;
start(node, e);
node.insertData(node.data.length, avim.saveStr);
newPos = node.data.length - avim.saveStr.length + avim.kl;

// Set caret back to node
range.setStart(node, newPos);
range.setEnd(node, newPos);
sel.removeAllRanges();
sel.addRange(range);

avim.kl = 0;
if(avim.specialChange) {
avim.specialChange = false;
avim.changed = false;
node.deleteData(node.pos - 1, 1);
}
if(avim.changed) {
avim.changed = false;
e.preventDefault();
}
}

/*function FKeyPress() {
var obj = findFrame();
AVIMObj.sk = fcc(obj.event.keyCode);
Expand Down Expand Up @@ -1177,7 +1177,7 @@
}

function AVIMInit(AVIM, isAttach) {
if(AVIM.support) {
/*if(AVIM.support) {
AVIM.fID = document.getElementsByTagName("iframe");
for(AVIM.g = 0; AVIM.g < AVIM.fID.length; AVIM.g++) {
if(findIgnore(AVIM.fID[AVIM.g])) {
Expand All @@ -1200,7 +1200,7 @@
}
} catch(e) {}
}
}
}*/
}

function AVIMAJAXFix(counter) {
Expand Down

0 comments on commit e678f04

Please sign in to comment.