This repository has been archived by the owner on Aug 15, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to krinkle/toollabs-base 1.0.2
- Loading branch information
Showing
9 changed files
with
100 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/public_html/base | ||
/vendor |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
extends: semistandard | ||
parserOptions: | ||
ecmaVersion: 5 | ||
env: | ||
es6: false | ||
node: false | ||
browser: true | ||
globals: | ||
jQuery: false | ||
KRINKLE: false | ||
rules: | ||
one-var: 0 |
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,5 @@ | ||
vendor | ||
node_modules | ||
composer.lock | ||
config.php | ||
package-lock.json |
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,14 +1,12 @@ | ||
sudo: false | ||
language: php | ||
php: | ||
- "5.6" | ||
- "5.5" | ||
- "hhvm" | ||
- "7.2" | ||
- "7.1" | ||
install: | ||
- composer install | ||
# Upgrade default Node.js version in Travis' PHP image from Node.js v0.10.x to 8.x | ||
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.9/install.sh | bash; | ||
- source ~/.nvm/nvm.sh; nvm install 8 | ||
script: | ||
- composer test | ||
notifications: | ||
irc: | ||
channels: | ||
- "chat.freenode.net##krinkle" |
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,12 +1,16 @@ | ||
{ | ||
"require": { | ||
"Krinkle/toollabs-base": "~0.7.0", | ||
"Krinkle/intuition": "~0.2.1" | ||
"php": ">=7.0", | ||
"Krinkle/toollabs-base": "1.0.2", | ||
"Krinkle/intuition": "^1.2.0" | ||
}, | ||
"require-dev": { | ||
"jakub-onderka/php-parallel-lint": "0.9.*" | ||
"jakub-onderka/php-parallel-lint": "^1.0.0" | ||
}, | ||
"scripts": { | ||
"test": "parallel-lint . --exclude vendor" | ||
"test": [ | ||
"parallel-lint . --exclude vendor", | ||
"npm install && npm test" | ||
] | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"test": "eslint ." | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.4.0", | ||
"eslint-config-semistandard": "^12.0.1", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-promise": "^4.0.0", | ||
"eslint-plugin-standard": "^3.1.0" | ||
} | ||
} |
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,62 +1,61 @@ | ||
(function (K, $) { | ||
var $input = $('#ot-form-wikiids'), | ||
$submit = $('#ot-form-submit'), | ||
$form = $('#ot-form'), | ||
resultNode = $('#ot-result')[0], | ||
lastVal, | ||
jqXhr; | ||
var $input = $('#ot-form-wikiids'), | ||
$submit = $('#ot-form-submit'), | ||
$form = $('#ot-form'), | ||
resultNode = $('#ot-result')[0], | ||
lastVal, | ||
jqXhr; | ||
|
||
function handleInput(val) { | ||
if (jqXhr) { | ||
return; | ||
} | ||
function handleInput (val) { | ||
if (jqXhr) { | ||
return; | ||
} | ||
|
||
val = $.trim(val); | ||
if (!val) { | ||
return; | ||
} | ||
val = $.trim(val); | ||
if (!val) { | ||
return; | ||
} | ||
|
||
// Ensure de-duplication between submit-click and | ||
// input-blur, and input-change and input-blur. | ||
if (val === lastVal) { | ||
return; | ||
} | ||
lastVal = val; | ||
// Ensure de-duplication between submit-click and | ||
// input-blur, and input-change and input-blur. | ||
if (val === lastVal) { | ||
return; | ||
} | ||
lastVal = val; | ||
|
||
$submit.prop('disabled', true).addClass('ot-is-active'); | ||
$form.addClass('ot-is-active'); | ||
jqXhr = $.ajax({ | ||
url: K.baseTool.basePath, | ||
type: 'POST', | ||
data: { | ||
format: '_tool', | ||
_tool: 'ajax', | ||
wikiids: val | ||
}, | ||
dataType: 'html' | ||
}).done(function (html) { | ||
resultNode.innerHTML = html; | ||
if (history.replaceState) { | ||
history.replaceState(null, null, './?wikiids=' + val); | ||
} | ||
}).always(function () { | ||
jqXhr = null; | ||
$submit.prop('disabled', false).removeClass('ot-is-active'); | ||
$form.removeClass('ot-is-active'); | ||
}).fail(function () { | ||
$form.submit(); | ||
}); | ||
} | ||
$submit.prop('disabled', true).addClass('ot-is-active'); | ||
$form.addClass('ot-is-active'); | ||
jqXhr = $.ajax({ | ||
url: K.baseTool.basePath, | ||
type: 'POST', | ||
data: { | ||
format: '_tool', | ||
_tool: 'ajax', | ||
wikiids: val | ||
}, | ||
dataType: 'html' | ||
}).done(function (html) { | ||
resultNode.innerHTML = html; | ||
if (history.replaceState) { | ||
history.replaceState(null, null, './?wikiids=' + val); | ||
} | ||
}).always(function () { | ||
jqXhr = null; | ||
$submit.prop('disabled', false).removeClass('ot-is-active'); | ||
$form.removeClass('ot-is-active'); | ||
}).fail(function () { | ||
$form.submit(); | ||
}); | ||
} | ||
|
||
$input.on('change blur', function () { | ||
handleInput(this.value); | ||
}); | ||
|
||
$submit.on('click', function (e) { | ||
handleInput($input.val()); | ||
e.preventDefault(); | ||
}) | ||
.addClass('ot-has-spinner') | ||
.append('<span class="ot-spinner"> <i class="glyphicon-spin glyphicon glyphicon-refresh"></i></span>'); | ||
$input.on('change blur', function () { | ||
handleInput(this.value); | ||
}); | ||
|
||
$submit.on('click', function (e) { | ||
handleInput($input.val()); | ||
e.preventDefault(); | ||
}) | ||
.addClass('ot-has-spinner') | ||
.append('<span class="ot-spinner"> <i class="glyphicon-spin glyphicon glyphicon-refresh"></i></span>'); | ||
}(KRINKLE, jQuery)); |