Skip to content

Commit

Permalink
Build to release version 0.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nthachus committed Jan 15, 2018
1 parent e1e0356 commit a001f10
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 60 deletions.
4 changes: 2 additions & 2 deletions dist/css/jquery.spellchecker.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
position: absolute;
display: none;
z-index: 9999;
overflow: none;
font: normal 13px arial;
overflow: hidden;
font: normal 13px Arial,Helvetica,sans-serif;
box-shadow: 0 0 4px #aaa;
background: #fff;
border: 1px solid #bbb;
Expand Down
2 changes: 1 addition & 1 deletion dist/css/jquery.spellchecker.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 45 additions & 45 deletions dist/js/jquery.spellchecker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* jQuery Spellchecker - v0.2.4 - 2012-12-19
* jQuery Spellchecker - v0.2.4 - 2018-01-15
* https://github.com/badsyntax/jquery-spellchecker
* Copyright (c) 2012 Richard Willis; Licensed MIT
* Copyright (c) 2018 Richard Willis; Licensed MIT
*/

(function(window, $) {
Expand Down Expand Up @@ -70,7 +70,7 @@
/* Events
*************************/

var Events = function(){
var Events = function() {
this._handlers = {};
};

Expand All @@ -97,13 +97,13 @@
}
};

/* Handlers
/* Handlers
*************************/

var selectWordHandler = function(handlerName) {

return function(e) {

e.preventDefault();
e.stopPropagation();

Expand All @@ -113,14 +113,14 @@
this.trigger(handlerName, e, word, element, this);

}.bind(this);
};
/* Collections
};

/* Collections
*************************/

var Collection = function(elements, instanceFactory) {
this.instances = [];
for(var i = 0; i < elements.length; i++) {
for (var i = 0; i < elements.length; i++) {
this.instances.push( instanceFactory(elements[i]) );
}
this.methods([ 'on', 'destroy', 'trigger' ]);
Expand Down Expand Up @@ -171,7 +171,7 @@
};

IncorrectWordsBox.prototype.createBox = function() {

this.container = $([
'<div class="' + pluginName + '-incorrectwords">',
'</div>'
Expand All @@ -188,8 +188,8 @@
IncorrectWordsBox.prototype.addWords = function(words) {

// Make array values unique
words = $.grep(words, function(el, index){
return index === $.inArray(el, words);
words = $.grep(words, function(el, index) {
return index === $.inArray(el, words);
});

var html = $.map(words, function(word) {
Expand Down Expand Up @@ -239,7 +239,7 @@
this.element.off('.' + pluginName);
try {
window.findAndReplaceDOMText.revert();
} catch(e) {}
} catch (e) {}
};

/* Suggest box
Expand Down Expand Up @@ -357,7 +357,7 @@
};

SuggestBox.prototype.close = function() {
this.container.fadeOut(100, function(){
this.container.fadeOut(100, function() {
this.footer.hide();
}.bind(this));
};
Expand All @@ -374,7 +374,7 @@
e.stopPropagation();
};

SuggestBox.prototype.onWindowClick = function(e) {
SuggestBox.prototype.onWindowClick = function(/*e*/) {
this.close();
};

Expand Down Expand Up @@ -455,7 +455,7 @@
var puncExpr = [
'(^|\\s+)[' + punctuationChars + ']+', // punctuation(s) with leading whitespace(s)
'[' + punctuationChars + ']+\\s+[' + punctuationChars + ']+', // punctuation(s) with leading and trailing whitespace(s)
'[' + punctuationChars + ']+(\\s+|$)' // puncutation(s) with trailing whitespace(s)
'[' + punctuationChars + ']+(\\s+|$)' // punctuation(s) with trailing whitespace(s)
].join('|');

text = text.replace(new RegExp(puncExpr, 'g'), ' '); // strip any punctuation
Expand Down Expand Up @@ -518,7 +518,7 @@
.end()
.text();
}

return this.clean(text);

}.bind(this));
Expand All @@ -532,7 +532,7 @@

try {
window.findAndReplaceDOMText.revert();
} catch(e) {}
} catch (e) {}

var regExp = new RegExp('(^|[^' + letterChars + '])(' + RegExp.escape(oldWord) + ')(?=[^' + letterChars + ']|$)', 'g');

Expand All @@ -546,7 +546,7 @@
this.highlightWords(this.incorrectWords, element);
};

HtmlParser.prototype.replaceTextHandler = function(oldWord, replacement){
HtmlParser.prototype.replaceTextHandler = function(oldWord, replacement) {

var r = replacement;
var replaced;
Expand Down Expand Up @@ -593,7 +593,7 @@
this.replaceText(new RegExp(regExp, 'g'), element[0], this.highlightWordsHandler(incorrectWords), 2);
};

HtmlParser.prototype.highlightWordsHandler = function(incorrectWords) {
HtmlParser.prototype.highlightWordsHandler = function(/*incorrectWords*/) {

var c;
var replaceElement;
Expand All @@ -610,7 +610,7 @@
c = i;
replaceElement = span;
}

span
.text(fill)
.data({
Expand Down Expand Up @@ -652,9 +652,9 @@
};

SpellChecker.prototype.setupSuggestBox = function() {

this.suggestBox = new SuggestBox(this.config, this.elements);

this.on('replace.word.before', function() {
this.suggestBox.close();
this.suggestBox.detach();
Expand All @@ -665,15 +665,15 @@
}.bind(this));

this.on('destroy', function() {
this.suggestBox.destroy();
this.suggestBox.destroy();
}.bind(this));
};

SpellChecker.prototype.setupIncorrectWords = function() {

this.incorrectWords = new Collection(this.elements, function(element) {
return this.config.parser === 'html' ?
new IncorrectWordsInline(this.config, this.parser, element) :
return this.config.parser === 'html' ?
new IncorrectWordsInline(this.config, this.parser, element) :
new IncorrectWordsBox(this.config, this.parser, element);
}.bind(this));

Expand All @@ -687,8 +687,8 @@
};

SpellChecker.prototype.setupParser = function() {
this.parser = this.config.parser === 'html' ?
new HtmlParser(this.elements) :
this.parser = this.config.parser === 'html' ?
new HtmlParser(this.elements) :
new TextParser(this.elements);
};

Expand All @@ -715,7 +715,7 @@
};

SpellChecker.prototype.replaceWord = function(oldWord, replacement, elementOrText) {

if (typeof elementOrText === 'string') {
return this.parser.replaceWordInText(oldWord, replacement, elementOrText);
}
Expand All @@ -735,7 +735,7 @@
/* Event handlers */

SpellChecker.prototype.onCheckWords = function(callback) {

return function(data) {

var incorrectWords = data.data;
Expand All @@ -760,21 +760,21 @@
$.each(badWords, function(i, words) {
if (words.length) {
// Make array unique
words = $.grep(words, function(el, index){
words = $.grep(words, function(el, index) {
return index === $.inArray(el, words);
});
this.incorrectWords.get(i).addWords(words);
this.incorrectWords.get(i).addWords(words);
}
}.bind(this));
this.suggestBox.reattach();
};

SpellChecker.prototype.onSelectWord = function(e, word, element) {
SpellChecker.prototype.onSelectWord = function(e, word/*, element*/) {
e.preventDefault();
this.replaceWord(this.incorrectWord, word);
};

SpellChecker.prototype.onIgnoreWord = function(e, word, element) {
SpellChecker.prototype.onIgnoreWord = function(e/*, word, element*/) {
e.preventDefault();
this.replaceWord(this.incorrectWord, this.incorrectWord);
};
Expand All @@ -791,7 +791,7 @@

$.SpellChecker = SpellChecker;

}(this, jQuery));
}(window, jQuery));

/**
* Some small changes were made by Richard Willis to allow this
Expand All @@ -817,17 +817,17 @@
*/
window.findAndReplaceDOMText = (function() {

/**
/**
* findAndReplaceDOMText
*
*
* Locates matches and replaces with replacementNode
*
* @param {RegExp} regex The regular expression to match
* @param {Node} node Element or Text node to search within
* @param {String|Element|Function} replacementNode A NodeName,
* Node to clone, or a function which returns a node to use
* as the replacement node.
* @param {Number} captureGroup A number specifiying which capture
* @param {Number} captureGroup A number specifying which capture
* group to use in the match. (optional)
*/
function findAndReplaceDOMText(regex, node, replacementNode, captureGroup) {
Expand Down Expand Up @@ -857,17 +857,17 @@ window.findAndReplaceDOMText = (function() {
function _getMatchIndexes(m, captureGroup) {

captureGroup = captureGroup || 0;

if (!m[0]) throw 'findAndReplaceDOMText cannot handle zero-length matches';

var index = m.index;

if (captureGroup > 0) {
var cg = m[captureGroup];
if (!cg) throw 'Invalid capture group';
index += m[0].indexOf(cg);
m[0] = cg;
}
}

return [ index, index + m[0].length, [ m[0] ] ];
}
Expand All @@ -892,13 +892,13 @@ window.findAndReplaceDOMText = (function() {

}

/**
/**
* Steps through the target node, looking for matches, and
* calling replaceFn when a match is found.
*/
function _stepThroughMatches(node, matches, replaceFn) {

var after, before,
var //after, before,
startNode,
endNode,
startNodeIndex,
Expand Down Expand Up @@ -939,7 +939,7 @@ window.findAndReplaceDOMText = (function() {
matchIndex: matchIndex
});
// replaceFn has to return the node that replaced the endNode
// and then we step back so we can continue from the end of the
// and then we step back so we can continue from the end of the
// match:
atIndex -= (endNode.length - endNodeIndex);
startNode = null;
Expand Down Expand Up @@ -983,7 +983,7 @@ window.findAndReplaceDOMText = (function() {
reverts = [];
};

/**
/**
* Generates the actual replaceFn which splits up text nodes
* and inserts the replacement element.
*/
Expand Down
6 changes: 3 additions & 3 deletions dist/js/jquery.spellchecker.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*!
/*
* jQuery Spellchecker - CKEditor Plugin - v0.2.4
* https://github.com/badsyntax/jquery-spellchecker
* Copyright (c) 2012 Richard Willis; Licensed MIT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*!
/*
* jQuery Spellchecker - TinyMCE Plugin - v0.2.4
* https://github.com/badsyntax/jquery-spellchecker
* Copyright (c) 2012 Richard Willis; Licensed MIT
Expand Down
2 changes: 1 addition & 1 deletion grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = function(grunt) {
grunt.initConfig({
pkg: '<json:package.json>',
meta: {
banner: '/*!\n * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
banner: '/*\n * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * <%= pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
Expand Down
2 changes: 1 addition & 1 deletion src/css/jquery.spellchecker.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*!
/*
* jQuery Spellchecker - v0.2.4
* https://github.com/badsyntax/jquery-spellchecker
*
Expand Down
2 changes: 1 addition & 1 deletion src/js/jquery.spellchecker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*!
/*
* jQuery Spellchecker - v0.2.4
* https://github.com/badsyntax/jquery-spellchecker
* Copyright (c) 2012 Richard Willis; Licensed MIT
Expand Down
Loading

0 comments on commit a001f10

Please sign in to comment.