This repository has been archived by the owner on Nov 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pkg): move some logic to javascript to improve page load
- Loading branch information
1 parent
8641552
commit 2fd9b9d
Showing
11 changed files
with
218 additions
and
84 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,52 @@ | ||
const ta = $("#domains"); | ||
const showNumber = (num) => { | ||
const eL = $("#labeldomains"); | ||
eL.text(eL.text().replace(/ \([0-9]+\)$/, '')); | ||
eL.text(eL.text() + `(${num})`); | ||
}; | ||
const listDomains = (d) => { | ||
$("div.listdomains").css('display', ''); | ||
$(".resultmsg").css('display', 'none'); | ||
ta.css('display', '').val(""); | ||
showNumber(0); | ||
if (d.success) { | ||
if (d.domains && d.domains.length) { | ||
$(".resultmsg:last").css('display', ''); | ||
showNumber(d.domains.length); | ||
ta.css('display', '').val(d.domains.join("\n")); | ||
return; | ||
} | ||
} | ||
$(".resultmsg:first").css('display', ''); | ||
}; | ||
const updateTextarea = () => { | ||
const val = ta.val(); | ||
if (val !== "") { | ||
listDomains({ | ||
success: true, | ||
domains: val.split("\n") | ||
}); | ||
} | ||
}; | ||
$('button[class*="actionBttn"').click(function () { | ||
$('#importform input[name="action"]').val(this.id); | ||
if (this.id === "pull") { | ||
$.ajax({ | ||
type: "POST", | ||
data: $(this.form).serialize(), | ||
dataType: 'json' | ||
}).then((d) => { | ||
//successful http communication, use returned result for output | ||
listDomains(d); | ||
}, (d) => { | ||
//failed http communication, show error | ||
listDomains({ | ||
success: false, | ||
msg: `${d.status} ${d.statusText}` | ||
}); | ||
}); | ||
} else { | ||
this.form.submit(); | ||
} | ||
}); | ||
updateTextarea(); |
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,25 @@ | ||
.glyphicon-refresh-animate { | ||
-animation: spin .7s infinite linear; | ||
-webkit-animation: spin .7s infinite linear; | ||
animation: spin .7s infinite linear; | ||
} | ||
@-webkit-keyframes spin { | ||
from { -webkit-transform: rotate(0deg);} | ||
to { -webkit-transform: rotate(360deg);} | ||
} | ||
@keyframes spin { | ||
from { transform: scale(1) rotate(0deg);} | ||
to { transform: scale(1) rotate(360deg);} | ||
} | ||
table.scrollable { | ||
width: auto; | ||
} | ||
table.scrollable thead { | ||
display: block; | ||
} | ||
table.scrollable tbody { | ||
display: block; | ||
height: 400px; | ||
overflow-y: auto; | ||
overflow-x: hidden; | ||
} |
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,37 @@ | ||
// access /admin/addonmodules.php?module=ispapidomainimport&action=getlang | ||
// ... and save it as this file | ||
// we could automate this in CI | ||
if (typeof ISPAPI === "undefined") { | ||
ISPAPI = {}; | ||
} | ||
ISPAPI.lang = { | ||
"ok": "OK", | ||
"registrarerror": "The ispapi registrar authentication failed! Please verify your registrar credentials and try again.", | ||
"actionerror": "Invalid action requested. Please go back and try again.", | ||
"domaincreateerror": "Unable to create domain.", | ||
"tldrenewalpriceerror": "Unable to determinate domain renewal price.", | ||
"registrantcreateerror": "Unable to create client.", | ||
"registrantcreateerrornophone": "Unable to create client (no phone number).", | ||
"registrantfetcherror": "Unable to load registrant data.", | ||
"registrantmissingerror": "Missing Registrant in domain configuration.", | ||
"alreadyexistingerror": "Domain name already exists.", | ||
"domainnameinvaliderror": "Invalid domain name.", | ||
"nogatewayerror": "No Payment Gateway configured.", | ||
"domainlistfetcherror": "Failed to load list of domains.", | ||
"nodomainsfounderror": "The query did not return any domains names.", | ||
"domainsfound": "The query returned the below domain names.", | ||
"nothingtoimporterror": "Nothing to import.", | ||
"label.domain": "Domain", | ||
"label.domains": "Domains", | ||
"label.gateway": "Payment Method", | ||
"label.currency": "Currency", | ||
"ph.domainfilter": "Enter Domain Name Filter", | ||
"bttn.pulldomainlist": "Pull Domain list", | ||
"bttn.importdomainlist": "Import Domains", | ||
"bttn.back": "Back", | ||
"col.domain": "Domain", | ||
"col.importresult": "Import Result", | ||
"col.left": "Left", | ||
"status.importing": "Importing", | ||
"status.importdone": "Import done" | ||
}; |
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
3 changes: 1 addition & 2 deletions
3
modules/addons/ispapidomainimport/templates/admin/bttn_back.tpl
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,10 +1,9 @@ | ||
<br/><br/> | ||
<form method="POST"> | ||
<input type="hidden" name="search" value="{$smarty.request.search}" /> | ||
<input type="hidden" name="gateway" value="{$smarty.request.gateway}" /> | ||
<input type="hidden" name="currency" value="{$smarty.request.currency}" /> | ||
<input type="hidden" name="domain" value="{$smarty.request.domain}" /> | ||
<input type="hidden" name="domains" value="{$smarty.request.domains}" /> | ||
<input type="hidden" name="clientpassword" value="{$smarty.request.clientpassword}" /> | ||
<input type="hidden" name="action" value="index" /> | ||
<input type="submit" value="{$_lang["bttn.back"]}" class="btn btn-default" /> | ||
</form> |
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 +1 @@ | ||
<span class="label label-danger">{$error}</span> | ||
<span class="label label-danger resultmsg">{$error}</span> |
6 changes: 6 additions & 0 deletions
6
modules/addons/ispapidomainimport/templates/admin/getlang.tpl
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,6 @@ | ||
{literal} | ||
if (typeof ISPAPI === "undefined") { | ||
ISPAPI = {}; | ||
} | ||
{/literal} | ||
ISPAPI.lang = {$_lang|json_encode nofilter}; |
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
Oops, something went wrong.