-
-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from Kovah/dev
v0.0.23
- Loading branch information
Showing
37 changed files
with
320 additions
and
292 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
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,6 +1,6 @@ | ||
<?php | ||
return [ | ||
'version' => 'v0.0.22', | ||
'version' => 'v0.0.23', | ||
|
||
'default' => [ | ||
'pagination' => 25, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,17 @@ | ||
export default class BookmarkTimer { | ||
|
||
constructor ($el) { | ||
this.$el = $el; | ||
this.init(); | ||
} | ||
|
||
init () { | ||
window.setInterval(function () { | ||
this.$el.text(parseInt(this.$el.text()) - 1); | ||
}, 1000); | ||
|
||
window.setTimeout(function () { | ||
window.close(); | ||
}, 5000); | ||
} | ||
} |
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,61 @@ | ||
import { debounce } from '../lib/helper'; | ||
|
||
export default class GenerateApiToken { | ||
|
||
constructor ($el) { | ||
this.$el = $el; | ||
|
||
this.$input = $el.querySelector('.api-token-input'); | ||
this.$btn = $el.querySelector('.api-token-generate'); | ||
this.$failureMsg = $el.querySelector('.api-token-generate-failure'); | ||
|
||
this.$btn.addEventListener('click', this.onButtonClick.bind(this)); | ||
} | ||
|
||
onButtonClick () { | ||
this.$btn.disabled = true; | ||
|
||
this.fetchNewToken(); | ||
} | ||
|
||
fetchNewToken () { | ||
|
||
const fetchURL = window.appData.routes.ajax.generateApiToken; | ||
|
||
fetch(fetchURL, { | ||
method: 'POST', | ||
credentials: 'same-origin', | ||
headers: {'Content-Type': 'application/json'}, | ||
body: JSON.stringify({ | ||
_token: window.appData.user.token | ||
}) | ||
}).then((response) => { | ||
return response.json(); | ||
}).then(response => { | ||
this.handleResponse(response); | ||
}).catch(() => { | ||
this.showFailureMsg(); | ||
}); | ||
|
||
} | ||
|
||
handleResponse (response) { | ||
|
||
if (typeof response.new_token !== 'undefined') { | ||
debounce(() => { | ||
this.$input.value = response.new_token; | ||
}, 1000); | ||
|
||
window.setTimeout(() => { | ||
this.$btn.disabled = false; | ||
}, 5000); | ||
} else { | ||
this.showFailureMsg(); | ||
} | ||
|
||
} | ||
|
||
showFailureMsg () { | ||
this.$failureMsg.classList.remove('d-none'); | ||
} | ||
} |
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,72 @@ | ||
import { debounce } from '../lib/helper'; | ||
|
||
export default class GenerateCronToken { | ||
|
||
constructor ($el) { | ||
this.$el = $el; | ||
|
||
this.$input = $el.querySelector('.cron-token-input'); | ||
this.$btn = $el.querySelector('.cron-token-generate'); | ||
this.$failureMsg = $el.querySelector('.cron-token-generate-failure'); | ||
this.$cronUrl = $el.querySelector('.cron-token-url'); | ||
|
||
this.$btn.addEventListener('click', this.onButtonClick.bind(this)); | ||
} | ||
|
||
onButtonClick () { | ||
this.$btn.disabled = true; | ||
|
||
this.fetchNewToken(); | ||
} | ||
|
||
fetchNewToken () { | ||
|
||
if (!confirm(this.$el.dataset.confirmMessage)) { | ||
this.$btn.disabled = false; | ||
return; | ||
} | ||
|
||
const fetchURL = window.appData.routes.ajax.generateCronToken; | ||
|
||
fetch(fetchURL, { | ||
method: 'POST', | ||
credentials: 'same-origin', | ||
headers: {'Content-Type': 'application/json'}, | ||
body: JSON.stringify({ | ||
_token: window.appData.user.token | ||
}) | ||
}).then(response => { | ||
return response.json(); | ||
}).then(response => { | ||
this.handleResponse(response); | ||
}).catch(() => { | ||
this.showFailureMsg(); | ||
}); | ||
|
||
} | ||
|
||
handleResponse (response) { | ||
|
||
if (typeof response.new_token !== 'undefined') { | ||
debounce(() => { | ||
this.$input.value = response.new_token; | ||
this.$cronUrl.innerHTML = this.buildCronURl(response.new_token); | ||
}, 1000); | ||
|
||
window.setTimeout(() => { | ||
this.$btn.disabled = false; | ||
}, 5000); | ||
} else { | ||
this.showFailureMsg(); | ||
} | ||
|
||
} | ||
|
||
showFailureMsg () { | ||
this.$failureMsg.classList.remove('d-none'); | ||
} | ||
|
||
buildCronURl (newToken) { | ||
return this.$el.dataset.cronUrlBase + newToken; | ||
} | ||
} |
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,19 +1,20 @@ | ||
export default class LoadingButton { | ||
|
||
constructor ($el) { | ||
this.$el = $el; | ||
this.$form = this.$el.form; | ||
this.$btn = $el; | ||
this.$form = this.$btn.form; | ||
|
||
this.$el.addEventListener('click', this.onClick.bind(this)) | ||
this.$btn.addEventListener('click', this.onClick.bind(this)); | ||
} | ||
|
||
onClick () { | ||
if (this.formIsValid()) { | ||
this.$el.disabled = true; | ||
this.$btn.disabled = true; | ||
this.$form.submit(); | ||
} | ||
} | ||
|
||
formIsValid() { | ||
formIsValid () { | ||
return this.$form.checkValidity(); | ||
} | ||
} |
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 @@ | ||
export default class ShareToggleAll { | ||
|
||
constructor ($el) { | ||
this.$toggle = $el; | ||
this.shareToggles = document.documentElement.querySelectorAll('.sharing-checkbox-input'); | ||
|
||
this.$toggle.addEventListener('click', this.onToggleClick.bind(this)); | ||
} | ||
|
||
onToggleClick () { | ||
this.shareToggles.forEach(toggle => { | ||
toggle.checked = !toggle.checked; | ||
}) | ||
} | ||
} |
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,8 @@ | ||
export default class SimpleSelect { | ||
|
||
constructor ($el) { | ||
$($el).selectize({ | ||
create: false | ||
}); | ||
} | ||
} |
Oops, something went wrong.