diff --git a/admin/customize_settings_native.php b/admin/customize_settings_native.php index c64b8d1a09..8130429cf1 100644 --- a/admin/customize_settings_native.php +++ b/admin/customize_settings_native.php @@ -1,4 +1,4 @@ - +
@@ -10,7 +10,7 @@
- " class="form-control" type="text" value="getWebSiteTitle(); ?>" maxlength="45" > + " class="form-control" type="text" value="getWebSiteTitle(); ?>" maxlength="45">
@@ -28,7 +28,7 @@
- +
@@ -38,14 +38,15 @@ var logoCrop; var logoSmallCrop; var theme; + function readFile(input, c) { console.log("read file"); if ($(input)[0].files && $(input)[0].files[0]) { var reader = new FileReader(); - reader.onload = function (e) { + reader.onload = function(e) { c.croppie('bind', { url: e.target.result - }).then(function () { + }).then(function() { console.log('jQuery bind complete'); }); @@ -59,25 +60,25 @@ var logoImgBase64; - $(document).ready(function () { + $(document).ready(function() { // start croppie logo - $('#logo').on('change', function () { + $('#logo').on('change', function() { readFile(this, logoCrop); }); - $('#logo-btn').on('click', function (ev) { + $('#logo-btn').on('click', function(ev) { $('#logo').trigger("click"); }); - $('#logo-result-btn').on('click', function (ev) { + $('#logo-result-btn').on('click', function(ev) { logoCrop.croppie('result', { type: 'canvas', size: 'viewport' - }).then(function (resp) { + }).then(function(resp) { }); }); logoCrop = $('#croppieLogo').croppie({ - url: 'getLogo(); ?>?'+Math.random(), + url: 'getLogo(); ?>?' + Math.random(), enableExif: true, enforceBoundary: false, mouseWheelZoom: false, @@ -90,40 +91,40 @@ height: 70 } }); - setTimeout(function () { + setTimeout(function() { logoCrop.croppie('setZoom', 1); }, 1000); - $('#updateConfigForm').submit(function (evt) { + $('#updateConfigForm').submit(function(evt) { evt.preventDefault(); modal.showPleaseWait(); $('#tabRegularLink').tab('show'); - - logoCrop.croppie('result', { - type: 'canvas', - size: 'viewport' - }).then(function (resp) { - logoImgBase64 = resp; - - $.ajax({ - url: webSiteRootURL+'admin/customize_settings_nativeUpdate.json.php', - data: { - "logoImgBase64": logoImgBase64, - "webSiteTitle": $('#inputWebSiteTitle').val(), - }, - type: 'post', - success: function (response) { - if (response.status === "1") { - avideoAlert("", "", "success"); - } else { - avideoAlert("", "", "error"); + setTimeout(function() { + logoCrop.croppie('result', { + type: 'canvas', + size: 'viewport' + }).then(function(resp) { + logoImgBase64 = resp; + $.ajax({ + url: webSiteRootURL + 'admin/customize_settings_nativeUpdate.json.php', + data: { + "logoImgBase64": logoImgBase64, + "webSiteTitle": $('#inputWebSiteTitle').val(), + }, + type: 'post', + success: function(response) { + if (response.status === "1") { + avideoAlertSuccess( __("Your configurations has been updated!")); + } else { + avideoAlertError(__("Your configurations has NOT been updated!")); + } + modal.hidePleaseWait(); } - modal.hidePleaseWait(); - } + }); }); - }); + }, 500); }); }); - + \ No newline at end of file diff --git a/view/configurations_body.php b/view/configurations_body.php index 46b101ba68..6166475349 100644 --- a/view/configurations_body.php +++ b/view/configurations_body.php @@ -727,60 +727,60 @@ if (User::isAdmin()) { evt.preventDefault(); modal.showPleaseWait(); $('#tabRegularLink').tab('show'); + setTimeout(function() { - logoCrop.croppie('result', { - type: 'canvas', - size: 'viewport' - }).then(function(resp) { - logoImgBase64 = resp; - - faviconCrop.croppie('result', { + logoCrop.croppie('result', { type: 'canvas', size: 'viewport' }).then(function(resp) { - faviconBase64 = resp; - - $.ajax({ - url: webSiteRootURL + 'objects/configurationUpdate.json.php', - data: { - "logoImgBase64": logoImgBase64, - "faviconBase64": faviconBase64, - "video_resolution": $('#inputVideoResolution').val(), - "webSiteTitle": $('#inputWebSiteTitle').val(), - "description": $('#inputWebSiteDescription').val(), - "language": $('#inputLanguage').val(), - "contactEmail": $('#inputEmail').val(), - "authCanUploadVideos": $('#authCanUploadVideos').val(), - "authCanViewChart": $('#authCanViewChart').val(), - "authCanComment": $('#authCanComment').val(), - "head": $('#head').val(), - "adsense": $('#adsense').val(), - "disable_analytics": $('#disable_analytics').prop("checked"), - "allow_download": $("#allow_download").prop("checked"), - "session_timeout": $('#session_timeout').val(), - "autoplay": $('#autoplaySwitch').prop("checked"), - "theme": theme, - "smtp": $('#enableSmtp').prop("checked"), - "smtpAuth": $('#enableSmtpAuth').prop("checked"), - "smtpSecure": $('#smtpSecure').val(), - "smtpHost": $('#smtpHost').val(), - "smtpUsername": $('#smtpUsername').val(), - "smtpPassword": $('#smtpPassword').val(), - "smtpPort": $('#smtpPort').val(), - "encoder_url": $('#encoder_url').val(), - }, - type: 'post', - success: function(response) { - if (response.status === "1") { - avideoAlert("", "", "success"); - } else { - avideoAlert("", "", "error"); + logoImgBase64 = resp; + faviconCrop.croppie('result', { + type: 'canvas', + size: 'viewport' + }).then(function(resp) { + faviconBase64 = resp; + $.ajax({ + url: webSiteRootURL + 'objects/configurationUpdate.json.php', + data: { + "logoImgBase64": logoImgBase64, + "faviconBase64": faviconBase64, + "video_resolution": $('#inputVideoResolution').val(), + "webSiteTitle": $('#inputWebSiteTitle').val(), + "description": $('#inputWebSiteDescription').val(), + "language": $('#inputLanguage').val(), + "contactEmail": $('#inputEmail').val(), + "authCanUploadVideos": $('#authCanUploadVideos').val(), + "authCanViewChart": $('#authCanViewChart').val(), + "authCanComment": $('#authCanComment').val(), + "head": $('#head').val(), + "adsense": $('#adsense').val(), + "disable_analytics": $('#disable_analytics').prop("checked"), + "allow_download": $("#allow_download").prop("checked"), + "session_timeout": $('#session_timeout').val(), + "autoplay": $('#autoplaySwitch').prop("checked"), + "theme": theme, + "smtp": $('#enableSmtp').prop("checked"), + "smtpAuth": $('#enableSmtpAuth').prop("checked"), + "smtpSecure": $('#smtpSecure').val(), + "smtpHost": $('#smtpHost').val(), + "smtpUsername": $('#smtpUsername').val(), + "smtpPassword": $('#smtpPassword').val(), + "smtpPort": $('#smtpPort').val(), + "encoder_url": $('#encoder_url').val(), + }, + type: 'post', + success: function(response) { + if (response.status === "1") { + avideoAlertSuccess(__("Your configurations has been updated!")); + } else { + avideoAlertError(__("Your configurations has NOT been updated!")); + } + modal.hidePleaseWait(); } - modal.hidePleaseWait(); - } + }); }); }); - }); + }, 500); });