Ïnitial Commit App
This commit is contained in:
parent
ebde8bc052
commit
f9dee33e2f
26 changed files with 6860 additions and 0 deletions
128
assets/js/custom.js
Normal file
128
assets/js/custom.js
Normal file
|
@ -0,0 +1,128 @@
|
|||
"use strict";
|
||||
/****************************
|
||||
* SOME COMMON SVG CONSTANT *
|
||||
****************************/
|
||||
var SVG_LOADER = '<svg viewBox="0 0 20 20" class="Polaris-Spinner Polaris-Spinner--colorInkLightest Polaris-Spinner--sizeSmall" aria-label="Loading" role="status"><path d="M7.229 1.173a9.25 9.25 0 1 0 11.655 11.412 1.25 1.25 0 1 0-2.4-.698 6.75 6.75 0 1 1-8.506-8.329 1.25 1.25 0 1 0-.75-2.385z"></path></svg>';
|
||||
/****************************
|
||||
* SOME COMMON SVG CONSTANT*
|
||||
****************************/
|
||||
|
||||
/*
|
||||
*
|
||||
* @param string $message
|
||||
* @returns {undefined} show flash message
|
||||
*/
|
||||
function flashNotice($message, $class) {
|
||||
$class = ($class != undefined) ? $class : '';
|
||||
var flashMsgHtml = '<div class="inline-flash-wrapper animated bounceInUp inline-flash-wrapper--is-visible ourFlashMsg"><div class="inline-flash ' + $class + ' "><p class="inline-flash__message">' + $message + '</p></div></div>';
|
||||
if ($('.ourFlashMsg').length) {
|
||||
$('.ourFlashMsg').remove();
|
||||
}
|
||||
$("body").append(flashMsgHtml);
|
||||
setTimeout(function () {
|
||||
if ($('.ourFlashMsg').length) {
|
||||
$('.ourFlashMsg').remove();
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
/*
|
||||
* @param {string} $className
|
||||
* @returns {undefined} show loader
|
||||
*/
|
||||
function loading_show($selector) {
|
||||
$($selector).addClass("Polaris-Button--loading").html('<span class="Polaris-Button__Content"><span class="Polaris-Button__Spinner">' + SVG_LOADER + '</span><span>Loading</span></span>').fadeIn('fast').attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} $className
|
||||
* @param {string} $buttonName
|
||||
* @returns {undefined} hide loader
|
||||
*/
|
||||
function loading_hide($selector, $buttonName, $buttonIcon) {
|
||||
if ($buttonIcon != undefined) {
|
||||
$buttonIcon = '<span class="Polaris-Button__Icon"><span class="Polaris-Icon">' + $buttonIcon + '</span></span>'
|
||||
} else {
|
||||
$buttonIcon = '';
|
||||
}
|
||||
|
||||
$($selector).removeClass("Polaris-Button--loading").html('<span class="Polaris-Button__Content">' + $buttonIcon + '<span>' + $buttonName + '</span></span>').removeAttr("disabled");
|
||||
}
|
||||
|
||||
$(document).on('click', '.close-message', function () {
|
||||
$('.remove-sucees-message').hide();
|
||||
});
|
||||
|
||||
|
||||
|
||||
function removeCode(thisObj, data_key) {
|
||||
var current = $(thisObj);
|
||||
var btnText = current.html();
|
||||
loading_show(current);
|
||||
var deleteAjax = function deleteAjax(){
|
||||
loading_show(thisObj);
|
||||
$.ajax({
|
||||
url: "ajax_actions.php",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {method_name: 'remove_code', data_key: data_key, shop: shop},
|
||||
success: function (response) {
|
||||
if (response['result'] == 'success') {
|
||||
flashNotice(response['msg']);
|
||||
$('.remove-sucees-message').show();
|
||||
$('.remove-sucees-message').css({'display': 'flex'});
|
||||
}
|
||||
loading_hide(current, btnText);
|
||||
},
|
||||
error: function () {
|
||||
flashNotice('Please try again!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(mode == 'live'){
|
||||
ShopifyApp.Modal.confirm({
|
||||
title: 'Uninstall',
|
||||
message: 'Are you sure you want to remove? This action cannot be reversed.',
|
||||
okButton: 'Delete',
|
||||
cancelButton: 'Cancel',
|
||||
style: "danger"
|
||||
}, function (result) {
|
||||
if (result) {
|
||||
$('.ui-button.close-modal.btn-destroy-no-hover').addClass("ui-button ui-button--destructive js-btn-loadable is-loading disabled");
|
||||
deleteAjax();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
var r = confirm('Are you sure you want to remove? This action cannot be reversed.');
|
||||
if (r == true) {
|
||||
deleteAjax();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggleCheckedVal(switchval,userdomain,useremail,datakey){
|
||||
$.ajax({
|
||||
url: "ajax_actions.php",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {method_name: 'change_appStatus', data_status: switchval, user_name:userdomain, user_email:useremail, data_key:datakey, shop: shop},
|
||||
beforeSend: function(){
|
||||
$('#myonoffswitch').prop('disabled', true);
|
||||
},
|
||||
complete: function(){
|
||||
$('#myonoffswitch').prop('disabled', false);
|
||||
},
|
||||
success: function (response) {
|
||||
if (response['result'] == 'success') {
|
||||
$(".enable-banner").html(response['msg']);
|
||||
$('#user_key').val(response['key']);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
flashNotice('Please try again!','error');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
11
assets/js/index.html
Normal file
11
assets/js/index.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
4
assets/js/jquery-2.1.1.min.js
vendored
Normal file
4
assets/js/jquery-2.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue