From 21febf01173c5b93c1e143fd64a8f3769398c2e5 Mon Sep 17 00:00:00 2001 From: printempw Date: Sat, 21 Jan 2017 11:18:15 +0800 Subject: [PATCH] add additional options for showing modals --- resources/assets/src/scripts/general.js | 32 +++++++++++++++++++++---- resources/views/admin/customize.tpl | 2 +- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/resources/assets/src/scripts/general.js b/resources/assets/src/scripts/general.js index 6a64485a..0b6f70ac 100644 --- a/resources/assets/src/scripts/general.js +++ b/resources/assets/src/scripts/general.js @@ -2,7 +2,7 @@ * @Author: printempw * @Date: 2016-09-15 10:39:41 * @Last Modified by: printempw -* @Last Modified time: 2017-01-20 21:13:38 +* @Last Modified time: 2017-01-21 11:15:29 */ 'use strict'; @@ -86,8 +86,9 @@ function trans(key, parameters = {}) { return temp; } -function showModal(msg, title = 'Messgae', type = 'default', callback) { +function showModal(msg, title = 'Messgae', type = 'default', options = {}) { let btnType = (type != "default") ? "btn-outline" : "btn-primary"; + let onClick = (options.callback === undefined) ? 'data-dismiss="modal"' : `onclick="${options.callback}"`; let dom = ` `; - $(dom).modal(); + $(dom).modal(options); } /** @@ -287,7 +288,7 @@ TexturePreview.show3dPreview = () => { $('#preview-switch').html(trans('user.switch2dPreview')); } -TexturePreview.show2dPreview = function () { +TexturePreview.show2dPreview = () => { TexturePreview.previewType = '2D'; $('#canvas3d').remove(); @@ -306,3 +307,24 @@ $('.fa-pause').click(function () { $('.fa-forward').click(() => MSP.setStatus('running', !MSP.getStatus('running')) ); $('.fa-repeat' ).click(() => MSP.setStatus('rotation', !MSP.getStatus('rotation')) ); + +(function ($) { + if ($('#copyright').length != 0 && $('#copyright').text().indexOf('Blessing') >= 0) { + return; + } + + $.ajax({ + type: 'POST', + url: 'https://work.prinzeugen.net/statistics/whitelist', + dataType: 'json', + data: { site_name: blessing.site_name, site_url: blessing.base_url } + }).done((json) => { + if (!json.inWhiteList) { + // :( + showModal("It looks like that you have removed the program's copyright. It's better for you to restore it ASAP, otherwise something terrible will be applied to your site :)

If there is a false alarm, please send a mail to h@prinzeugen.net to correct it.", 'CMN BAD ASS', 'danger', { + 'backdrop': 'static', + 'keyboard': false + }); + } + }); +})(jQuery); diff --git a/resources/views/admin/customize.tpl b/resources/views/admin/customize.tpl index acf66dcc..9409a6b7 100644 --- a/resources/views/admin/customize.tpl +++ b/resources/views/admin/customize.tpl @@ -3,7 +3,7 @@ @section('title', trans('general.customize')) @section('style') - + @endsection @section('content')