diff --git a/application/configs/application.ini b/application/configs/application.ini index a5c24da3b..9c1b8edc7 100644 --- a/application/configs/application.ini +++ b/application/configs/application.ini @@ -1,362 +1,362 @@ [production] -version = "v1.91" +version = "v1.92" ;phpSettings.date.timezone = "America/New_York" phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 resources.frontController.params.displayExceptions = 0 includePaths.library = APPLICATION_PATH "/../library" autoloaderNamespaces[] = "Local_" autoloaderNamespaces[] = "Ppload_" autoloaderNamespaces[] = "Crontab_" autoloaderNamespaces[] = "Cgsmith" bootstrap.path = APPLICATION_PATH "/modules/default/Bootstrap.php" bootstrap.class = "Bootstrap" resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.frontController.defaultModule = "default" resources.frontController.baseurl = "/" resources.modules[] = resources.layout.layout = "flat_ui_template" resources.layout.layoutPath = APPLICATION_PATH "/modules/default/views/layout" resources.view[] = resources.view.encoding = "UTF-8" resources.view.doctype = "XHTML5" resources.view.contentType = "text/html;charset=utf-8" resources.locale.default = "en_US" resources.locale.force = false resources.locale.registry_key = "Zend_Locale" resources.db.adapter = "pdo_mysql" resources.db.params.host = "host" resources.db.params.username = "uname" resources.db.params.password = "pass" resources.db.params.dbname = "dbname" resources.db.params.charset = "utf8" resources.db.params.type = "pdo_mysql" resources.db.params.driver_options.1002 = "SET NAMES utf8" resources.db.isDefaultTableAdapter = true resources.mail.transport.type = Zend_Mail_Transport_Smtp resources.mail.transport.host = "email-host" resources.mail.transport.port = 587 resources.mail.transport.auth = "login" resources.mail.transport.username = "uname" resources.mail.transport.password = "pass" resources.mail.transport.ssl = "tls" resources.mail.defaultFrom.email = from@ocs-webserver.org resources.mail.defaultFrom.name = "ocs-webserver.org" resources.mail.defaultReplyTo.email = contact@ocs-webserver.org resources.mail.defaultReplyTo.name = "ocs-webserver.org" resources.translate.registry_key = "Zend_Translate" resources.translate.adapter = array resources.translate.options.scan = "directory" resources.translate.locale = "en_US" resources.translate.data.de_DE = APPLICATION_DATA "/locales/de_DE.php" resources.translate.data.en_US = APPLICATION_DATA "/locales/en_US.php" resources.translate.data.zh_CN = APPLICATION_DATA "/locales/zh_CN.php" queue.validate.name = "website_validate" queue.validate.dbAdapter = "Local_Queue_Adapter_Db" queue.validate.messageAdapter = "Local_Queue_Adapter_Db_Message" queue.validate.maxMessages = 1 images.upload.path = APPLICATION_PATH "/../httpdocs/img/data/" images.media.server = "http://cn.ocs-webserver.org" images.media.upload = "http://cn.ocs-webserver.org/image_bucket_upload.php" third_party.paypal.sandbox.active = 0 third_party.paypal.security.userid = "ppuid" third_party.paypal.security.password = "pppass" third_party.paypal.security.signature = "ppsig" third_party.paypal.facilitator_fee_receiver = "receiver@mail.com" third_party.paypal.facilitator_fee = 0 third_party.paypal.application.id = "APP-ID" third_party.paypal.api.endpoint = "https://svcs.paypal.com" third_party.paypal.form.endpoint = "https://ic.paypal.com" third_party.paypal.ipn.endpoint = "https://www.paypal.com" third_party.paypal.masspay.endpoint = "https://api-3t.paypal.com/nvp" third_party.paypal.masspay.ipn.endpoint = "https://ipnpb.paypal.com/cgi-bin" third_party.paypal.service.version = "1.2.0" third_party.paypal.request.data.format = "NV" third_party.paypal.response.data.format = "NV" third_party.paypal.client.auth = "Nocert" third_party.paypal.client.application_id = "app" third_party.paypal.client.partner_name = "partner" third_party.paypal.merchantid = 0 third_party.dwolla.consumer.access_key = "key" third_party.dwolla.consumer.access_secret = "sec" third_party.dwolla.consumer.token = "token" third_party.dwolla.api.endpoint = "https://www.dwolla.com" third_party.dwolla.facilitator_fee = 0 third_party.github.client_id = "" third_party.github.client_secret = "" third_party.github.client_callback = $_SERVER['HTTP_HOST'] "/oauth/github" third_party.ocs.client_id = "" third_party.ocs.client_secret = "" third_party.ocs.client_callback = $_SERVER['HTTP_HOST'] "/oauth/ocs" ; ppload third_party.ppload.server = "https://www.ocs-fileserver.org" third_party.ppload.api_uri = "https://www.ocs-fileserver.org/api/" third_party.ppload.client_id = "clientid" third_party.ppload.secret = "sec" third_party.ppload.download_secret = "sec" admin.email = "contact@ocs-webserver.org" website.tracking.chartbeat = "/js/tracking/chartbeat.js" website.tracking.google = "/js/tracking/goggle.js" settings.cache.path = APPLICATION_CACHE settings.log.path = APPLICATION_DATA "/logs/" settings.search.path = APPLICATION_DATA "/indexes/" phpSettings.session.name = "OcsWebserverId" phpSettings.session.save_path = APPLICATION_DATA "/sessions" phpSettings.session.cookie_httponly = true phpSettings.session.cookie_lifetime = 31536000 phpSettings.session.gc_maxlifetime = 7776000 settings.session.remember_me.name = "OcsWebserverRememberMe" settings.session.remember_me.cookie_lifetime = 31536000 settings.session.remember_me.cookie_httponly = true settings.session.auth.name = "OcsWebserverSession" settings.session.auth.cookie_lifetime = 31536000 settings.session.auth.cookie_path = "/" settings.session.auth.cookie_httponly = true settings.session.filter_browse_original = 'FilterBrowseOriginalSession' settings.session.saveHandler.replace.enabled = true settings.session.saveHandler.cache.type = "Libmemcached" settings.session.saveHandler.class = "Local_Session_Handler_Memcache" settings.session.saveHandler.options.servers.0.host = "memcachehost" settings.session.saveHandler.options.servers.0.port = 11211 settings.session.saveHandler.options.servers.0.persistent = true settings.session.saveHandler.options.servers.0.status = true settings.session.saveHandler.options.compression = true settings.cache.enabled = true settings.cache.frontend.type = Core settings.cache.frontend.options.lifetime = 600 settings.cache.frontend.options.automatic_serialization = true settings.cache.frontend.options.cache_id_prefix = "[some string]" settings.cache.frontend.options.cache = true settings.cache.backend.type = "Libmemcached" settings.cache.backend.options.servers.0.host = "memcachehost" settings.cache.backend.options.servers.0.port = 11211 settings.cache.backend.options.servers.0.persistent = true settings.cache.backend.options.servers.0.weight = 1 settings.cache.backend.options.servers.0.timeout = 5 settings.cache.backend.options.servers.0.retry_interval = 15 ; alternative backend file cache, if no memcache installed (only for development environments) ;settings.cache.backend.type = "File" ;settings.cache.backend.options.cache_dir = APPLICATION_CACHE ;settings.cache.backend.options.file_locking = true ;settings.cache.backend.options.read_control = true ;settings.cache.backend.options.read_control_type = 'crc32' ;settings.cache.backend.options.hashed_directory_level = 1 ;settings.cache.backend.options.hashed_directory_perm = 0700 ;settings.cache.backend.options.file_name_prefix = 'ocs' ;settings.cache.backend.options.cache_file_perm = 0700 settings.search.host = 'localhost' settings.search.port = '8983' settings.search.http_path = '/solr/opendesktop/' settings.client.default.name = 'default' settings.client.config.path = APPLICATION_PATH "/configs/" settings.client.default.baseurl = 'opendesktop.org' settings.client.default.baselogo = 'images/system/storeLogo.png' settings.client.default.url_forum = "" settings.client.default.url_blog = "" settings.client.default.url_gitlab = "" settings.client.default.url_myopendesktop = "" settings.client.default.url_cloudopendesktop = "" settings.client.default.url_musicopendesktop = "" settings.client.default.url_mastodon = "" settings.client.default.url_riot = "" settings.static.include_path = APPLICATION_PATH "/../httpdocs/partials/" settings.static.include.contact = "contact.phtml" settings.static.include.privacy = "privacy.phtml" settings.static.include.terms = "terms.phtml" settings.static.include.terms-general = "terms-general.phtml" settings.static.include.terms-publishing = "terms-publishing.phtml" settings.static.include.terms-dmca = "terms-dmca.phtml" settings.static.include.faq = "faq.phtml" settings.queue.general.name = "ocs_jobs" ; timeout in microseconds settings.queue.general.timeout = 600000 settings.queue.general.message_count = 1 settings.noLESScompile = 1 ; set it 1 to prevent that the LESS files are processed and dont forget to kill the cache. otherwise 0 to process less files. settings.savePageView = 1 ; in some server environment we don't want to store the page views. I this case set this value to 0. settings.dwh.db.adapter = "pdo_mysql" settings.dwh.db.params.host = "host" settings.dwh.db.params.username = "uname" settings.dwh.db.params.password = "pass" settings.dwh.db.params.dbname = "dbname" settings.dwh.db.params.charset = "utf8" settings.dwh.db.params.type = "pdo_mysql" settings.dwh.db.params.driver_options.1002 = "SET NAMES utf8" settings.dwh.db.isDefaultTableAdapter = false settings.server.oauth.authorize_url = "" settings.server.oauth.token_url = "" settings.server.oauth.callback = $_SERVER['HTTP_HOST'] "/oauth/ocs" settings.server.oauth.client_id = "" settings.server.oauth.client_secret = "" settings.server.oauth.create_user_url = "" settings.server.oauth.profile_user_url = "" settings.server.opencode.host = "" settings.server.opencode.user_logfilename = "opencode" settings.server.opencode.user_sudo = "" settings.server.opencode.user_agent = "OCS Opendesktop" settings.server.opencode.private_token = "" settings.server.opencode.url.user_create = "" settings.server.opencode.provider_name = "oauth_opendesktop" settings.server.ldap.host = "" settings.server.ldap.port = "389" settings.server.ldap.username = "" settings.server.ldap.password = "" settings.server.ldap.bindRequiresDn = true settings.server.ldap.accountDomainName = "" settings.server.ldap.baseDn = "" settings.server.ldap.accountFilterFormat = "(objectClass=account)" settings.server.ldap.tryUsernameSplit = false settings.server.ldap_group.baseDn = "" settings.server.forum.host = "" settings.server.forum.user_logfilename = "forum" settings.server.forum.user_sudo = "" settings.server.forum.user_agent = "OCS Opendesktop" settings.server.forum.private_token = "" settings.ocs_server.apiUri = "http://ocs-server.org" settings.jwt.secret = "hI12Q3p68831B9236767aq45D6125Y" settings.jwt.expire.accessToken = "2 hours" settings.jwt.expire.refreshToken = "180 days" settings.jwt.expire.cookie = "30 days" settings.jwt.expire.authorizationCode = "10 minutes" settings.jwt.expire.resetCode = "2 hours" settings.jwt.issuer_ident = "http://localhost:80" settings.domain.base.host = "www.example.com" settings.domain.forum.host = "forum.example.com" settings.domain.forum.cookie_name = "_t" settings.domain.openid.host = "id.example.com" settings.domain.openid.cookie_name = "ltat" settings.domain.opencode.host = "git.example.com" settings.domain.opencode.cookie_name = "_example.com_session" settings.domain.mastodon.host = "mastodon.example.com" [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 resources.frontController.params.displayExceptions = 1 resources.db.adapter = "pdo_mysql" resources.db.params.host = "dev-host" resources.db.params.username = "uname" resources.db.params.password = "pass" resources.db.params.dbname = "db" resources.db.params.charset = "utf8" resources.db.isDefaultTableAdapter = true ;resources.db.params.profiler.enabled = "true" ;resources.db.params.profiler.class = "Zend_Db_Profiler_Firebug" third_party.paypal.security.userid = "pp.sandbox.uid" third_party.paypal.security.password = "pppass" third_party.paypal.security.signature = "ppsig" third_party.paypal.sandbox.email = "sanbaox@mail.com" third_party.paypal.facilitator_fee_receiver = "sanbaox@mail.com" third_party.paypal.facilitator_fee = 0 third_party.paypal.application.id = "SANDBOX-APP-ID" third_party.paypal.api.endpoint = "https://svcs.sandbox.paypal.com" third_party.paypal.form.endpoint = "https://www.sandbox.paypal.com" third_party.paypal.ipn.endpoint = "https://www.sandbox.paypal.com" third_party.dwolla.consumer.access_key = "sandbox.key" third_party.dwolla.consumer.access_secret = "sandbox.sec" third_party.dwolla.consumer.token = "sandbox.token" third_party.dwolla.api.endpoint = "https://uat.dwolla.com" third_party.dwolla.facilitator_fee = 0 settings.noLESScompile = 0 ; set it 1 to prevent that the LESS files are processed and dont forget to kill the cache [testing : development] [cronjob : production] resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.frontController.defaultControllerName = "cron" resources.frontController.defaultAction = "run" resources.modules[] = resources.frontController.params.displayExceptions = 1 phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 third_party.paypal.sandbox.active = 0 third_party.paypal.security.userid = "ppuid" third_party.paypal.security.password = "pppass" third_party.paypal.security.signature = "ppsig" third_party.paypal.facilitator_fee_receiver = "receiver@mail.com" third_party.paypal.facilitator_fee = 0 third_party.paypal.application.id = "APP-ID" third_party.paypal.api.endpoint = "https://svcs.paypal.com" third_party.paypal.form.endpoint = "https://ic.paypal.com" third_party.paypal.ipn.endpoint = "https://www.paypal.com" third_party.paypal.masspay.endpoint = "https://api-3t.paypal.com/nvp" third_party.paypal.service.version = "1.2.0" third_party.paypal.request.data.format = "NV" third_party.paypal.response.data.format = "NV" third_party.paypal.client.auth = "Nocert" third_party.paypal.client.application_id = "app" third_party.paypal.client.partner_name = "partner" third_party.paypal.test = Live settings.cache.enabled = true settings.cache.frontend.type = Core settings.cache.frontend.options.lifetime = 600 settings.cache.frontend.options.automatic_serialization = true settings.cache.frontend.options.cache_id_prefix = "[some string]" settings.cache.frontend.options.cache = true settings.cache.backend.type = File settings.cache.backend.options.cache_dir = APPLICATION_CACHE settings.cache.backend.options.file_locking = true settings.cache.backend.options.read_control = true settings.cache.backend.options.read_control_type = 'crc32' settings.cache.backend.options.hashed_directory_level = 1 settings.cache.backend.options.hashed_directory_perm = 0700 settings.cache.backend.options.file_name_prefix = '[some string]' settings.cache.backend.options.cache_file_perm = 0700 [searchbotenv : production] resources.frontController.params.displayExceptions = 0 phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 diff --git a/httpdocs/theme/flatui/js/script.js b/httpdocs/theme/flatui/js/script.js index 52cb72cfc..6af2ce866 100644 --- a/httpdocs/theme/flatui/js/script.js +++ b/httpdocs/theme/flatui/js/script.js @@ -1,2438 +1,2438 @@ /** * ocs-webserver * * Copyright 2016 by pling GmbH. * * This file is part of ocs-webserver. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . **/ var newProductPage = (function () { return { setup: function () { function adjustScrollableContentHeight() { var pling_box_height = $('#pling-it-box').height(); $('.scrollable-content').height(pling_box_height); $('.scrollable-content').jScrollPane({ mouseWheelSpeed: 30 }); } function adjustSupportersHeight() { var comments_height = $('#donations-panel').find('#comments').height(); var supporters_height = $('#donations-panel').find('#supporters').height(); if (comments_height > supporters_height) { $('#donations-panel').find('#supporters').height(comments_height); } } $(document).ready(function () { adjustScrollableContentHeight(); adjustSupportersHeight(); $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { adjustSupportersHeight(); }); }); } } })(); // only instantiate when needed to instantiate: var ImagePreview = { hasError: false, setup: function () { this.initProductPicture(); this.initTitlePicture(); this.initProfilePicture(); this.initProfilePictureBackground(); }, previewImage: function (input, img_id) { if (input.files && input.files[0]) { var reader = new FileReader(); var image = new Image(); var file = input.files[0]; reader.readAsDataURL(input.files[0]); reader.onload = function (_image) { var image_element = $('#' + img_id); image.src = _image.target.result; // url.createObjectURL(file); image.onload = function () { var w = this.width, h = this.height, t = file.type, // ext only: // file.type.split('/')[1], n = file.name, s = ~~(file.size / 1024); // + 'KB' ImagePreview.hasError = false; image_element.parent().parent().find('div.bg-danger').remove(); if (w > 2000 || w < 20 || h > 2000 || h < 20) { //image_element.attr('src', '').hide().parent().append('
Wrong image dimensions
'); image_element.parent().parent().append('
Wrong image dimensions
'); //input.val(null); //$(input).replaceWith(input = $(input).clone(true)); $($(input).closest('form')[0]).trigger('reset'); ImagePreview.hasError = true; } if (s > 2000) { //image_element.attr('src', '').hide().parent().append('
File too large
'); image_element.parent().parent().append('
File too large
'); //input.val(null); //$(input).replaceWith(input = $(input).clone(true)); $($(input).closest('form')[0]).trigger('reset'); ImagePreview.hasError = true; } var allowedExtensions = /(jpg|jpeg|png|gif)$/i; if(!allowedExtensions.exec(t)) { image_element.parent().parent().append('
Invalid file type: ' + file.type + '
'); //input.val(null); //$(input).replaceWith(input = $(input).clone(true)); $($(input).closest('form')[0]).trigger('reset'); ImagePreview.hasError = true; } if (false == ImagePreview.hasError) { ImagePreview.hasError = false; image_element.attr('src', _image.target.result); image_element.show(); } }; image.onerror = function () { image_element.parent().parent().find('div.bg-danger').remove(); image_element.parent().parent().append('
Invalid file type: ' + file.type + '
'); }; //image_element.attr('src', _image.target.result); //image_element.show(); if (img_id == 'product-picture-preview') { $('button#add-product-picture').text('CHANGE LOGO'); } else if (img_id == 'title-picture-preview') { $('button#add-title-picture').text('CHANGE BANNER'); } else if (img_id == 'profile-picture-preview') { $('button#add-profile-picture').text('CHANGE PICTURE'); $('input#profile_img_src').val('local'); } else if (img_id == 'profile-picture-bg-preview') { $('button#add-profile-picture-background').text('CHANGE PICTURE'); } }; } }, previewImageMember: function (input, img_id) { if (input.files && input.files[0]) { var reader = new FileReader(); var image = new Image(); var file = input.files[0]; reader.readAsDataURL(input.files[0]); reader.onload = function (_image) { var image_element = $('#' + img_id); image.src = _image.target.result; // url.createObjectURL(file); image.onload = function () { ImagePreview.hasError = false; image_element.parent().find('.image-error').remove(); if (false == ImagePreview.hasError) { image_element.attr('src', _image.target.result); image_element.show(); } }; image.onerror = function () { image_element.parent().append('
Invalid file type
'); }; if (img_id == 'profile-picture-background-preview') { $('button#add-profile-picture-background').text('CHANGE PICTURE'); } }; } }, readImage: function (file) { var reader = new FileReader(); var image = new Image(); reader.readAsDataURL(file); reader.onload = function (_file) { image.src = _file.target.result; // url.createObjectURL(file); image.onload = function () { var w = this.width, h = this.height, t = file.type, // ext only: // file.type.split('/')[1], n = file.name, s = ~~(file.size / 1024) + 'KB'; $('#uploadPreview').append(' ' + w + 'x' + h + ' ' + s + ' ' + t + ' ' + n + '
'); }; image.onerror = function () { alert('Invalid file type: ' + file.type); }; }; }, initProductPicture: function () { if ($('#image_small').length == 0) { return; } if ($('#image_small').attr('value').length == 0) { return; } var imageTarget = $('#image_small').data('target'); $(imageTarget).attr('src', 'https://cn.opendesktop.org/cache/200x200-2/img/' + $('#image_small').attr('value')); $(imageTarget).show(); $('button#add-product-picture').text('CHANGE LOGO'); }, initTitlePicture: function () { if ($('#image_big').length == 0) { return; } if ($('#image_big').attr('value').length == 0) { return; } var imageTarget = $('#image_big').data('target'); $(imageTarget).attr('src', 'https://cn.opendesktop.org/cache/200x200-2/img/' + $('#image_big').attr('value')); $(imageTarget).show(); $('button#add-title-picture').text('CHANGE BANNER'); }, initProfilePicture: function () { if ($('#profile_image_url').length == 0) { return; } if ($('#profile_image_url').attr('value').length == 0) { return; } var imageTarget = $('#profile_image_url').data('target'); $(imageTarget).attr('src', $('#profile_image_url').attr('value')); $('#profile-picture').attr('src', $('#profile_image_url').attr('value')); $(imageTarget).show(); $('button#add-profile-picture').text('CHANGE PICTURE'); }, initProfilePictureBackground: function () { if ($('#profile_image_url_bg').length == 0) { return; } if ($('#profile_image_url_bg').attr('value').length == 0) { return; } var imageTarget = $('#profile_image_url_bg').data('target'); $(imageTarget).attr('src', $('#profile_image_url_bg').attr('value')); $('#profile-picture-background-preview').attr('src', $('#profile_image_url_bg').attr('value')); $(imageTarget).show(); $('button#add-profile-picture-background').text('CHANGE PICTURE'); } }; var MenuHover = (function () { return { setup: function () { $('body').on('click', 'a#login-dropdown', function (event) { event.stopPropagation(); $('.header-login-container').toggleClass('active'); }).on('click', '.header-login-container', function (event) { event.stopPropagation(); }).on('click', 'a.menu-trigger', function (event) { event.stopPropagation(); var html_menu_element = '.' + $(this).attr('rel'); $(html_menu_element).toggleClass('active'); }).on('mouseup', function (event) { var container = $('ul.profile-menu'); var trigger = $('li.profile-menu-container a.menu-trigger'); if (trigger.is(event.target)) { return; } if (!container.is(event.target) // if the target of the click isn't the container... && container.has(event.target).length === 0) // ... nor a descendant of the container { container.removeClass('active'); } }).on('mouseup', function (event) { container = $('div.header-login-container'); trigger = $('a#login-dropdown'); if (trigger.is(event.target)) { return; } if (!container.is(event.target) // if the target of the click isn't the container... && container.has(event.target).length === 0) // ... nor a descendant of the container { container.removeClass('active'); } }).click(function () { $('.header-login-container.active').removeClass('active'); $('.profile-menu.active').removeClass('active'); }); } }; })(); var ButtonCode = (function () { return { setup: function () { $('#button-code-heading').click(function () { if ($(this).hasClass('button-code-active')) { $(this).removeClass('button-code-active'); $(this).parent().find('.button-code').slideUp('fast'); $(this).parent().find('.button-code').css('border-bottom', 'none'); $(this).find('.icon-expand-code').css('background-image', 'url(img/icon-expand.png)'); } else { $(this).addClass('button-code-active'); $(this).parent().find('.button-code').css('border-bottom', '1px solid #bdc3c7'); $(this).parent().find('.button-code').slideDown('fast'); $(this).find('.icon-expand-code').css('background-image', 'url(img/icon-contract.png)'); } }) }, setupClipboardCopy: function (containerId) { $(containerId).on('mouseover', function () { $(this).off('mouseover'); $(this).find('[data-clipboard-target]').each(function () { var clipboardTarget = $($(this).attr('data-clipboard-target')); $(this).zclip({ path: '/theme/flatui/js/lib/ZeroClipboard.swf', copy: $.trim($(clipboardTarget).text()) }); }); }); } }; })(); var ProductPage = (function () { return { setup: function () { $(".dropdown-toggle").dropdown(); $('.scroll-pane').jScrollPane({ mouseWheelSpeed: 30, animateScroll: true }); $('.love-it').on('click', function () { this_img_src = $(this).find('img').attr('src'); if (!$(this).hasClass('no-login') && this_img_src != '/theme/flatui/img/icon-like-color.png') { $(this).prev('.share-it').trigger('click'); } }); $('.payment-options').find('.options').find('span.option').on('click', function () { var this_number = $(this).attr('title'); var number_input = $('.payment-options').find('input[type="number"]'); number_input.attr('value', this_number).val(this_number); number_input.focus(); $('.options').find('.selected').removeClass('selected'); $(this).addClass('selected'); }); }, setupPlingButton: function () { $('#pling-amount').on('focus', function () { $('#pling-amount').popover('destroy'); }); $('#pling-start').on('click', function (event) { validateElement = $('#pling-amount'); validateValue = validateElement.val(); if (validateValue == '' || (isNaN(parseFloat(validateValue)) || !isFinite(validateValue))) { event.preventDefault(); $('#pling-amount').popover({ placement: 'bottom', html: 'true', content: '
Donation must be a numeric value.
' }).popover('show'); return false; } minValue = validateElement.attr('min'); if (parseFloat(validateValue) < parseFloat(minValue)) { event.preventDefault(); $('#pling-amount').popover({ placement: 'bottom', html: 'true', content: '
Donation must be equal or greater than ' + minValue + '.
' }).popover('show'); return false; } maxValue = validateElement.attr('max'); if (parseFloat(validateValue) > parseFloat(maxValue)) { event.preventDefault(); $('#pling-amount').popover({ placement: 'bottom', html: 'true', content: '
Donation must be smaller or equal than ' + maxValue + '.
' }).popover('show'); return false; } }); function minmax(value, min, max) { if (parseInt(value) < 0 || isNaN(value)) return 0; else if (parseInt(value) > 100) return 100; else return value; } } } })(); var SlideShowRender = (function () { return { setup: function () { // add the active class to the first image $('#slideshow-container').find('img:first').addClass('active'); $('#slideshow-container').find('#navigation').find('a:first').addClass('active'); // trigger slideshow //SlideShow.setup(); } } })(); var ProductSlideShow = (function () { return { setup: function () { // arrows function $('#slideshow-container').find('#arrows').find('a').on('click', function (e) { var this_id = $(this).attr('id'); var slides = $('#slideshow-container #slides'); var current_img = slides.find('img.active'); var current_img_rel = current_img.attr('rel'); var current_nav_link = $('#slideshow-container').find('#navigation').find('a.active'); if (this_id == 'prev') { var prev_img_rel = parseInt(current_img_rel) - parseInt(1); var next_active_img = $('#slideshow-container').find('img[rel="' + prev_img_rel + '"]'); var next_active_nav_link = $('#slideshow-container').find('#navigation').find('a[rel="' + prev_img_rel + '"]'); if (!next_active_img.size() == 1) { var next_active_img = slides.find('img:last'); var next_active_nav_link = $('#slideshow-container').find('#navigation').find('a:last'); } } else if (this_id == 'next') { var next_img_rel = parseInt(current_img_rel) + parseInt(1); var next_active_img = $('#slideshow-container').find('img[rel="' + next_img_rel + '"]'); var next_active_nav_link = $('#slideshow-container').find('#navigation').find('a[rel="' + next_img_rel + '"]'); if (!next_active_img.size() == 1) { var next_active_img = slides.find('img:first'); var next_active_nav_link = $('#slideshow-container').find('#navigation').find('a:first'); } } current_img.removeClass('active'); current_nav_link.removeClass('active'); next_active_img.addClass('active'); next_active_nav_link.addClass('active'); //clearTimeout(slideShowInterval); //SlideShow.setup(); }); // navigation function $('#slideshow-container').find('#navigation').find('a').on('click', function () { var this_rel = $(this).attr('rel'); var this_image = $('#slideshow-container').find('img[rel="' + this_rel + '"]'); $('#slideshow-container').find('img.active').removeClass('active'); this_image.addClass('active'); $('#slideshow-container').find('#navigation').find('a.active').removeClass('active'); $(this).addClass('active'); }); } } })(); var SlideShow = (function () { return { setup: function () { slideShowInterval = setTimeout(function () { var current_img = $('#slideshow-container').find('img.active'); var current_img_rel = current_img.attr('rel'); var next_img_rel = parseInt(current_img_rel) + parseInt(1); var next_img = $('#slideshow-container').find('img[rel="' + next_img_rel + '"]'); var current_nav_link = $('#slideshow-container').find('#navigation').find('a.active'); current_img.removeClass('active'); current_nav_link.removeClass('active'); if (next_img.size() == 1) { next_img.addClass('active'); $('#slideshow-container').find('#navigation').find('a[rel="' + next_img_rel + '"]').addClass('active'); } else { $('#slideshow-container').find('img:first').addClass('active'); $('#slideshow-container').find('#navigation').find('a:first').addClass('active'); } //SlideShow.setup(); }, 4000); } } })(); var Popuppanel = (function () { return { setup: function () { $('body').on('click', 'a.popuppanel', function (event) { if ($(this).attr('target') === "_blank"){ console.log('dont prevent default'); } else { event.preventDefault(); var hf = $(this).attr('href'); $.fancybox({ 'hideOnContentClick': true, 'autoScale': true, 'cyclic': 'true', 'transitionIn': 'elastic', 'transitionOut': 'elastic', 'type': 'iframe', 'scrolling': 'auto', helpers: { overlay: { locked: false } }, autoSize: true, href: hf, type: 'ajax' }); } }); } } })(); var PlingsRedirect = (function () { return { setup: function () { if(window.location.hash) { $link = $(window.location.hash); $link.trigger("click"); } else if (document.location.hash) { $link = $(document.location.hash); $link.trigger("click"); } } } })(); var ShowPopups = (function () { return { setup: function () { if(window.location.hash) { alert('Hash'); $('a[href="' + document.location.hash + '"]').trigger("click"); } if (document.location.hash) { alert('Hash'); $('a[href="' + document.location.hash + '"]').trigger("click"); } } } })(); /** PRODUCT PAGE **/ // tool tips $('body').on('mouseenter', '.supporter-thumbnail', function () { $(this).popover('show'); }); $('body').on('mouseleave', '.supporter-thumbnail', function () { $(this).popover('hide'); }); var Partials = (function () { return { setup: function () { $('body').on('click', 'a.partial', function (event) { event.preventDefault(); var url = this.href; var target = $(this).attr("data-target"); var toggle = $(this).data('toggle'); var pageFragment = $(this).attr("data-fragment"); $(target).load(url + ' ' + pageFragment, function (response, status, xhr) { if (status == "error") { if (xhr.status == 401) { if (response) { var data = jQuery.parseJSON(response); var redirect = data.login_url; if (redirect) { window.location = redirect; } else { window.location = "/login"; } } } else { $(target).empty().html('Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.'); } } if (toggle) { $(toggle).modal('show'); } }); return false; }); } } })(); var Opendownloadfile= (function () { return { setup: function () { $('body').on('click', 'a.opendownloadfile', function (event) { event.preventDefault(); var file_id = $(this).attr("data-file_id"); var file_type = $(this).attr('data-file_type'); var file_name = $(this).attr('data-file_name'); var file_size = $(this).attr('data-file_size'); var project_id = $(this).attr('data-project_id'); var link_type = $(this).attr('data-link_type'); $.fancybox({ 'hideOnContentClick': true, 'autoScale': true, 'scrolling' : 'no', 'cyclic': 'true', 'transitionIn': 'elastic', 'transitionOut': 'elastic', 'type': 'iframe', 'width':'600', - 'height':'400', + 'height':'350', 'iframe': {'scrolling': 'no'}, 'autoSize':false, 'id': 'opendownloadfilepopup', helpers: { overlay: { locked: false } }, href:'/dl?file_id='+file_id+'&file_type='+file_type+'&file_name='+file_name+'&file_size='+file_size+'&project_id='+project_id+'&link_type='+link_type }); return false; }); } } })(); var PartialsButton = (function () { return { setup: function () { $('body').on('click', 'Button.partialbutton', function (event) { event.preventDefault(); var url = $(this).attr("data-href"); var target = $(this).attr("data-target"); var toggle = $(this).data('toggle'); var pageFragment = $(this).attr("data-fragment"); var spin = $(''); $(target).append(spin); $(target).load(url + ' ' + pageFragment, function (response, status, xhr) { if (status == "error") { if (xhr.status == 401) { if (response) { var data = jQuery.parseJSON(response); var redirect = data.login_url; if (redirect) { window.location = redirect; } else { window.location = "/login"; } } } else { $(target).empty().html('Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.'); } } if (toggle) { $(toggle).modal('show'); } }); return false; }); } } })(); var PartialsButtonHeartDetail = (function () { return { setup: function () { $('body').on('click', '.partialbuttonfollowproject', function (event) { event.preventDefault(); var url = $(this).attr("data-href"); var target = $(this).attr("data-target"); var auth = $(this).attr("data-auth"); var toggle = $(this).data('toggle'); var pageFragment = $(this).attr("data-fragment"); if (!auth) { $('#like-product-modal').modal('show'); return; } // product owner not allow to heart copy from voting.... var loginuser = $('#like-product-modal').find('#loginuser').val(); var productcreator = $('#like-product-modal').find('#productcreator').val(); if (loginuser == productcreator) { // ignore $('#like-product-modal').find('#votelabel').text('Project owner not allowed'); $('#like-product-modal').find('.modal-body').empty(); $('#like-product-modal').modal('show'); return; } var spin = $(''); $(target).prepend(spin); $.ajax({ url: url, cache: false }) .done(function( response ) { $(target).find('.spinning').remove(); if(response.status =='error'){ $(target).html( response.msg ); }else{ if(response.action=='delete'){ //$(target).find('.likelabel').html(response.cnt +' Likes'); $(target).find('.plingtext').html(response.cnt); $(target).find('.plingtext').addClass('heartnumberpurple'); $(target).find('.plingheart').removeClass('heartproject').addClass('heartgrey'); $(target).find('.plingheart').removeClass('fa-heart').addClass('fa-heart-o'); }else{ //$(target).find('.likelabel').html(response.cnt +' Likes'); $(target).find('.plingtext').html(response.cnt); //$(target).find('.plingtext').html(response.cnt+' Fans'); $(target).find('.plingtext').removeClass('heartnumberpurple'); $(target).find('.plingheart').removeClass('heartgrey').addClass('heartproject'); $(target).find('.plingheart').removeClass('fa-heart-o').addClass('fa-heart'); } } }); return false; }); } } })(); var PartialsButtonPlingProject = (function () { return { setup: function () { $('#plingbtn').hover(function(){ $(this).attr('src','/images/system/pling-btn-hover.png'); }, function(){ $(this).attr('src',$(this).attr('data-src')); }); $('body').on('click', '.partialbuttonplingproject', function (event) { event.preventDefault(); var url = $(this).attr("data-href"); var target = $(this).attr("data-target"); var auth = $(this).attr("data-auth"); var issupporter = $(this).attr("data-issupporter"); var toggle = $(this).data('toggle'); var pageFragment = $(this).attr("data-fragment"); if (!auth) { $('#like-product-modal').modal('show'); return; } // product owner not allow to heart copy from voting.... var loginuser = $('#like-product-modal').find('#loginuser').val(); var productcreator = $('#like-product-modal').find('#productcreator').val(); if (loginuser == productcreator) { // ignore $('#like-product-modal').find('#votelabel').text('Project owner not allowed'); $('#like-product-modal').find('.modal-body').empty(); $('#like-product-modal').modal('show'); return; } if (!issupporter) { // ignore $('#like-product-modal').find('#votelabel').html('
To pling a product and help the artist please consider becoming a supporter. Thanks!

Become a supporter
'); $('#like-product-modal').modal('show'); return; } $(target).find('.plingnum').html(''); $.ajax({ url: url, cache: false }) .done(function( response ) { //$(target).find('.spinning').remove(); if(response.status =='error'){ $(target).html( response.msg ); }else{ if(response.action=='delete'){ //pling deleted if(response.cnt==0) { $(target).find('.plingnum').html('Pling me'); }else { $(target).find('.plingnum').html(response.cnt+ ' Plings'); } $(target).find('#plingbtn').attr('src','/images/system/pling-btn-normal.png'); $(target).find('#plingbtn').attr('data-src','/images/system/pling-btn-normal.png'); }else{ //pling inserted $(target).find('.plingnum').html(response.cnt+ ' Plings'); $(target).find('#plingbtn').attr('src','/images/system/pling-btn-active.png'); $(target).find('#plingbtn').attr('data-src','/images/system/pling-btn-active.png'); } } }); return false; }); } } })(); var PartialsReview = (function () { return { setup: function () { $('body').on('click', 'a.partialreview', function (event) { event.preventDefault(); var url = this.href; var target = $(this).attr("data-target"); var toggle = $(this).data('toggle'); var pageFragment = $(this).attr("data-fragment"); // product owner not allow to vote var loginuser = $('#review-product-modal').find('#loginuser').val(); var productcreator = $('#review-product-modal').find('#productcreator').val(); if (loginuser == productcreator) { // ignore $('#review-product-modal').find('#votelabel').text('Project owner not allowed'); $('#review-product-modal').find('.modal-body').empty(); $('#review-product-modal').modal('show'); return; } var userrate = $('#review-product-modal').find('#userrate').val(); // -1 = no rate yet. 0= dislike 1=like if ($(this).hasClass("voteup")) { if (userrate == 1) { $('#review-product-modal').find('#votelabel').empty() .append(' is given already with comment:'); $('#review-product-modal').find('#commenttext').val($('#review-product-modal').find('#otxt').val()); //$('#review-product-modal').find(':submit').attr("disabled", "disabled").css("display", "none"); //$('#review-product-modal').find('#commenttext').attr("disabled", "disabled"); $('#review-product-modal').find(':submit').text("Remove Rating"); } else { $('#review-product-modal').find('input#voteup').val(1); $('#review-product-modal').find('#votelabel').empty() .append(' Add Comment (min. 1 char):'); $('#review-product-modal').find('#commenttext').val('+'); $('#review-product-modal').find(':submit').text("Rate Now"); $('#review-product-modal').find('#commenttext').removeAttr("disabled"); $('#review-product-modal').find(':submit').css("display", "block").removeAttr("disabled"); } } else { // vote down if (userrate == 0) { $('#review-product-modal').find('#votelabel').empty() .append(' is given already with comment: '); $('#review-product-modal').find('#commenttext').val($('#review-product-modal').find('#otxt').val()); // $('#review-product-modal').find('#commenttext').attr("disabled", "disabled"); // $('#review-product-modal').find(':submit').attr("disabled", "disabled").css("display", "none"); $('#review-product-modal').find(':submit').text("Remove Rating"); } else { $('#review-product-modal').find('input#voteup').val(2); $('#review-product-modal').find('#votelabel').empty() .append(' Add Comment (min. 5 char) Please explain the reason for downvote to help the creator to make it better '); $('#review-product-modal').find('#commenttext').val('-'); $('#review-product-modal').find('#commenttext').removeAttr("disabled"); $('#review-product-modal').find(':submit').removeAttr("disabled").css("display", "block"); $('#review-product-modal').find(':submit').text("Rate Now"); } } $('#review-product-modal').modal('show'); if ($('#review-product-modal').hasClass('noid')) { setTimeout(function () { $('#review-product-modal').modal('hide'); }, 2000); } return false; }); } } })(); var PartialsReviewDownloadHistory = (function () { return { setup: function () { $('body').on('click', 'button.partialReviewDownloadHistory', function (event) { event.preventDefault(); var userrate = $(this).attr("data-userrate"); // -1 = no rate yet. 0= dislike 1=like $('#review-product-modal').find('#commenttext').val($(this).attr("data-comment")); $('#review-product-modal').find('#form_p').val($(this).attr("data-project")); if ($(this).hasClass("voteup")) { if (userrate == 1) { $('#review-product-modal').find('#votelabel').empty() .append(' is given already with comment:'); $('#review-product-modal').find(':submit').attr("disabled", "disabled").css("display", "none"); $('#review-product-modal').find('#commenttext').attr("disabled", "disabled"); } else { $('#review-product-modal').find('input#voteup').val(1); $('#review-product-modal').find('#votelabel').empty() .append(' Add Comment (min. 1 char):'); $('#review-product-modal').find('#commenttext').val('+'); $('#review-product-modal').find('#commenttext').removeAttr("disabled"); $('#review-product-modal').find(':submit').css("display", "block").removeAttr("disabled"); } } else { // vote down if (userrate == 0) { $('#review-product-modal').find('#votelabel').empty() .append(' is given already with comment: '); $('#review-product-modal').find('#commenttext').attr("disabled", "disabled"); $('#review-product-modal').find(':submit').attr("disabled", "disabled").css("display", "none"); } else { $('#review-product-modal').find('input#voteup').val(2); $('#review-product-modal').find('#votelabel').empty() .append(' Add Comment (min. 5 chars): '); $('#review-product-modal').find('#commenttext').val('-'); $('#review-product-modal').find('#commenttext').removeAttr("disabled"); $('#review-product-modal').find(':submit').removeAttr("disabled").css("display", "block"); } } $('#review-product-modal').modal('show'); if ($('#review-product-modal').hasClass('noid')) { setTimeout(function () { $('#review-product-modal').modal('hide'); }, 2000); } return false; }); } } })(); var PartialForms = (function () { return { setup: function () { $('body').on("submit", 'form.partial', function (event) { event.preventDefault(); event.stopImmediatePropagation(); $(this).find(':submit').attr("disabled", "disabled"); $(this).find(':submit').css("white-space", "normal"); var spin = $(''); $(this).find(':submit').append(spin); var target = $(this).attr("data-target"); var trigger = $(this).attr("data-trigger"); console.log(this); jQuery.ajax({ data: $(this).serialize(), url: this.action, type: this.method, error: function () { $(target).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
"); return false; }, success: function (results) { $(target).empty().html(results); $(target).find(trigger).trigger('click'); return false; } }); return false; }); } } })(); var PartialJson = (function () { return { setup: function () { $('body').on("submit", 'form.partialjson', function (event) { event.preventDefault(); event.stopImmediatePropagation(); var target = $(this).attr("data-target"); var trigger = $(this).attr("data-trigger"); jQuery.ajax({ data: $(this).serialize(), url: this.action, type: this.method, dataType: "json", error: function () { $(target).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
"); }, success: function (data, textStatus) { if (data.redirect) { // data.redirect contains the string URL to redirect to window.location = data.redirect; return; } if (target) { // data.message contains the HTML for the replacement form $(target).empty().html(data.message); } if (trigger) { $(target).find(trigger).trigger('click'); } } }); return false; }); } } })(); var PartialJsonFraud = (function () { return { setup: function () { $('body').on("submit", 'form.partialjsonfraud', function (event) { event.preventDefault(); event.stopImmediatePropagation(); var target = $(this).attr("data-target"); var trigger = $(this).attr("data-trigger"); var text = $('form.partialjsonfraud').find('#report-text').val(); if(text.length<5) { $('form.partialjsonfraud').find('p.warning').remove(); $('form.partialjsonfraud').find('#report-text').parent().append('

at least 5 chars

'); return false; } jQuery.ajax({ data: $(this).serialize(), url: this.action, type: this.method, dataType: "json", error: function () { $(target).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
"); }, success: function (data, textStatus) { if (data.redirect) { // data.redirect contains the string URL to redirect to window.location = data.redirect; return; } if (target) { // data.message contains the HTML for the replacement form $(target).empty().html(data.message); } if (trigger) { $(target).find(trigger).trigger('click'); } } }); return false; }); } } })(); var PartialPayPal = (function () { return { setup: function () { this.initPayPalForm(); this.initPayPalFee(); }, initPayPalForm: function () { $('body').on("submit", 'form.partialpaypal', function (event) { event.preventDefault(); event.stopImmediatePropagation(); var target = $(this).attr("data-target"); var trigger = $(this).attr("data-trigger"); jQuery.ajax({ data: $(this).serialize(), url: this.action, type: this.method, error: function (jqXHR, textStatus, errorThrown) { $('#modal-dialog').modal('hide'); var msgBox = $(''); msgBox.html($(jqXHR.responseText).filter('.page-container').children()); msgBox.append(''); setTimeout(function () { msgBox.modal('show'); }, 900); }, success: function (results) { $(target).empty().html(results); $(target).find(trigger).trigger('click'); $('#modal-dialog').modal('hide'); } }); return false; }); }, initPayPalFee: function () { $('body').on("change", '#amount_plings', function (event) { PartialPayPal.changeFee(); }); }, changeFee: function () { var e = document.getElementById('amount_plings'); var value = parseFloat(e.value); var pling_fee = this.round((value) * 0.05, 2); var pling_sum = (pling_fee) + (value); var paypal_fee = (pling_sum + 0.3) * 0.03 + 0.3; paypal_fee = this.round(paypal_fee, 2); var sum = value + pling_fee + paypal_fee; document.getElementById('pling_fee').value = this.round(pling_fee, 2).toFixed(2); document.getElementById('paypal_fee').value = this.round(paypal_fee, 2).toFixed(2); document.getElementById('sum').value = this.round(sum, 2); }, round: function (x, n) { var a = Math.pow(10, n); return (Math.round(x * a) / a); } } })(); var PartialCommentReviewForm = (function () { return { setup: function () { this.initForm(); }, initForm: function () { $('body').on("submit", 'form.product-add-comment-review', function (event) { event.preventDefault(); event.stopImmediatePropagation(); var c = $.trim($('#commenttext').val()); var v = $('#voteup').val(); if(v==2) { // votedown if(c.length<5) { if($('#review-product-modal').find('#votelabel').find('.warning').length==0) { $('#review-product-modal').find('#votelabel').append("
Please give a comment, thanks!"); } return; } } if(c.length<1) { if($('#review-product-modal').find('#votelabel').find('.warning').length==0) { $('#review-product-modal').find('#votelabel').append("
Please give a comment, thanks!"); } return; } $(this).find(':submit').attr("disabled", "disabled"); $(this).find(':submit').css("white-space", "normal"); var spin = $(''); $(this).find(':submit').append(spin); jQuery.ajax({ data: $(this).serialize(), url: this.action, type: this.method, error: function (jqXHR, textStatus, errorThrown) { $('#review-product-modal').modal('hide'); var msgBox = $('#generic-dialog'); msgBox.modal('hide'); msgBox.find('.modal-header-text').empty().append('Please try later.'); msgBox.find('.modal-body').empty().append("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
"); setTimeout(function () { msgBox.modal('show'); }, 900); }, success: function (results) { $('#review-product-modal').modal('hide'); location.reload(); } }); return false; }); } } })(); var PartialFormsAjax = (function () { return { setup: function () { var form = $('form.partialajax'); var target = form.attr("data-target"); var trigger = form.attr("data-trigger"); $(form).find(':submit').on('click', function (e) { e.preventDefault(); $(form).find(':submit').attr("disabled", "disabled"); $(form).find(':submit').css("white-space", "normal"); var spin = $(''); $(form).find(':submit').append(spin); $(form).submit(); }); form.ajaxForm({ error: function () { $(target).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
"); }, success: function (results) { $(target).empty().html(results); $(target).find(trigger).trigger('click'); } }); } } })(); var AjaxFormWithProgress = (function () { return { setup: function (idForm) { var form = $(idForm); var target = form.attr("data-target"); var trigger = form.attr("data-trigger"); var bar = form.find('.progress-bar'); var percent = form.find('.progress-percent'); $(form).find(':submit').on('click', function (e) { e.preventDefault(); $(form).find(':submit').attr("disabled", "disabled"); $(form).find(':submit').css("white-space", "normal"); var spin = $(''); $(form).find(':submit').append(spin); $(form).submit(); }); form.ajaxForm({ beforeSend: function() { var percentVal = '0%'; bar.parent().removeClass('hidden'); bar.width(percentVal); percent.html(percentVal); }, uploadProgress: function(event, position, total, percentComplete) { var percentVal = percentComplete + '%'; bar.width(percentVal); percent.html(percentVal); }, error: function () { $(target).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
"); }, success: function (results) { var percentVal = '100%'; bar.width(percentVal); percent.html(percentVal); $(target).empty().html(results); $(target).find(trigger).trigger('click'); } }); } } })(); var PartialFormsAjaxMemberBg = (function () { return { setup: function () { var form = $('form.partialajaxbg'); var target = form.attr("data-target"); var trigger = form.attr("data-trigger"); $(form).find(':submit').on('click', function (e) { e.preventDefault(); $(form).find(':submit').attr("disabled", "disabled"); $(form).find(':submit').css("white-space", "normal"); var spin = $(''); $(form).find(':submit').append(spin); $(form).submit(); }); form.ajaxForm({ error: function () { $(target).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
"); }, success: function (results) { $(target).empty().html(results); $(target).find(trigger).trigger('click'); } }); } } })(); var AjaxForm = (function () { return { setup: function (idElement, idTargetElement) { var target = $(idTargetElement); $('body').on("submit", 'form.product-add-comment', function (event) { event.preventDefault(); event.stopImmediatePropagation(); $(this).find('button').attr("disabled", "disabled"); $(this).find('.glyphicon.glyphicon-send').removeClass('glyphicon-send').addClass('glyphicon-refresh spinning'); jQuery.ajax({ data: $(this).serialize(), url: this.action, type: this.method, dataType: "json", error: function (jqXHR, textStatus, errorThrown) { var results = JSON && JSON.parse(jqXHR.responseText) || $.parseJSON(jqXHR.responseText); var msgBox = $('#generic-dialog'); msgBox.modal('hide'); msgBox.find('.modal-header-text').empty().append(results.title); msgBox.find('.modal-body').empty().append(results.message); setTimeout(function () { msgBox.modal('show'); }, 900); }, success: function (results) { if (results.status == 'ok') { $(target).empty().html(results.data); } if (results.status == 'error') { if (results.message != '') { alert(results.message); } else { alert('Service is temporarily unavailable.'); } } } }); return false; }); } } })(); var WidgetModalAjax = (function () { return { setup: function () { $('.my-product-item').find('a.widget-button').on('click', function () { var this_rel = $(this).attr('rel'); var this_product_id = this_rel.split('product')[1]; var target = $('.modal-body#widget-code-' + this_rel); $.ajax({ url: '/widget/config/' + this_product_id, type: 'html', success: function (results) { target.prepend(results); angular.bootstrap(target, ['widgetApp']); } }); }); } } })(); var LoginContainer = (function () { return { update: function () { if (!Date.now) { Date.now = function () { return new Date().getTime(); } } var timestamp = Date.now() / 1000 | 0; var target = '#login_container'; var url = '/authorization/htmllogin?' + timestamp; $(target).load(url, function (response, status, xhr) { // nothing to do }); } } })(); var RssNews = (function () { return { setup: function () { var json_url = "https://blog.opendesktop.org/?json=1&callback=?"; $.getJSON(json_url, function (res) { var crss = ''; $.each(res.posts, function (i, item) { if (i >= 3) { return false; } var m = moment(item.date); crss += '
' + item.title + '
' + '' + m.format('MMM DD YYYY') + ''+ item.comments.length +' Comment'+(item.comments.length>1?'s':'') +'
'; }); $("#rss-feeds").html(crss); }); } } })(); var BlogJson = (function () { return { setup: function () { var urlforum = 'https://forum.opendesktop.org/'; var json_url =urlforum+'latest.json'; $.ajax(json_url).then(function (result) { var topics = result.topic_list.topics; var crss = ''; var count =3; topics.sort(function(a,b){ return new Date(b.last_posted_at) - new Date(a.last_posted_at); }); $.each(topics, function (i, item) { if(!item.pinned){ var m = moment(item.last_posted_at); var r = 'Reply'; var t = item.posts_count -1; if(t==0){ r = 'Replies'; }else if(t==1){ r = 'Reply'; }else{ r = 'Replies'; } crss += '
' + item.title + '
' + '' + m.fromNow() + ''+ t +' '+ r +'
'; count--; } if(count==0) return false; }); $("#blogJson").html(crss); }); } } })(); var GitlabNewProjectsJson = (function () { return { setup: function (url_git) { var json_url = url_git+'/api/v4/projects?order_by=created_at&sort=desc&visibility=public&page=1&per_page=5'; $.ajax(json_url).then(function (result) { var topics = result; var crss = ''; $.each(topics, function (i, item) { var m = moment(item.created_at); crss += ''; }); $("#lastgitprojects").html(crss); }); } } })(); function showGitUserAvatar(url_git,username, projectid) { var json_url = url_git+'/api/v4/users?username=' + username; $.ajax(json_url).then(function (result) { var usr_list = result; $.each(usr_list, function (i,usr) { $img = $('#avatar_' + username + '_' + projectid); //alert(usr); //alert($img.attr('src')); $img.attr('src',usr.avatar_url); //alert($img.attr('src')); }); }); } var ProductDetailCarousel = (function () { return { setup: function () { $('.carousel-inner img').each(function (index) { $(this).on("click", function () { if ($("#product-main-img-container").hasClass("imgfull")) { $('#product-main-img-container').prependTo($('#product-main')); } else { $('#product-main-img-container').prependTo($('#product-page-content')); } $("#product-main-img-container").toggleClass("imgfull"); $("#product-main-img-container").toggleClass("imgsmall"); }); }); } } })(); var AppimagequestionOnClick = (function () { return { setup: function (projectid) { $('body').on('click', 'i.appimagequestion', function (event) { var msgBox = $('#generic-dialog'); msgBox.modal('show'); msgBox.find('.modal-header-text').empty().append('AppImage Info'); msgBox.find('.modal-body').empty().append(""); }); } } })(); var ProductDetailBtnGetItClick = (function () { return { setup: function (projectid) { $('body').on('click', 'button#project_btn_download', function (event) { $.fancybox({ 'hideOnContentClick': true, 'autoScale': true, 'cyclic': 'true', 'transitionIn': 'elastic', 'transitionOut': 'elastic', 'type': 'ajax', helpers: { overlay: { locked: false } }, autoSize: true, href:'/p/'+projectid+'/ppload' }); }); } } })(); var GhnsExcludedClick = (function () { return { setup: function (projectid) { $('body').on('click', '#ghns_excluded-this-checkbox', function (event) { event.stopPropagation(); var status = 1; var title = ''; var btntxt = ''; if (this.checked) { status = 1; title = 'Please specify why this product should be excluded (min 5 chars) :'; btntxt=' ghns exclude'; } else { status = 0; title = 'Please specify why this product should be included (min 5 chars) :'; btntxt=' ghns include'; } var msgBox = $('#generic-dialog'); msgBox.modal('show'); msgBox.find('.modal-header-text').empty().append('GHNS '); msgBox.find('.modal-body').empty().append(title+ '

'); $('body').on("click", "#btn-ghns-excluded", function(){ var txt = $('#ghns-excluded-text').val(); if(txt.length<5) { alert('min 5 chars'); return false; } var project_id = $(this).attr('data-projectid'); var status = $(this).attr('data-status'); var target = "/backend/project/doghnsexclude"; $.ajax({ url: target, method:'POST', data:{'project_id':project_id,'ghns_excluded':status,'msg':txt}, success: function (results) { var msgBox = $('#generic-dialog'); if (status == 0) { msgBox.find('.modal-body').empty().append('Project is successfully included into GHNS'); $('#ghns_excluded-this-checkbox').prop("checked", false); } else { msgBox.find('.modal-body').empty().append('Project is successfully excluded into GHNS'); $('#ghns_excluded-this-checkbox').prop("checked", true); } setTimeout(function () { msgBox.modal('hide'); }, 1000); }, error: function () { alert('Service is temporarily unavailable.'); } }); }); return false; }); } } })(); var AboutMeMyProjectsPaging = (function () { return { setup: function () { $(window).scroll(function() { var end = $("footer").offset().top; var viewEnd = $(window).scrollTop() + $(window).height(); var distance = end - viewEnd; if (distance < 300){ // } // if($(window).scrollTop() == $(document).height() - $(window).height()) { if(!$('button#btnshowmoreproducts').length) return; let indicator = ''; let nextpage = $('button#btnshowmoreproducts').attr('data-page'); $('button#btnshowmoreproducts').remove(); $url = window.location.href; target = '#my-products-list'; let container = $('

').append(indicator).load($url,{projectpage:nextpage},function (response, status, xhr) { if (status == "error") { if (xhr.status == 401) { if (response) { var data = jQuery.parseJSON(response); var redirect = data.login_url; if (redirect) { window.location = redirect; } else { window.location = "/login"; } } } else { $(target).empty().html('Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.'); } } }); $('#my-products-list').append(container); } }); } } })(); var AboutMeMyProjectsPagingButton = (function () { return { setup: function () { let indicator = ''; $('body').on('click', 'button#btnshowmoreproducts', function (event) { let nextpage = $(this).attr('data-page'); $(this).remove(); $url = window.location.href; target = '#my-products-list'; let container = $('
').append(indicator).load($url,{projectpage:nextpage},function (response, status, xhr) { if (status == "error") { if (xhr.status == 401) { if (response) { var data = jQuery.parseJSON(response); var redirect = data.login_url; if (redirect) { window.location = redirect; } else { window.location = "/login"; } } } else { $(target).empty().html('Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.'); } } }); $('#my-products-list').append(container); }); } } })(); var ProductDetailCommentTooltip = (function () { return { setup: function () { TooltipUser.setup('tooltipuser','right'); } } })(); function generateTooltipster(elements,tooltipSide) { $(elements).each(function() { $(this).tooltipster( { side: tooltipSide, theme: ['tooltipster-light', 'tooltipster-light-customized'], contentCloning: true, contentAsHTML: true, interactive: true, functionBefore: function (instance, helper) { var origin = $(helper.origin); var userid = origin.attr('data-user'); if (origin.data('loaded') !== true) { $.get('/member/' + userid + '/tooltip/', function (data) { var d = data.data; var tmp = '
' + d.username + ' ' + d.countrycity + '
' + '
' + '
' + d.cntProjects + ' products
' + '
' + d.totalComments + ' comments
' + '
Likes ' + d.cntLikesGave + ' products
' + '
Got ' + d.cntLikesGot + ' Likes
' + '
Last time active : ' + d.lastactive_at + '
' + '
Member since : ' + d.created_at + '
' + '
'; tmp = tmp + '
'; instance.content(tmp); origin.data('loaded', true); }); } } } ); }); } var TooltipUser = (function () { return { setup: function (tooltipCls, tooltipSide) { $('.'+tooltipCls).tooltipster( { side: tooltipSide, theme: ['tooltipster-light', 'tooltipster-light-customized'], contentCloning: true, contentAsHTML: true, interactive: true, functionBefore: function (instance, helper) { var origin = $(helper.origin); var userid = origin.attr('data-user'); if (origin.data('loaded') !== true) { $.get('/member/' + userid + '/tooltip/', function (data) { var d = data.data; var tmp = '
' + d.username + ' ' + d.countrycity + '
' + '
' + '
' + d.cntProjects + ' products
' + '
' + d.totalComments + ' comments
' + '
Likes ' + d.cntLikesGave + ' products
' + '
Got ' + d.cntLikesGot + ' Likes
' + '
Last time active : ' + d.lastactive_at + '
' + '
Member since : ' + d.created_at + '
' + '
'; tmp = tmp + '
'; instance.content(tmp); origin.data('loaded', true); }); } } } ); } } })(); function generateTooltipUserPlings(elements,tooltipSide) { $(elements).each(function() { $(this).tooltipster( { side: tooltipSide, theme: ['tooltipster-light', 'tooltipster-light-customized'], contentCloning: true, contentAsHTML: true, interactive: true, functionBefore: function (instance, helper) { var origin = $(helper.origin); var userid = origin.attr('data-user'); if (origin.data('loaded') !== true) { $.get('/plings/tooltip/id/'+userid, function (data) { var tmp = '
'; $.each(data.data, function( index, value ) { if(index>10) return false; if(value.profile_image_url.indexOf('http')<0) { value.profile_image_url = "https://cn.opendesktop.org/cache/40x40-2/img/"+value.profile_image_url ; } if(value.profile_image_url.indexOf('.gif')>0) { value.profile_image_url = "https://cn.opendesktop.org/img/"+value.profile_image_url ; } tmp = tmp+'
'+value.username+'
'; }); tmp = tmp + '
'; instance.content(tmp); origin.data('loaded', true); }); } } } ); }); } var TooltipUserPlings = (function () { return { setup: function (tooltipCls, tooltipSide) { $('.'+tooltipCls).tooltipster( { side: tooltipSide, theme: ['tooltipster-light', 'tooltipster-light-customized'], contentCloning: true, contentAsHTML: true, interactive: true, functionBefore: function (instance, helper) { var origin = $(helper.origin); var userid = origin.attr('data-user'); if (origin.data('loaded') !== true) { $.get('/plings/tooltip/id/'+userid, function (data) { var tmp = '
'; $.each(data.data, function( index, value ) { if(index>10) return false; if(value.profile_image_url.indexOf('http')<0) { value.profile_image_url = "https://cn.opendesktop.org/cache/40x40-2/img/"+value.profile_image_url ; } if(value.profile_image_url.indexOf('.gif')>0) { value.profile_image_url = "https://cn.opendesktop.org/img/"+value.profile_image_url ; } tmp = tmp+'
'+value.username+'
'; }); tmp = tmp + '
'; instance.content(tmp); origin.data('loaded', true); }); } } } ); } } })(); var AboutMePage = (function () { return { setup: function (username) { var t = $(document).prop('title'); var tnew = username + "'s Profile " + t; $(document).prop('title', tnew); } } })(); var InitActiveHashTab = (function () { return { setup: function () { var activeTab = document.location.hash; if($('a[href="'+ activeTab +'"]')) { $('a[href="'+ activeTab +'"]').tab('show'); } } } })(); var CommunityTabToplistMemberScrollPaging= (function () { return { setup: function (paramEl,paramUrl) { $(window).scroll(function() { var end = $("footer").offset().top; var viewEnd = $(window).scrollTop() + $(window).height(); var distance = end - viewEnd; if (distance < 300){ if(!$('button#toplistmemberscrollshowmore').length) return; var indicator = ''; var nextpage = $('button#toplistmemberscrollshowmore').attr('data-page'); $('button#toplistmemberscrollshowmore').remove(); var pagingurl = paramUrl+"/nopage/1/page/"+nextpage; var $newdiv = $('
'); $(paramEl).find('.product-list').append($newdiv); $($newdiv).load(pagingurl,function (){ generateTooltipster($($newdiv).find('.tooltipuser'),"right"); }) } }); } } })(); var CommunityTab= (function () { return { setup: function () { var indicator = ''; $('body').on('click', 'a.communitytab', function (event) { event.preventDefault(); var el = $(this).attr('href'); var url = $(this).attr('data-href'); if($(el).find('.list').find('.user').length==0) { // only load once $(el).find('.list').append(indicator).load(url,function (){ generateTooltipster($(el).find('.tooltipuser'),"right"); if($(el).find('.tooltipuserplings').length>0) { generateTooltipUserPlings($(el).find('.tooltipuserplings'),"right"); } if(el=='#toplistMemberPanel') { CommunityTabToplistMemberScrollPaging.setup(el,url); } // paging let spans = $(el).find('.opendesktopwidgetpager span'); spans.each(function(index) { $(this).on("click", function(){ $(this).parent().addClass('active').siblings().removeClass('active'); var pagingurl = url+"/nopage/1/page/"+$(this).html(); $(el).find('.product-list').html(''); $(el).find('.product-list').load(pagingurl,function (){ generateTooltipster($(el).find('.tooltipuser'),"right"); if($(el).find('.tooltipuserplings').length>0) { generateTooltipUserPlings($(el).find('.tooltipuserplings'),"right"); }}) }); }); //end paging }); } }); var activeTab = document.location.hash; if($('a[href="'+ activeTab +'"]').length>0) { $('a[href="'+ activeTab +'"]').tab('show'); $('a[href="'+ activeTab +'"]').trigger( "click" ); }else { activeTab = "#supportersPanel"; $('a[href="'+ activeTab +'"]').trigger( "click" ); } $('body').on('mouseenter', '.product-thumbnail-startpage', function () { $(this).popover('show'); }); $('body').on('mouseleave', '.product-thumbnail-startpage', function () { $(this).popover('hide'); }); } } })(); var TagingProduct = (function () { return { setup: function () { $('input[name=tagsuser]') .tagify({ whitelist: ['good', 'great'], autocomplete:true }) .on('remove', function(e, tagName){ console.log('removed', tagName) }) .on('add', function(e, tagName){ console.log('added', tagName) }); } } })(); var TagingProductSelect2 = (function () { return { setup: function () { $.fn.select2.amd.require(['select2/selection/search'], function (Search) { Search.prototype.searchRemoveChoice = function (decorated, item) { this.trigger('unselect', { data: item }); this.$search.val(''); this.handleSearch(); }; }, null, true); var t = $(".taggingSelect2").select2({ placeholder: "Add Tags here ...", //placeholder tags: true, tokenSeparators: [",", " "], minimumInputLength: 3, maximumSelectionLength: 5, width: 'resolve', ajax: { url: '/tag/filter', dataType: 'json', type: "GET", delay: 500, // wait 250 milliseconds before triggering the request processResults: function (data) { return { results : data.data.tags }; } } }); // Bind an event t.on('select2:select', function (e) { var data = e.params.data; var projectid = $("#tagsuserselect").attr('data-pid'); var lis = t.parent().find('ul.select2-selection__rendered').find('li.select2-selection__choice').length; if(lis>5){ t.find("option[value='"+data.id+"']").remove(); return; } var regexp=new RegExp("^[0-9A-Za-z_.-]+$"); if(!(regexp.test(data.text))){ t.find("option[value='"+data.id+"']").remove(); alert('Must be letter or number and can include hyphens'); } if(data.text.length>10){ t.find("option[value='"+data.id+"']").remove(); alert('Max. length 45 chars'); } }); } } })(); var TagingProductDetail = (function () { return { setup: function () { TagingProductDetailSelect2.setup(); $('body').on('click', 'button.topic-tags-btn', function (event) { $(this).toggleClass('Done'); $('.product_category').find('.usertagslabel').remove(); $('.tagsuserselectpanel').toggle(); if($(this).text() == 'Done'){ $(this).text('Manage tags'); var newhtml = ''; var lis = $('li.select2-selection__choice'); $.each(lis, function( index, value ) { newhtml=newhtml+''+value.title+''; }); $('.product_category').find('.topicslink').html(newhtml); }else{ $(this).text('Done'); } }); } } })(); var TagingProductDetailSelect2 = (function () { return { setup: function () { $.fn.select2.amd.require(['select2/selection/search'], function (Search) { Search.prototype.searchRemoveChoice = function (decorated, item) { this.trigger('unselect', { data: item }); this.$search.val(''); this.handleSearch(); }; }, null, true); var t = $("#tagsuserselect").select2({ placeholder: "Input tags please...", //placeholder tags: true, minimumInputLength: 3, closeOnSelect:true, maximumSelectionLength: 5, tokenSeparators: [",", " "], ajax: { url: '/tag/filter', dataType: 'json', type: "GET", delay: 500, // wait 250 milliseconds before triggering the request processResults: function (data) { return { results : data.data.tags }; } } }); // Bind an event t.on('select2:select', function (e) { var data = e.params.data; var projectid = $("#tagsuserselect").attr('data-pid'); $.post( "/tag/add", { p: projectid, t: data.id }) .done(function( data ) { if(data.status=='error'){ $('span.topic-tags-saved').css({ color: "red" }).html(data.message).show().delay(2000).fadeOut(); t.find("option[value='"+data.data.tag+"']").last().remove(); //t.find("option[value="+data.data.tag+"]").last().remove(); } else { $('span.topic-tags-saved').css({ color: "green" }).html(' Saved').show().delay(1000).fadeOut(); } }); }); // Unbind the event t.on('select2:unselect', function(e){ var data = e.params.data; var projectid = $("#tagsuserselect").attr('data-pid'); $.post( "/tag/del", { p: projectid, t: data.id }) .done(function( data ) { console.log(data); $('span.topic-tags-saved').css({ color: "green" }).html(''+data.message).show().delay(1000).fadeOut(); //$('span.topic-tags-saved').show().delay(1000).fadeOut(); }); }); } } })(); var TagingLoopMyProducts = (function () { return { setup: function () { TagingLoopMyProductsSelect2.setup(); $('body').on('click', 'button.topic-tags-btn', function (event) { $(this).toggleClass('Done'); $(this).parent().find('.topicsuser').html(''); $(this).parent().find('.tagsuserselectpanel').toggle(); if($(this).text() == 'Done'){ $(this).text('Manage tags'); var newhtml = ''; var lis = $(this).parent().find('li.select2-selection__choice'); $.each(lis, function( index, value ) { newhtml=newhtml+''+value.title+''; }); $(this).parent().find('.topicsuser').html(newhtml); }else{ $(this).text('Done'); } }); } } })(); var TagingLoopMyProductsSelect2 = (function () { return { setup: function () { $.fn.select2.amd.require(['select2/selection/search'], function (Search) { Search.prototype.searchRemoveChoice = function (decorated, item) { this.trigger('unselect', { data: item }); this.$search.val(''); this.handleSearch(); }; }, null, true); //var t = $("#tagsuserselect").select2({ var t = $(".taggingSelect2").select2({ placeholder: "Input tags please...", //placeholder tags: true, minimumInputLength: 3, closeOnSelect:true, maximumSelectionLength: 5, tokenSeparators: [",", " "], ajax: { url: '/tag/filter', dataType: 'json', type: "GET", delay: 500, // wait 250 milliseconds before triggering the request processResults: function (data) { return { results : data.data.tags }; } } }); // Bind an event t.on('select2:select', function (e) { var data = e.params.data; var projectid = $(this).attr('id').replace('tagsuserselect',''); //var projectid = $("#tagsuserselect").attr('data-pid'); $.post( "/tag/add", { p: projectid, t: data.id }) .done(function( data ) { if(data.status=='error'){ $('#topic-tags-saved'+projectid).css({ color: "red" }).html(data.message).show().delay(2000).fadeOut(); t.find("option[value='"+data.data.tag+"']").last().remove(); }else if(data.status=='existing'){ $('#topic-tags-saved'+projectid).css({ color: "red" }).html(data.message).show().delay(2000).fadeOut(); } else { $('#topic-tags-saved'+projectid).css({ color: "green" }).html(' Saved').show().delay(1000).fadeOut(); } }); }); // Unbind the event t.on('select2:unselect', function(e){ var data = e.params.data; //var projectid = $("#tagsuserselect").attr('data-pid'); var projectid = $(this).attr('id').replace('tagsuserselect',''); $.post( "/tag/del", { p: projectid, t: data.id }) .done(function( data ) { $('#topic-tags-saved'+projectid).css({ color: "green" }).html(''+data.message).show().delay(1000).fadeOut(); }); }); } } })(); var productRatingToggle = (function () { return { setup: function () { $('#showRatingAll').on('click', function () { $('#ratings-panel').find('.spinning').show(); setTimeout(function () { $('#ratings-panel').find('.spinning').hide(); }, 500); $('.btnRateFilter').removeClass('activeRating'); $(this).addClass('activeRating'); $('.productRating-rows').show(); $('.productRating-rows-inactive').show(); }); $('#showRatingActive').on('click', function () { $('#ratings-panel').find('.spinning').show(); setTimeout(function () { $('#ratings-panel').find('.spinning').hide(); }, 500); $('.btnRateFilter').removeClass('activeRating'); $(this).addClass('activeRating'); $('.productRating-rows').show(); $('.productRating-rows-inactive').hide(); }); $('#showRatingUpvotes').on('click', function () { $('#ratings-panel').find('.spinning').show(); setTimeout(function () { $('#ratings-panel').find('.spinning').hide(); }, 500); $('.btnRateFilter').removeClass('activeRating'); $(this).addClass('activeRating'); $('.productRating-rows').show(); $('.clsDownvotes').hide(); $('.productRating-rows-inactive').hide(); }); $('#showRatingDownvotes').on('click', function () { $('#ratings-panel').find('.spinning').show(); setTimeout(function () { $('#ratings-panel').find('.spinning').hide(); }, 500); $('.btnRateFilter').removeClass('activeRating'); $(this).addClass('activeRating'); $('.productRating-rows').show(); $('.productRating-rows-inactive').hide(); $('.clsUpvotes').hide(); }); } } })(); var FilterBrowseOriginalFn= (function () { return { setup: function () { $('body').on('click', 'input#filter_browse_original', function (event) { var checked = $(this).is( ":checked" ); var url = window.location.href; if(url.indexOf("browse")<0) { url = url+'/browse/'; } if(url.indexOf("filteroriginal")>0) { url = url.substring(0,url.indexOf("filteroriginal")); } if(checked){ window.location.href = url+'filteroriginal/1'; }else{ window.location.href = url+'filteroriginal/0'; } }); } } })(); var FilterBrowseTagGroupFn= (function () { return { setup: function () { $('body').on('change', 'select.filter_browse_tag_group', function (event) { var filterVal = $(this).val(); var groupId = $(this).attr('data_group_id'); $.ajax({ url: '/explore/savetaggroupfilter?group_id='+groupId+'&tag_id='+filterVal, cache: false }) .done(function( response ) { var url = window.location.href; window.location.href = url; }); }); } } })(); diff --git a/httpdocs/theme/flatui/js/script.min.js b/httpdocs/theme/flatui/js/script.min.js index 16576811b..a2d9e3613 100644 --- a/httpdocs/theme/flatui/js/script.min.js +++ b/httpdocs/theme/flatui/js/script.min.js @@ -1 +1 @@ -var newProductPage={setup:function(){function t(){var t=$("#donations-panel").find("#comments").height();t>$("#donations-panel").find("#supporters").height()&&$("#donations-panel").find("#supporters").height(t)}$(document).ready(function(){var e;e=$("#pling-it-box").height(),$(".scrollable-content").height(e),$(".scrollable-content").jScrollPane({mouseWheelSpeed:30}),t(),$('a[data-toggle="tab"]').on("shown.bs.tab",function(e){t()})})}},ImagePreview={hasError:!1,setup:function(){this.initProductPicture(),this.initTitlePicture(),this.initProfilePicture(),this.initProfilePictureBackground()},previewImage:function(t,e){if(t.files&&t.files[0]){var a=new FileReader,i=new Image,n=t.files[0];a.readAsDataURL(t.files[0]),a.onload=function(a){var o=$("#"+e);i.src=a.target.result,i.onload=function(){var e=this.width,i=this.height,r=n.type,s=(n.name,~~(n.size/1024));ImagePreview.hasError=!1,o.parent().parent().find("div.bg-danger").remove(),(e>2e3||e<20||i>2e3||i<20)&&(o.parent().parent().append('
Wrong image dimensions
'),$($(t).closest("form")[0]).trigger("reset"),ImagePreview.hasError=!0),s>2e3&&(o.parent().parent().append('
File too large
'),$($(t).closest("form")[0]).trigger("reset"),ImagePreview.hasError=!0);/(jpg|jpeg|png|gif)$/i.exec(r)||(o.parent().parent().append('
Invalid file type: '+n.type+"
"),$($(t).closest("form")[0]).trigger("reset"),ImagePreview.hasError=!0),0==ImagePreview.hasError&&(ImagePreview.hasError=!1,o.attr("src",a.target.result),o.show())},i.onerror=function(){o.parent().parent().find("div.bg-danger").remove(),o.parent().parent().append('
Invalid file type: '+n.type+"
")},"product-picture-preview"==e?$("button#add-product-picture").text("CHANGE LOGO"):"title-picture-preview"==e?$("button#add-title-picture").text("CHANGE BANNER"):"profile-picture-preview"==e?($("button#add-profile-picture").text("CHANGE PICTURE"),$("input#profile_img_src").val("local")):"profile-picture-bg-preview"==e&&$("button#add-profile-picture-background").text("CHANGE PICTURE")}}},previewImageMember:function(t,e){if(t.files&&t.files[0]){var a=new FileReader,i=new Image;t.files[0];a.readAsDataURL(t.files[0]),a.onload=function(t){var a=$("#"+e);i.src=t.target.result,i.onload=function(){ImagePreview.hasError=!1,a.parent().find(".image-error").remove(),0==ImagePreview.hasError&&(a.attr("src",t.target.result),a.show())},i.onerror=function(){a.parent().append('
Invalid file type
')},"profile-picture-background-preview"==e&&$("button#add-profile-picture-background").text("CHANGE PICTURE")}}},readImage:function(t){var e=new FileReader,a=new Image;e.readAsDataURL(t),e.onload=function(e){a.src=e.target.result,a.onload=function(){var e=this.width,a=this.height,i=t.type,n=t.name,o=~~(t.size/1024)+"KB";$("#uploadPreview").append(' '+e+"x"+a+" "+o+" "+i+" "+n+"
")},a.onerror=function(){alert("Invalid file type: "+t.type)}}},initProductPicture:function(){if(0!=$("#image_small").length&&0!=$("#image_small").attr("value").length){var t=$("#image_small").data("target");$(t).attr("src","https://cn.opendesktop.org/cache/200x200-2/img/"+$("#image_small").attr("value")),$(t).show(),$("button#add-product-picture").text("CHANGE LOGO")}},initTitlePicture:function(){if(0!=$("#image_big").length&&0!=$("#image_big").attr("value").length){var t=$("#image_big").data("target");$(t).attr("src","https://cn.opendesktop.org/cache/200x200-2/img/"+$("#image_big").attr("value")),$(t).show(),$("button#add-title-picture").text("CHANGE BANNER")}},initProfilePicture:function(){if(0!=$("#profile_image_url").length&&0!=$("#profile_image_url").attr("value").length){var t=$("#profile_image_url").data("target");$(t).attr("src",$("#profile_image_url").attr("value")),$("#profile-picture").attr("src",$("#profile_image_url").attr("value")),$(t).show(),$("button#add-profile-picture").text("CHANGE PICTURE")}},initProfilePictureBackground:function(){if(0!=$("#profile_image_url_bg").length&&0!=$("#profile_image_url_bg").attr("value").length){var t=$("#profile_image_url_bg").data("target");$(t).attr("src",$("#profile_image_url_bg").attr("value")),$("#profile-picture-background-preview").attr("src",$("#profile_image_url_bg").attr("value")),$(t).show(),$("button#add-profile-picture-background").text("CHANGE PICTURE")}}},MenuHover={setup:function(){$("body").on("click","a#login-dropdown",function(t){t.stopPropagation(),$(".header-login-container").toggleClass("active")}).on("click",".header-login-container",function(t){t.stopPropagation()}).on("click","a.menu-trigger",function(t){t.stopPropagation();var e="."+$(this).attr("rel");$(e).toggleClass("active")}).on("mouseup",function(t){var e=$("ul.profile-menu");$("li.profile-menu-container a.menu-trigger").is(t.target)||e.is(t.target)||0!==e.has(t.target).length||e.removeClass("active")}).on("mouseup",function(t){container=$("div.header-login-container"),trigger=$("a#login-dropdown"),trigger.is(t.target)||container.is(t.target)||0!==container.has(t.target).length||container.removeClass("active")}).click(function(){$(".header-login-container.active").removeClass("active"),$(".profile-menu.active").removeClass("active")})}},ButtonCode={setup:function(){$("#button-code-heading").click(function(){$(this).hasClass("button-code-active")?($(this).removeClass("button-code-active"),$(this).parent().find(".button-code").slideUp("fast"),$(this).parent().find(".button-code").css("border-bottom","none"),$(this).find(".icon-expand-code").css("background-image","url(img/icon-expand.png)")):($(this).addClass("button-code-active"),$(this).parent().find(".button-code").css("border-bottom","1px solid #bdc3c7"),$(this).parent().find(".button-code").slideDown("fast"),$(this).find(".icon-expand-code").css("background-image","url(img/icon-contract.png)"))})},setupClipboardCopy:function(t){$(t).on("mouseover",function(){$(this).off("mouseover"),$(this).find("[data-clipboard-target]").each(function(){var t=$($(this).attr("data-clipboard-target"));$(this).zclip({path:"/theme/flatui/js/lib/ZeroClipboard.swf",copy:$.trim($(t).text())})})})}},ProductPage={setup:function(){$(".dropdown-toggle").dropdown(),$(".scroll-pane").jScrollPane({mouseWheelSpeed:30,animateScroll:!0}),$(".love-it").on("click",function(){this_img_src=$(this).find("img").attr("src"),$(this).hasClass("no-login")||"/theme/flatui/img/icon-like-color.png"==this_img_src||$(this).prev(".share-it").trigger("click")}),$(".payment-options").find(".options").find("span.option").on("click",function(){var t=$(this).attr("title"),e=$(".payment-options").find('input[type="number"]');e.attr("value",t).val(t),e.focus(),$(".options").find(".selected").removeClass("selected"),$(this).addClass("selected")})},setupPlingButton:function(){$("#pling-amount").on("focus",function(){$("#pling-amount").popover("destroy")}),$("#pling-start").on("click",function(t){return validateElement=$("#pling-amount"),validateValue=validateElement.val(),""==validateValue||isNaN(parseFloat(validateValue))||!isFinite(validateValue)?(t.preventDefault(),$("#pling-amount").popover({placement:"bottom",html:"true",content:'
Donation must be a numeric value.
'}).popover("show"),!1):(minValue=validateElement.attr("min"),parseFloat(validateValue)×
Donation must be equal or greater than '+minValue+".
"}).popover("show"),!1):(maxValue=validateElement.attr("max"),parseFloat(validateValue)>parseFloat(maxValue)?(t.preventDefault(),$("#pling-amount").popover({placement:"bottom",html:"true",content:'
Donation must be smaller or equal than '+maxValue+".
"}).popover("show"),!1):void 0))})}},SlideShowRender={setup:function(){$("#slideshow-container").find("img:first").addClass("active"),$("#slideshow-container").find("#navigation").find("a:first").addClass("active")}},ProductSlideShow={setup:function(){$("#slideshow-container").find("#arrows").find("a").on("click",function(t){var e=$(this).attr("id"),a=$("#slideshow-container #slides"),i=a.find("img.active"),n=i.attr("rel"),o=$("#slideshow-container").find("#navigation").find("a.active");if("prev"==e){var r=parseInt(n)-parseInt(1),s=$("#slideshow-container").find('img[rel="'+r+'"]'),l=$("#slideshow-container").find("#navigation").find('a[rel="'+r+'"]');1==!s.size()&&(s=a.find("img:last"),l=$("#slideshow-container").find("#navigation").find("a:last"))}else if("next"==e){var d=parseInt(n)+parseInt(1);s=$("#slideshow-container").find('img[rel="'+d+'"]'),l=$("#slideshow-container").find("#navigation").find('a[rel="'+d+'"]'),1==!s.size()&&(s=a.find("img:first"),l=$("#slideshow-container").find("#navigation").find("a:first"))}i.removeClass("active"),o.removeClass("active"),s.addClass("active"),l.addClass("active")}),$("#slideshow-container").find("#navigation").find("a").on("click",function(){var t=$(this).attr("rel"),e=$("#slideshow-container").find('img[rel="'+t+'"]');$("#slideshow-container").find("img.active").removeClass("active"),e.addClass("active"),$("#slideshow-container").find("#navigation").find("a.active").removeClass("active"),$(this).addClass("active")})}},SlideShow={setup:function(){slideShowInterval=setTimeout(function(){var t=$("#slideshow-container").find("img.active"),e=t.attr("rel"),a=parseInt(e)+parseInt(1),i=$("#slideshow-container").find('img[rel="'+a+'"]'),n=$("#slideshow-container").find("#navigation").find("a.active");t.removeClass("active"),n.removeClass("active"),1==i.size()?(i.addClass("active"),$("#slideshow-container").find("#navigation").find('a[rel="'+a+'"]').addClass("active")):($("#slideshow-container").find("img:first").addClass("active"),$("#slideshow-container").find("#navigation").find("a:first").addClass("active"))},4e3)}},Popuppanel={setup:function(){$("body").on("click","a.popuppanel",function(t){if("_blank"===$(this).attr("target"))console.log("dont prevent default");else{t.preventDefault();var e=$(this).attr("href");$.fancybox({hideOnContentClick:!0,autoScale:!0,cyclic:"true",transitionIn:"elastic",transitionOut:"elastic",type:"iframe",scrolling:"auto",helpers:{overlay:{locked:!1}},autoSize:!0,href:e,type:"ajax"})}})}},PlingsRedirect={setup:function(){window.location.hash?($link=$(window.location.hash),$link.trigger("click")):document.location.hash&&($link=$(document.location.hash),$link.trigger("click"))}},ShowPopups={setup:function(){window.location.hash&&(alert("Hash"),$('a[href="'+document.location.hash+'"]').trigger("click")),document.location.hash&&(alert("Hash"),$('a[href="'+document.location.hash+'"]').trigger("click"))}};$("body").on("mouseenter",".supporter-thumbnail",function(){$(this).popover("show")}),$("body").on("mouseleave",".supporter-thumbnail",function(){$(this).popover("hide")});var Partials={setup:function(){$("body").on("click","a.partial",function(t){t.preventDefault();var e=this.href,a=$(this).attr("data-target"),i=$(this).data("toggle"),n=$(this).attr("data-fragment");return $(a).load(e+" "+n,function(t,e,n){if("error"==e)if(401==n.status){if(t){var o=jQuery.parseJSON(t).login_url;window.location=o||"/login"}}else $(a).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.");i&&$(i).modal("show")}),!1})}},Opendownloadfile={setup:function(){$("body").on("click","a.opendownloadfile",function(t){t.preventDefault();var e=$(this).attr("data-file_id"),a=$(this).attr("data-file_type"),i=$(this).attr("data-file_name"),n=$(this).attr("data-file_size"),o=$(this).attr("data-project_id"),r=$(this).attr("data-link_type");return $.fancybox({hideOnContentClick:!0,autoScale:!0,scrolling:"no",cyclic:"true",transitionIn:"elastic",transitionOut:"elastic",type:"iframe",width:"600",height:"400",iframe:{scrolling:"no"},autoSize:!1,id:"opendownloadfilepopup",helpers:{overlay:{locked:!1}},href:"/dl?file_id="+e+"&file_type="+a+"&file_name="+i+"&file_size="+n+"&project_id="+o+"&link_type="+r}),!1})}},PartialsButton={setup:function(){$("body").on("click","Button.partialbutton",function(t){t.preventDefault();var e=$(this).attr("data-href"),a=$(this).attr("data-target"),i=$(this).data("toggle"),n=$(this).attr("data-fragment"),o=$('');return $(a).append(o),$(a).load(e+" "+n,function(t,e,n){if("error"==e)if(401==n.status){if(t){var o=jQuery.parseJSON(t).login_url;window.location=o||"/login"}}else $(a).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.");i&&$(i).modal("show")}),!1})}},PartialsButtonHeartDetail={setup:function(){$("body").on("click",".partialbuttonfollowproject",function(t){t.preventDefault();var e=$(this).attr("data-href"),a=$(this).attr("data-target"),i=$(this).attr("data-auth");if($(this).data("toggle"),$(this).attr("data-fragment"),i){if($("#like-product-modal").find("#loginuser").val()==$("#like-product-modal").find("#productcreator").val())return $("#like-product-modal").find("#votelabel").text("Project owner not allowed"),$("#like-product-modal").find(".modal-body").empty(),void $("#like-product-modal").modal("show");var n=$('');return $(a).prepend(n),$.ajax({url:e,cache:!1}).done(function(t){$(a).find(".spinning").remove(),"error"==t.status?$(a).html(t.msg):"delete"==t.action?($(a).find(".plingtext").html(t.cnt),$(a).find(".plingtext").addClass("heartnumberpurple"),$(a).find(".plingheart").removeClass("heartproject").addClass("heartgrey"),$(a).find(".plingheart").removeClass("fa-heart").addClass("fa-heart-o")):($(a).find(".plingtext").html(t.cnt),$(a).find(".plingtext").removeClass("heartnumberpurple"),$(a).find(".plingheart").removeClass("heartgrey").addClass("heartproject"),$(a).find(".plingheart").removeClass("fa-heart-o").addClass("fa-heart"))}),!1}$("#like-product-modal").modal("show")})}},PartialsButtonPlingProject={setup:function(){$("#plingbtn").hover(function(){$(this).attr("src","/images/system/pling-btn-hover.png")},function(){$(this).attr("src",$(this).attr("data-src"))}),$("body").on("click",".partialbuttonplingproject",function(t){t.preventDefault();var e=$(this).attr("data-href"),a=$(this).attr("data-target"),i=$(this).attr("data-auth"),n=$(this).attr("data-issupporter");if($(this).data("toggle"),$(this).attr("data-fragment"),i)return $("#like-product-modal").find("#loginuser").val()==$("#like-product-modal").find("#productcreator").val()?($("#like-product-modal").find("#votelabel").text("Project owner not allowed"),$("#like-product-modal").find(".modal-body").empty(),void $("#like-product-modal").modal("show")):n?($(a).find(".plingnum").html(''),$.ajax({url:e,cache:!1}).done(function(t){"error"==t.status?$(a).html(t.msg):"delete"==t.action?(0==t.cnt?$(a).find(".plingnum").html("Pling me"):$(a).find(".plingnum").html(t.cnt+" Plings"),$(a).find("#plingbtn").attr("src","/images/system/pling-btn-normal.png"),$(a).find("#plingbtn").attr("data-src","/images/system/pling-btn-normal.png")):($(a).find(".plingnum").html(t.cnt+" Plings"),$(a).find("#plingbtn").attr("src","/images/system/pling-btn-active.png"),$(a).find("#plingbtn").attr("data-src","/images/system/pling-btn-active.png"))}),!1):($("#like-product-modal").find("#votelabel").html('
To pling a product and help the artist please consider becoming a supporter. Thanks!

Become a supporter
'),void $("#like-product-modal").modal("show"));$("#like-product-modal").modal("show")})}},PartialsReview={setup:function(){$("body").on("click","a.partialreview",function(t){if(t.preventDefault(),this.href,$(this).attr("data-target"),$(this).data("toggle"),$(this).attr("data-fragment"),$("#review-product-modal").find("#loginuser").val()==$("#review-product-modal").find("#productcreator").val())return $("#review-product-modal").find("#votelabel").text("Project owner not allowed"),$("#review-product-modal").find(".modal-body").empty(),void $("#review-product-modal").modal("show");var e=$("#review-product-modal").find("#userrate").val();return $(this).hasClass("voteup")?1==e?($("#review-product-modal").find("#votelabel").empty().append(' is given already with comment:'),$("#review-product-modal").find("#commenttext").val($("#review-product-modal").find("#otxt").val()),$("#review-product-modal").find(":submit").text("Remove Rating")):($("#review-product-modal").find("input#voteup").val(1),$("#review-product-modal").find("#votelabel").empty().append(' Add Comment (min. 1 char):'),$("#review-product-modal").find("#commenttext").val("+"),$("#review-product-modal").find(":submit").text("Rate Now"),$("#review-product-modal").find("#commenttext").removeAttr("disabled"),$("#review-product-modal").find(":submit").css("display","block").removeAttr("disabled")):0==e?($("#review-product-modal").find("#votelabel").empty().append(' is given already with comment: '),$("#review-product-modal").find("#commenttext").val($("#review-product-modal").find("#otxt").val()),$("#review-product-modal").find(":submit").text("Remove Rating")):($("#review-product-modal").find("input#voteup").val(2),$("#review-product-modal").find("#votelabel").empty().append(' Add Comment (min. 5 char) Please explain the reason for downvote to help the creator to make it better '),$("#review-product-modal").find("#commenttext").val("-"),$("#review-product-modal").find("#commenttext").removeAttr("disabled"),$("#review-product-modal").find(":submit").removeAttr("disabled").css("display","block"),$("#review-product-modal").find(":submit").text("Rate Now")),$("#review-product-modal").modal("show"),$("#review-product-modal").hasClass("noid")&&setTimeout(function(){$("#review-product-modal").modal("hide")},2e3),!1})}},PartialsReviewDownloadHistory={setup:function(){$("body").on("click","button.partialReviewDownloadHistory",function(t){t.preventDefault();var e=$(this).attr("data-userrate");return $("#review-product-modal").find("#commenttext").val($(this).attr("data-comment")),$("#review-product-modal").find("#form_p").val($(this).attr("data-project")),$(this).hasClass("voteup")?1==e?($("#review-product-modal").find("#votelabel").empty().append(' is given already with comment:'),$("#review-product-modal").find(":submit").attr("disabled","disabled").css("display","none"),$("#review-product-modal").find("#commenttext").attr("disabled","disabled")):($("#review-product-modal").find("input#voteup").val(1),$("#review-product-modal").find("#votelabel").empty().append(' Add Comment (min. 1 char):'),$("#review-product-modal").find("#commenttext").val("+"),$("#review-product-modal").find("#commenttext").removeAttr("disabled"),$("#review-product-modal").find(":submit").css("display","block").removeAttr("disabled")):0==e?($("#review-product-modal").find("#votelabel").empty().append(' is given already with comment: '),$("#review-product-modal").find("#commenttext").attr("disabled","disabled"),$("#review-product-modal").find(":submit").attr("disabled","disabled").css("display","none")):($("#review-product-modal").find("input#voteup").val(2),$("#review-product-modal").find("#votelabel").empty().append(' Add Comment (min. 5 chars): '),$("#review-product-modal").find("#commenttext").val("-"),$("#review-product-modal").find("#commenttext").removeAttr("disabled"),$("#review-product-modal").find(":submit").removeAttr("disabled").css("display","block")),$("#review-product-modal").modal("show"),$("#review-product-modal").hasClass("noid")&&setTimeout(function(){$("#review-product-modal").modal("hide")},2e3),!1})}},PartialForms={setup:function(){$("body").on("submit","form.partial",function(t){t.preventDefault(),t.stopImmediatePropagation(),$(this).find(":submit").attr("disabled","disabled"),$(this).find(":submit").css("white-space","normal");var e=$('');$(this).find(":submit").append(e);var a=$(this).attr("data-target"),i=$(this).attr("data-trigger");return console.log(this),jQuery.ajax({data:$(this).serialize(),url:this.action,type:this.method,error:function(){return $(a).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
"),!1},success:function(t){return $(a).empty().html(t),$(a).find(i).trigger("click"),!1}}),!1})}},PartialJson={setup:function(){$("body").on("submit","form.partialjson",function(t){t.preventDefault(),t.stopImmediatePropagation();var e=$(this).attr("data-target"),a=$(this).attr("data-trigger");return jQuery.ajax({data:$(this).serialize(),url:this.action,type:this.method,dataType:"json",error:function(){$(e).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
")},success:function(t,i){t.redirect?window.location=t.redirect:(e&&$(e).empty().html(t.message),a&&$(e).find(a).trigger("click"))}}),!1})}},PartialJsonFraud={setup:function(){$("body").on("submit","form.partialjsonfraud",function(t){t.preventDefault(),t.stopImmediatePropagation();var e=$(this).attr("data-target"),a=$(this).attr("data-trigger");return $("form.partialjsonfraud").find("#report-text").val().length<5?($("form.partialjsonfraud").find("p.warning").remove(),$("form.partialjsonfraud").find("#report-text").parent().append('

at least 5 chars

'),!1):(jQuery.ajax({data:$(this).serialize(),url:this.action,type:this.method,dataType:"json",error:function(){$(e).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
")},success:function(t,i){t.redirect?window.location=t.redirect:(e&&$(e).empty().html(t.message),a&&$(e).find(a).trigger("click"))}}),!1)})}},PartialPayPal={setup:function(){this.initPayPalForm(),this.initPayPalFee()},initPayPalForm:function(){$("body").on("submit","form.partialpaypal",function(t){t.preventDefault(),t.stopImmediatePropagation();var e=$(this).attr("data-target"),a=$(this).attr("data-trigger");return jQuery.ajax({data:$(this).serialize(),url:this.action,type:this.method,error:function(t,e,a){$("#modal-dialog").modal("hide");var i=$('');i.html($(t.responseText).filter(".page-container").children()),i.append(''),setTimeout(function(){i.modal("show")},900)},success:function(t){$(e).empty().html(t),$(e).find(a).trigger("click"),$("#modal-dialog").modal("hide")}}),!1})},initPayPalFee:function(){$("body").on("change","#amount_plings",function(t){PartialPayPal.changeFee()})},changeFee:function(){var t=document.getElementById("amount_plings"),e=parseFloat(t.value),a=this.round(.05*e,2),i=.03*(a+e+.3)+.3,n=e+a+(i=this.round(i,2));document.getElementById("pling_fee").value=this.round(a,2).toFixed(2),document.getElementById("paypal_fee").value=this.round(i,2).toFixed(2),document.getElementById("sum").value=this.round(n,2)},round:function(t,e){var a=Math.pow(10,e);return Math.round(t*a)/a}},PartialCommentReviewForm={setup:function(){this.initForm()},initForm:function(){$("body").on("submit","form.product-add-comment-review",function(t){t.preventDefault(),t.stopImmediatePropagation();var e=$.trim($("#commenttext").val());if(2==$("#voteup").val()&&e.length<5)0==$("#review-product-modal").find("#votelabel").find(".warning").length&&$("#review-product-modal").find("#votelabel").append("
Please give a comment, thanks!");else{if(!(e.length<1)){$(this).find(":submit").attr("disabled","disabled"),$(this).find(":submit").css("white-space","normal");var a=$('');return $(this).find(":submit").append(a),jQuery.ajax({data:$(this).serialize(),url:this.action,type:this.method,error:function(t,e,a){$("#review-product-modal").modal("hide");var i=$("#generic-dialog");i.modal("hide"),i.find(".modal-header-text").empty().append("Please try later."),i.find(".modal-body").empty().append("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
"),setTimeout(function(){i.modal("show")},900)},success:function(t){$("#review-product-modal").modal("hide"),location.reload()}}),!1}0==$("#review-product-modal").find("#votelabel").find(".warning").length&&$("#review-product-modal").find("#votelabel").append("
Please give a comment, thanks!")}})}},PartialFormsAjax={setup:function(){var t=$("form.partialajax"),e=t.attr("data-target"),a=t.attr("data-trigger");$(t).find(":submit").on("click",function(e){e.preventDefault(),$(t).find(":submit").attr("disabled","disabled"),$(t).find(":submit").css("white-space","normal");var a=$('');$(t).find(":submit").append(a),$(t).submit()}),t.ajaxForm({error:function(){$(e).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
")},success:function(t){$(e).empty().html(t),$(e).find(a).trigger("click")}})}},AjaxFormWithProgress={setup:function(t){var e=$(t),a=e.attr("data-target"),i=e.attr("data-trigger"),n=e.find(".progress-bar"),o=e.find(".progress-percent");$(e).find(":submit").on("click",function(t){t.preventDefault(),$(e).find(":submit").attr("disabled","disabled"),$(e).find(":submit").css("white-space","normal");var a=$('');$(e).find(":submit").append(a),$(e).submit()}),e.ajaxForm({beforeSend:function(){n.parent().removeClass("hidden"),n.width("0%"),o.html("0%")},uploadProgress:function(t,e,a,i){var r=i+"%";n.width(r),o.html(r)},error:function(){$(a).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
")},success:function(t){n.width("100%"),o.html("100%"),$(a).empty().html(t),$(a).find(i).trigger("click")}})}},PartialFormsAjaxMemberBg={setup:function(){var t=$("form.partialajaxbg"),e=t.attr("data-target"),a=t.attr("data-trigger");$(t).find(":submit").on("click",function(e){e.preventDefault(),$(t).find(":submit").attr("disabled","disabled"),$(t).find(":submit").css("white-space","normal");var a=$('');$(t).find(":submit").append(a),$(t).submit()}),t.ajaxForm({error:function(){$(e).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
")},success:function(t){$(e).empty().html(t),$(e).find(a).trigger("click")}})}},AjaxForm={setup:function(t,e){var a=$(e);$("body").on("submit","form.product-add-comment",function(t){return t.preventDefault(),t.stopImmediatePropagation(),$(this).find("button").attr("disabled","disabled"),$(this).find(".glyphicon.glyphicon-send").removeClass("glyphicon-send").addClass("glyphicon-refresh spinning"),jQuery.ajax({data:$(this).serialize(),url:this.action,type:this.method,dataType:"json",error:function(t,e,a){var i=JSON&&JSON.parse(t.responseText)||$.parseJSON(t.responseText),n=$("#generic-dialog");n.modal("hide"),n.find(".modal-header-text").empty().append(i.title),n.find(".modal-body").empty().append(i.message),setTimeout(function(){n.modal("show")},900)},success:function(t){"ok"==t.status&&$(a).empty().html(t.data),"error"==t.status&&(""!=t.message?alert(t.message):alert("Service is temporarily unavailable."))}}),!1})}},WidgetModalAjax={setup:function(){$(".my-product-item").find("a.widget-button").on("click",function(){var t=$(this).attr("rel"),e=t.split("product")[1],a=$(".modal-body#widget-code-"+t);$.ajax({url:"/widget/config/"+e,type:"html",success:function(t){a.prepend(t),angular.bootstrap(a,["widgetApp"])}})})}},LoginContainer={update:function(){Date.now||(Date.now=function(){return(new Date).getTime()});var t="/authorization/htmllogin?"+(Date.now()/1e3|0);$("#login_container").load(t,function(t,e,a){})}},RssNews={setup:function(){$.getJSON("https://blog.opendesktop.org/?json=1&callback=?",function(t){var e="";$.each(t.posts,function(t,a){if(t>=3)return!1;var i=moment(a.date);e+='
'+a.title+'
'+i.format("MMM DD YYYY")+''+a.comments.length+" Comment"+(a.comments.length>1?"s":"")+"
"}),$("#rss-feeds").html(e)})}},BlogJson={setup:function(){var t="https://forum.opendesktop.org/";$.ajax("https://forum.opendesktop.org/latest.json").then(function(e){var a=e.topic_list.topics,i="",n=3;a.sort(function(t,e){return new Date(e.last_posted_at)-new Date(t.last_posted_at)}),$.each(a,function(e,a){if(!a.pinned){var o=moment(a.last_posted_at),r="Reply",s=a.posts_count-1;r=0==s?"Replies":1==s?"Reply":"Replies",i+='
'+a.title+'
'+o.fromNow()+''+s+" "+r+"
",n--}if(0==n)return!1}),$("#blogJson").html(i)})}},GitlabNewProjectsJson={setup:function(t){var e=t+"/api/v4/projects?order_by=created_at&sort=desc&visibility=public&page=1&per_page=5";$.ajax(e).then(function(e){var a=e,i="";$.each(a,function(e,a){var n=moment(a.created_at);i+='"}),$("#lastgitprojects").html(i)})}};function showGitUserAvatar(t,e,a){var i=t+"/api/v4/users?username="+e;$.ajax(i).then(function(t){var i=t;$.each(i,function(t,i){$img=$("#avatar_"+e+"_"+a),$img.attr("src",i.avatar_url)})})}var ProductDetailCarousel={setup:function(){$(".carousel-inner img").each(function(t){$(this).on("click",function(){$("#product-main-img-container").hasClass("imgfull")?$("#product-main-img-container").prependTo($("#product-main")):$("#product-main-img-container").prependTo($("#product-page-content")),$("#product-main-img-container").toggleClass("imgfull"),$("#product-main-img-container").toggleClass("imgsmall")})})}},AppimagequestionOnClick={setup:function(t){$("body").on("click","i.appimagequestion",function(t){var e=$("#generic-dialog");e.modal("show"),e.find(".modal-header-text").empty().append("AppImage Info"),e.find(".modal-body").empty().append("")})}},ProductDetailBtnGetItClick={setup:function(t){$("body").on("click","button#project_btn_download",function(e){$.fancybox({hideOnContentClick:!0,autoScale:!0,cyclic:"true",transitionIn:"elastic",transitionOut:"elastic",type:"ajax",helpers:{overlay:{locked:!1}},autoSize:!0,href:"/p/"+t+"/ppload"})})}},GhnsExcludedClick={setup:function(t){$("body").on("click","#ghns_excluded-this-checkbox",function(e){e.stopPropagation();var a=1,i="",n="";this.checked?(a=1,i="Please specify why this product should be excluded (min 5 chars) :",n=" ghns exclude"):(a=0,i="Please specify why this product should be included (min 5 chars) :",n=" ghns include");var o=$("#generic-dialog");return o.modal("show"),o.find(".modal-header-text").empty().append("GHNS "),o.find(".modal-body").empty().append(i+'

"),$("body").on("click","#btn-ghns-excluded",function(){var t=$("#ghns-excluded-text").val();if(t.length<5)return alert("min 5 chars"),!1;var e=$(this).attr("data-projectid"),a=$(this).attr("data-status");$.ajax({url:"/backend/project/doghnsexclude",method:"POST",data:{project_id:e,ghns_excluded:a,msg:t},success:function(t){var e=$("#generic-dialog");0==a?(e.find(".modal-body").empty().append("Project is successfully included into GHNS"),$("#ghns_excluded-this-checkbox").prop("checked",!1)):(e.find(".modal-body").empty().append("Project is successfully excluded into GHNS"),$("#ghns_excluded-this-checkbox").prop("checked",!0)),setTimeout(function(){e.modal("hide")},1e3)},error:function(){alert("Service is temporarily unavailable.")}})}),!1})}},AboutMeMyProjectsPaging={setup:function(){$(window).scroll(function(){if($("footer").offset().top-($(window).scrollTop()+$(window).height())<300){if(!$("button#btnshowmoreproducts").length)return;let t='',e=$("button#btnshowmoreproducts").attr("data-page");$("button#btnshowmoreproducts").remove(),$url=window.location.href,target="#my-products-list";let a=$("

").append(t).load($url,{projectpage:e},function(t,e,a){if("error"==e)if(401==a.status){if(t){var i=jQuery.parseJSON(t).login_url;window.location=i||"/login"}}else $(target).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.")});$("#my-products-list").append(a)}})}},AboutMeMyProjectsPagingButton={setup:function(){$("body").on("click","button#btnshowmoreproducts",function(t){let e=$(this).attr("data-page");$(this).remove(),$url=window.location.href,target="#my-products-list";let a=$("
").append('').load($url,{projectpage:e},function(t,e,a){if("error"==e)if(401==a.status){if(t){var i=jQuery.parseJSON(t).login_url;window.location=i||"/login"}}else $(target).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.")});$("#my-products-list").append(a)})}},ProductDetailCommentTooltip={setup:function(){TooltipUser.setup("tooltipuser","right")}};function generateTooltipster(t,e){$(t).each(function(){$(this).tooltipster({side:e,theme:["tooltipster-light","tooltipster-light-customized"],contentCloning:!0,contentAsHTML:!0,interactive:!0,functionBefore:function(t,e){var a=$(e.origin),i=a.attr("data-user");!0!==a.data("loaded")&&$.get("/member/"+i+"/tooltip/",function(e){var i=e.data,n='
'+i.username+' '+i.countrycity+'
'+i.cntProjects+' products
'+i.totalComments+' comments
Likes '+i.cntLikesGave+' products
Got '+i.cntLikesGot+' Likes
Last time active : '+i.lastactive_at+'
Member since : '+i.created_at+"
";n+="
",t.content(n),a.data("loaded",!0)})}})})}var TooltipUser={setup:function(t,e){$("."+t).tooltipster({side:e,theme:["tooltipster-light","tooltipster-light-customized"],contentCloning:!0,contentAsHTML:!0,interactive:!0,functionBefore:function(t,e){var a=$(e.origin),i=a.attr("data-user");!0!==a.data("loaded")&&$.get("/member/"+i+"/tooltip/",function(e){var i=e.data,n='
'+i.username+' '+i.countrycity+'
'+i.cntProjects+' products
'+i.totalComments+' comments
Likes '+i.cntLikesGave+' products
Got '+i.cntLikesGot+' Likes
Last time active : '+i.lastactive_at+'
Member since : '+i.created_at+"
";n+="
",t.content(n),a.data("loaded",!0)})}})}};function generateTooltipUserPlings(t,e){$(t).each(function(){$(this).tooltipster({side:e,theme:["tooltipster-light","tooltipster-light-customized"],contentCloning:!0,contentAsHTML:!0,interactive:!0,functionBefore:function(t,e){var a=$(e.origin),i=a.attr("data-user");!0!==a.data("loaded")&&$.get("/plings/tooltip/id/"+i,function(e){var i='
';$.each(e.data,function(t,e){if(t>10)return!1;e.profile_image_url.indexOf("http")<0&&(e.profile_image_url="https://cn.opendesktop.org/cache/40x40-2/img/"+e.profile_image_url),e.profile_image_url.indexOf(".gif")>0&&(e.profile_image_url="https://cn.opendesktop.org/img/"+e.profile_image_url),i=i+'
'+e.username+"
"}),i+="
",t.content(i),a.data("loaded",!0)})}})})}var TooltipUserPlings={setup:function(t,e){$("."+t).tooltipster({side:e,theme:["tooltipster-light","tooltipster-light-customized"],contentCloning:!0,contentAsHTML:!0,interactive:!0,functionBefore:function(t,e){var a=$(e.origin),i=a.attr("data-user");!0!==a.data("loaded")&&$.get("/plings/tooltip/id/"+i,function(e){var i='
';$.each(e.data,function(t,e){if(t>10)return!1;e.profile_image_url.indexOf("http")<0&&(e.profile_image_url="https://cn.opendesktop.org/cache/40x40-2/img/"+e.profile_image_url),e.profile_image_url.indexOf(".gif")>0&&(e.profile_image_url="https://cn.opendesktop.org/img/"+e.profile_image_url),i=i+'
'+e.username+"
"}),i+="
",t.content(i),a.data("loaded",!0)})}})}},AboutMePage={setup:function(t){var e=t+"'s Profile "+$(document).prop("title");$(document).prop("title",e)}},InitActiveHashTab={setup:function(){var t=document.location.hash;$('a[href="'+t+'"]')&&$('a[href="'+t+'"]').tab("show")}},CommunityTabToplistMemberScrollPaging={setup:function(t,e){$(window).scroll(function(){if($("footer").offset().top-($(window).scrollTop()+$(window).height())<300){if(!$("button#toplistmemberscrollshowmore").length)return;var a=$("button#toplistmemberscrollshowmore").attr("data-page");$("button#toplistmemberscrollshowmore").remove();var i=e+"/nopage/1/page/"+a,n=$('
');$(t).find(".product-list").append(n),$(n).load(i,function(){generateTooltipster($(n).find(".tooltipuser"),"right")})}})}},CommunityTab={setup:function(){$("body").on("click","a.communitytab",function(t){t.preventDefault();var e=$(this).attr("href"),a=$(this).attr("data-href");0==$(e).find(".list").find(".user").length&&$(e).find(".list").append('').load(a,function(){generateTooltipster($(e).find(".tooltipuser"),"right"),$(e).find(".tooltipuserplings").length>0&&generateTooltipUserPlings($(e).find(".tooltipuserplings"),"right"),"#toplistMemberPanel"==e&&CommunityTabToplistMemberScrollPaging.setup(e,a),$(e).find(".opendesktopwidgetpager span").each(function(t){$(this).on("click",function(){$(this).parent().addClass("active").siblings().removeClass("active");var t=a+"/nopage/1/page/"+$(this).html();$(e).find(".product-list").html(""),$(e).find(".product-list").load(t,function(){generateTooltipster($(e).find(".tooltipuser"),"right"),$(e).find(".tooltipuserplings").length>0&&generateTooltipUserPlings($(e).find(".tooltipuserplings"),"right")})})})})});var t=document.location.hash;$('a[href="'+t+'"]').length>0?($('a[href="'+t+'"]').tab("show"),$('a[href="'+t+'"]').trigger("click")):(t="#supportersPanel",$('a[href="'+t+'"]').trigger("click")),$("body").on("mouseenter",".product-thumbnail-startpage",function(){$(this).popover("show")}),$("body").on("mouseleave",".product-thumbnail-startpage",function(){$(this).popover("hide")})}},TagingProduct={setup:function(){$("input[name=tagsuser]").tagify({whitelist:["good","great"],autocomplete:!0}).on("remove",function(t,e){console.log("removed",e)}).on("add",function(t,e){console.log("added",e)})}},TagingProductSelect2={setup:function(){$.fn.select2.amd.require(["select2/selection/search"],function(t){t.prototype.searchRemoveChoice=function(t,e){this.trigger("unselect",{data:e}),this.$search.val(""),this.handleSearch()}},null,!0);var t=$(".taggingSelect2").select2({placeholder:"Add Tags here ...",tags:!0,tokenSeparators:[","," "],minimumInputLength:3,maximumSelectionLength:5,width:"resolve",ajax:{url:"/tag/filter",dataType:"json",type:"GET",delay:500,processResults:function(t){return{results:t.data.tags}}}});t.on("select2:select",function(e){var a=e.params.data;$("#tagsuserselect").attr("data-pid"),t.parent().find("ul.select2-selection__rendered").find("li.select2-selection__choice").length>5?t.find("option[value='"+a.id+"']").remove():(new RegExp("^[0-9A-Za-z_.-]+$").test(a.text)||(t.find("option[value='"+a.id+"']").remove(),alert("Must be letter or number and can include hyphens")),a.text.length>10&&(t.find("option[value='"+a.id+"']").remove(),alert("Max. length 45 chars")))})}},TagingProductDetail={setup:function(){TagingProductDetailSelect2.setup(),$("body").on("click","button.topic-tags-btn",function(t){if($(this).toggleClass("Done"),$(".product_category").find(".usertagslabel").remove(),$(".tagsuserselectpanel").toggle(),"Done"==$(this).text()){$(this).text("Manage tags");var e="",a=$("li.select2-selection__choice");$.each(a,function(t,a){e=e+''+a.title+""}),$(".product_category").find(".topicslink").html(e)}else $(this).text("Done")})}},TagingProductDetailSelect2={setup:function(){$.fn.select2.amd.require(["select2/selection/search"],function(t){t.prototype.searchRemoveChoice=function(t,e){this.trigger("unselect",{data:e}),this.$search.val(""),this.handleSearch()}},null,!0);var t=$("#tagsuserselect").select2({placeholder:"Input tags please...",tags:!0,minimumInputLength:3,closeOnSelect:!0,maximumSelectionLength:5,tokenSeparators:[","," "],ajax:{url:"/tag/filter",dataType:"json",type:"GET",delay:500,processResults:function(t){return{results:t.data.tags}}}});t.on("select2:select",function(e){var a=e.params.data,i=$("#tagsuserselect").attr("data-pid");$.post("/tag/add",{p:i,t:a.id}).done(function(e){"error"==e.status?($("span.topic-tags-saved").css({color:"red"}).html(e.message).show().delay(2e3).fadeOut(),t.find("option[value='"+e.data.tag+"']").last().remove()):$("span.topic-tags-saved").css({color:"green"}).html(' Saved').show().delay(1e3).fadeOut()})}),t.on("select2:unselect",function(t){var e=t.params.data,a=$("#tagsuserselect").attr("data-pid");$.post("/tag/del",{p:a,t:e.id}).done(function(t){console.log(t),$("span.topic-tags-saved").css({color:"green"}).html(''+t.message).show().delay(1e3).fadeOut()})})}},TagingLoopMyProducts={setup:function(){TagingLoopMyProductsSelect2.setup(),$("body").on("click","button.topic-tags-btn",function(t){if($(this).toggleClass("Done"),$(this).parent().find(".topicsuser").html(""),$(this).parent().find(".tagsuserselectpanel").toggle(),"Done"==$(this).text()){$(this).text("Manage tags");var e="",a=$(this).parent().find("li.select2-selection__choice");$.each(a,function(t,a){e=e+''+a.title+""}),$(this).parent().find(".topicsuser").html(e)}else $(this).text("Done")})}},TagingLoopMyProductsSelect2={setup:function(){$.fn.select2.amd.require(["select2/selection/search"],function(t){t.prototype.searchRemoveChoice=function(t,e){this.trigger("unselect",{data:e}),this.$search.val(""),this.handleSearch()}},null,!0);var t=$(".taggingSelect2").select2({placeholder:"Input tags please...",tags:!0,minimumInputLength:3,closeOnSelect:!0,maximumSelectionLength:5,tokenSeparators:[","," "],ajax:{url:"/tag/filter",dataType:"json",type:"GET",delay:500,processResults:function(t){return{results:t.data.tags}}}});t.on("select2:select",function(e){var a=e.params.data,i=$(this).attr("id").replace("tagsuserselect","");$.post("/tag/add",{p:i,t:a.id}).done(function(e){"error"==e.status?($("#topic-tags-saved"+i).css({color:"red"}).html(e.message).show().delay(2e3).fadeOut(),t.find("option[value='"+e.data.tag+"']").last().remove()):"existing"==e.status?$("#topic-tags-saved"+i).css({color:"red"}).html(e.message).show().delay(2e3).fadeOut():$("#topic-tags-saved"+i).css({color:"green"}).html(' Saved').show().delay(1e3).fadeOut()})}),t.on("select2:unselect",function(t){var e=t.params.data,a=$(this).attr("id").replace("tagsuserselect","");$.post("/tag/del",{p:a,t:e.id}).done(function(t){$("#topic-tags-saved"+a).css({color:"green"}).html(''+t.message).show().delay(1e3).fadeOut()})})}},productRatingToggle={setup:function(){$("#showRatingAll").on("click",function(){$("#ratings-panel").find(".spinning").show(),setTimeout(function(){$("#ratings-panel").find(".spinning").hide()},500),$(".btnRateFilter").removeClass("activeRating"),$(this).addClass("activeRating"),$(".productRating-rows").show(),$(".productRating-rows-inactive").show()}),$("#showRatingActive").on("click",function(){$("#ratings-panel").find(".spinning").show(),setTimeout(function(){$("#ratings-panel").find(".spinning").hide()},500),$(".btnRateFilter").removeClass("activeRating"),$(this).addClass("activeRating"),$(".productRating-rows").show(),$(".productRating-rows-inactive").hide()}),$("#showRatingUpvotes").on("click",function(){$("#ratings-panel").find(".spinning").show(),setTimeout(function(){$("#ratings-panel").find(".spinning").hide()},500),$(".btnRateFilter").removeClass("activeRating"),$(this).addClass("activeRating"),$(".productRating-rows").show(),$(".clsDownvotes").hide(),$(".productRating-rows-inactive").hide()}),$("#showRatingDownvotes").on("click",function(){$("#ratings-panel").find(".spinning").show(),setTimeout(function(){$("#ratings-panel").find(".spinning").hide()},500),$(".btnRateFilter").removeClass("activeRating"),$(this).addClass("activeRating"),$(".productRating-rows").show(),$(".productRating-rows-inactive").hide(),$(".clsUpvotes").hide()})}},FilterBrowseOriginalFn={setup:function(){$("body").on("click","input#filter_browse_original",function(t){var e=$(this).is(":checked"),a=window.location.href;a.indexOf("browse")<0&&(a+="/browse/"),a.indexOf("filteroriginal")>0&&(a=a.substring(0,a.indexOf("filteroriginal"))),window.location.href=e?a+"filteroriginal/1":a+"filteroriginal/0"})}},FilterBrowseTagGroupFn={setup:function(){$("body").on("change","select.filter_browse_tag_group",function(t){var e=$(this).val(),a=$(this).attr("data_group_id");$.ajax({url:"/explore/savetaggroupfilter?group_id="+a+"&tag_id="+e,cache:!1}).done(function(t){var e=window.location.href;window.location.href=e})})}}; \ No newline at end of file +var newProductPage={setup:function(){function t(){var t=$("#donations-panel").find("#comments").height();t>$("#donations-panel").find("#supporters").height()&&$("#donations-panel").find("#supporters").height(t)}$(document).ready(function(){var e;e=$("#pling-it-box").height(),$(".scrollable-content").height(e),$(".scrollable-content").jScrollPane({mouseWheelSpeed:30}),t(),$('a[data-toggle="tab"]').on("shown.bs.tab",function(e){t()})})}},ImagePreview={hasError:!1,setup:function(){this.initProductPicture(),this.initTitlePicture(),this.initProfilePicture(),this.initProfilePictureBackground()},previewImage:function(t,e){if(t.files&&t.files[0]){var a=new FileReader,i=new Image,n=t.files[0];a.readAsDataURL(t.files[0]),a.onload=function(a){var o=$("#"+e);i.src=a.target.result,i.onload=function(){var e=this.width,i=this.height,r=n.type,s=(n.name,~~(n.size/1024));ImagePreview.hasError=!1,o.parent().parent().find("div.bg-danger").remove(),(e>2e3||e<20||i>2e3||i<20)&&(o.parent().parent().append('
Wrong image dimensions
'),$($(t).closest("form")[0]).trigger("reset"),ImagePreview.hasError=!0),s>2e3&&(o.parent().parent().append('
File too large
'),$($(t).closest("form")[0]).trigger("reset"),ImagePreview.hasError=!0);/(jpg|jpeg|png|gif)$/i.exec(r)||(o.parent().parent().append('
Invalid file type: '+n.type+"
"),$($(t).closest("form")[0]).trigger("reset"),ImagePreview.hasError=!0),0==ImagePreview.hasError&&(ImagePreview.hasError=!1,o.attr("src",a.target.result),o.show())},i.onerror=function(){o.parent().parent().find("div.bg-danger").remove(),o.parent().parent().append('
Invalid file type: '+n.type+"
")},"product-picture-preview"==e?$("button#add-product-picture").text("CHANGE LOGO"):"title-picture-preview"==e?$("button#add-title-picture").text("CHANGE BANNER"):"profile-picture-preview"==e?($("button#add-profile-picture").text("CHANGE PICTURE"),$("input#profile_img_src").val("local")):"profile-picture-bg-preview"==e&&$("button#add-profile-picture-background").text("CHANGE PICTURE")}}},previewImageMember:function(t,e){if(t.files&&t.files[0]){var a=new FileReader,i=new Image;t.files[0];a.readAsDataURL(t.files[0]),a.onload=function(t){var a=$("#"+e);i.src=t.target.result,i.onload=function(){ImagePreview.hasError=!1,a.parent().find(".image-error").remove(),0==ImagePreview.hasError&&(a.attr("src",t.target.result),a.show())},i.onerror=function(){a.parent().append('
Invalid file type
')},"profile-picture-background-preview"==e&&$("button#add-profile-picture-background").text("CHANGE PICTURE")}}},readImage:function(t){var e=new FileReader,a=new Image;e.readAsDataURL(t),e.onload=function(e){a.src=e.target.result,a.onload=function(){var e=this.width,a=this.height,i=t.type,n=t.name,o=~~(t.size/1024)+"KB";$("#uploadPreview").append(' '+e+"x"+a+" "+o+" "+i+" "+n+"
")},a.onerror=function(){alert("Invalid file type: "+t.type)}}},initProductPicture:function(){if(0!=$("#image_small").length&&0!=$("#image_small").attr("value").length){var t=$("#image_small").data("target");$(t).attr("src","https://cn.opendesktop.org/cache/200x200-2/img/"+$("#image_small").attr("value")),$(t).show(),$("button#add-product-picture").text("CHANGE LOGO")}},initTitlePicture:function(){if(0!=$("#image_big").length&&0!=$("#image_big").attr("value").length){var t=$("#image_big").data("target");$(t).attr("src","https://cn.opendesktop.org/cache/200x200-2/img/"+$("#image_big").attr("value")),$(t).show(),$("button#add-title-picture").text("CHANGE BANNER")}},initProfilePicture:function(){if(0!=$("#profile_image_url").length&&0!=$("#profile_image_url").attr("value").length){var t=$("#profile_image_url").data("target");$(t).attr("src",$("#profile_image_url").attr("value")),$("#profile-picture").attr("src",$("#profile_image_url").attr("value")),$(t).show(),$("button#add-profile-picture").text("CHANGE PICTURE")}},initProfilePictureBackground:function(){if(0!=$("#profile_image_url_bg").length&&0!=$("#profile_image_url_bg").attr("value").length){var t=$("#profile_image_url_bg").data("target");$(t).attr("src",$("#profile_image_url_bg").attr("value")),$("#profile-picture-background-preview").attr("src",$("#profile_image_url_bg").attr("value")),$(t).show(),$("button#add-profile-picture-background").text("CHANGE PICTURE")}}},MenuHover={setup:function(){$("body").on("click","a#login-dropdown",function(t){t.stopPropagation(),$(".header-login-container").toggleClass("active")}).on("click",".header-login-container",function(t){t.stopPropagation()}).on("click","a.menu-trigger",function(t){t.stopPropagation();var e="."+$(this).attr("rel");$(e).toggleClass("active")}).on("mouseup",function(t){var e=$("ul.profile-menu");$("li.profile-menu-container a.menu-trigger").is(t.target)||e.is(t.target)||0!==e.has(t.target).length||e.removeClass("active")}).on("mouseup",function(t){container=$("div.header-login-container"),trigger=$("a#login-dropdown"),trigger.is(t.target)||container.is(t.target)||0!==container.has(t.target).length||container.removeClass("active")}).click(function(){$(".header-login-container.active").removeClass("active"),$(".profile-menu.active").removeClass("active")})}},ButtonCode={setup:function(){$("#button-code-heading").click(function(){$(this).hasClass("button-code-active")?($(this).removeClass("button-code-active"),$(this).parent().find(".button-code").slideUp("fast"),$(this).parent().find(".button-code").css("border-bottom","none"),$(this).find(".icon-expand-code").css("background-image","url(img/icon-expand.png)")):($(this).addClass("button-code-active"),$(this).parent().find(".button-code").css("border-bottom","1px solid #bdc3c7"),$(this).parent().find(".button-code").slideDown("fast"),$(this).find(".icon-expand-code").css("background-image","url(img/icon-contract.png)"))})},setupClipboardCopy:function(t){$(t).on("mouseover",function(){$(this).off("mouseover"),$(this).find("[data-clipboard-target]").each(function(){var t=$($(this).attr("data-clipboard-target"));$(this).zclip({path:"/theme/flatui/js/lib/ZeroClipboard.swf",copy:$.trim($(t).text())})})})}},ProductPage={setup:function(){$(".dropdown-toggle").dropdown(),$(".scroll-pane").jScrollPane({mouseWheelSpeed:30,animateScroll:!0}),$(".love-it").on("click",function(){this_img_src=$(this).find("img").attr("src"),$(this).hasClass("no-login")||"/theme/flatui/img/icon-like-color.png"==this_img_src||$(this).prev(".share-it").trigger("click")}),$(".payment-options").find(".options").find("span.option").on("click",function(){var t=$(this).attr("title"),e=$(".payment-options").find('input[type="number"]');e.attr("value",t).val(t),e.focus(),$(".options").find(".selected").removeClass("selected"),$(this).addClass("selected")})},setupPlingButton:function(){$("#pling-amount").on("focus",function(){$("#pling-amount").popover("destroy")}),$("#pling-start").on("click",function(t){return validateElement=$("#pling-amount"),validateValue=validateElement.val(),""==validateValue||isNaN(parseFloat(validateValue))||!isFinite(validateValue)?(t.preventDefault(),$("#pling-amount").popover({placement:"bottom",html:"true",content:'
Donation must be a numeric value.
'}).popover("show"),!1):(minValue=validateElement.attr("min"),parseFloat(validateValue)×
Donation must be equal or greater than '+minValue+".
"}).popover("show"),!1):(maxValue=validateElement.attr("max"),parseFloat(validateValue)>parseFloat(maxValue)?(t.preventDefault(),$("#pling-amount").popover({placement:"bottom",html:"true",content:'
Donation must be smaller or equal than '+maxValue+".
"}).popover("show"),!1):void 0))})}},SlideShowRender={setup:function(){$("#slideshow-container").find("img:first").addClass("active"),$("#slideshow-container").find("#navigation").find("a:first").addClass("active")}},ProductSlideShow={setup:function(){$("#slideshow-container").find("#arrows").find("a").on("click",function(t){var e=$(this).attr("id"),a=$("#slideshow-container #slides"),i=a.find("img.active"),n=i.attr("rel"),o=$("#slideshow-container").find("#navigation").find("a.active");if("prev"==e){var r=parseInt(n)-parseInt(1),s=$("#slideshow-container").find('img[rel="'+r+'"]'),l=$("#slideshow-container").find("#navigation").find('a[rel="'+r+'"]');1==!s.size()&&(s=a.find("img:last"),l=$("#slideshow-container").find("#navigation").find("a:last"))}else if("next"==e){var d=parseInt(n)+parseInt(1);s=$("#slideshow-container").find('img[rel="'+d+'"]'),l=$("#slideshow-container").find("#navigation").find('a[rel="'+d+'"]'),1==!s.size()&&(s=a.find("img:first"),l=$("#slideshow-container").find("#navigation").find("a:first"))}i.removeClass("active"),o.removeClass("active"),s.addClass("active"),l.addClass("active")}),$("#slideshow-container").find("#navigation").find("a").on("click",function(){var t=$(this).attr("rel"),e=$("#slideshow-container").find('img[rel="'+t+'"]');$("#slideshow-container").find("img.active").removeClass("active"),e.addClass("active"),$("#slideshow-container").find("#navigation").find("a.active").removeClass("active"),$(this).addClass("active")})}},SlideShow={setup:function(){slideShowInterval=setTimeout(function(){var t=$("#slideshow-container").find("img.active"),e=t.attr("rel"),a=parseInt(e)+parseInt(1),i=$("#slideshow-container").find('img[rel="'+a+'"]'),n=$("#slideshow-container").find("#navigation").find("a.active");t.removeClass("active"),n.removeClass("active"),1==i.size()?(i.addClass("active"),$("#slideshow-container").find("#navigation").find('a[rel="'+a+'"]').addClass("active")):($("#slideshow-container").find("img:first").addClass("active"),$("#slideshow-container").find("#navigation").find("a:first").addClass("active"))},4e3)}},Popuppanel={setup:function(){$("body").on("click","a.popuppanel",function(t){if("_blank"===$(this).attr("target"))console.log("dont prevent default");else{t.preventDefault();var e=$(this).attr("href");$.fancybox({hideOnContentClick:!0,autoScale:!0,cyclic:"true",transitionIn:"elastic",transitionOut:"elastic",type:"iframe",scrolling:"auto",helpers:{overlay:{locked:!1}},autoSize:!0,href:e,type:"ajax"})}})}},PlingsRedirect={setup:function(){window.location.hash?($link=$(window.location.hash),$link.trigger("click")):document.location.hash&&($link=$(document.location.hash),$link.trigger("click"))}},ShowPopups={setup:function(){window.location.hash&&(alert("Hash"),$('a[href="'+document.location.hash+'"]').trigger("click")),document.location.hash&&(alert("Hash"),$('a[href="'+document.location.hash+'"]').trigger("click"))}};$("body").on("mouseenter",".supporter-thumbnail",function(){$(this).popover("show")}),$("body").on("mouseleave",".supporter-thumbnail",function(){$(this).popover("hide")});var Partials={setup:function(){$("body").on("click","a.partial",function(t){t.preventDefault();var e=this.href,a=$(this).attr("data-target"),i=$(this).data("toggle"),n=$(this).attr("data-fragment");return $(a).load(e+" "+n,function(t,e,n){if("error"==e)if(401==n.status){if(t){var o=jQuery.parseJSON(t).login_url;window.location=o||"/login"}}else $(a).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.");i&&$(i).modal("show")}),!1})}},Opendownloadfile={setup:function(){$("body").on("click","a.opendownloadfile",function(t){t.preventDefault();var e=$(this).attr("data-file_id"),a=$(this).attr("data-file_type"),i=$(this).attr("data-file_name"),n=$(this).attr("data-file_size"),o=$(this).attr("data-project_id"),r=$(this).attr("data-link_type");return $.fancybox({hideOnContentClick:!0,autoScale:!0,scrolling:"no",cyclic:"true",transitionIn:"elastic",transitionOut:"elastic",type:"iframe",width:"600",height:"350",iframe:{scrolling:"no"},autoSize:!1,id:"opendownloadfilepopup",helpers:{overlay:{locked:!1}},href:"/dl?file_id="+e+"&file_type="+a+"&file_name="+i+"&file_size="+n+"&project_id="+o+"&link_type="+r}),!1})}},PartialsButton={setup:function(){$("body").on("click","Button.partialbutton",function(t){t.preventDefault();var e=$(this).attr("data-href"),a=$(this).attr("data-target"),i=$(this).data("toggle"),n=$(this).attr("data-fragment"),o=$('');return $(a).append(o),$(a).load(e+" "+n,function(t,e,n){if("error"==e)if(401==n.status){if(t){var o=jQuery.parseJSON(t).login_url;window.location=o||"/login"}}else $(a).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.");i&&$(i).modal("show")}),!1})}},PartialsButtonHeartDetail={setup:function(){$("body").on("click",".partialbuttonfollowproject",function(t){t.preventDefault();var e=$(this).attr("data-href"),a=$(this).attr("data-target"),i=$(this).attr("data-auth");if($(this).data("toggle"),$(this).attr("data-fragment"),i){if($("#like-product-modal").find("#loginuser").val()==$("#like-product-modal").find("#productcreator").val())return $("#like-product-modal").find("#votelabel").text("Project owner not allowed"),$("#like-product-modal").find(".modal-body").empty(),void $("#like-product-modal").modal("show");var n=$('');return $(a).prepend(n),$.ajax({url:e,cache:!1}).done(function(t){$(a).find(".spinning").remove(),"error"==t.status?$(a).html(t.msg):"delete"==t.action?($(a).find(".plingtext").html(t.cnt),$(a).find(".plingtext").addClass("heartnumberpurple"),$(a).find(".plingheart").removeClass("heartproject").addClass("heartgrey"),$(a).find(".plingheart").removeClass("fa-heart").addClass("fa-heart-o")):($(a).find(".plingtext").html(t.cnt),$(a).find(".plingtext").removeClass("heartnumberpurple"),$(a).find(".plingheart").removeClass("heartgrey").addClass("heartproject"),$(a).find(".plingheart").removeClass("fa-heart-o").addClass("fa-heart"))}),!1}$("#like-product-modal").modal("show")})}},PartialsButtonPlingProject={setup:function(){$("#plingbtn").hover(function(){$(this).attr("src","/images/system/pling-btn-hover.png")},function(){$(this).attr("src",$(this).attr("data-src"))}),$("body").on("click",".partialbuttonplingproject",function(t){t.preventDefault();var e=$(this).attr("data-href"),a=$(this).attr("data-target"),i=$(this).attr("data-auth"),n=$(this).attr("data-issupporter");if($(this).data("toggle"),$(this).attr("data-fragment"),i)return $("#like-product-modal").find("#loginuser").val()==$("#like-product-modal").find("#productcreator").val()?($("#like-product-modal").find("#votelabel").text("Project owner not allowed"),$("#like-product-modal").find(".modal-body").empty(),void $("#like-product-modal").modal("show")):n?($(a).find(".plingnum").html(''),$.ajax({url:e,cache:!1}).done(function(t){"error"==t.status?$(a).html(t.msg):"delete"==t.action?(0==t.cnt?$(a).find(".plingnum").html("Pling me"):$(a).find(".plingnum").html(t.cnt+" Plings"),$(a).find("#plingbtn").attr("src","/images/system/pling-btn-normal.png"),$(a).find("#plingbtn").attr("data-src","/images/system/pling-btn-normal.png")):($(a).find(".plingnum").html(t.cnt+" Plings"),$(a).find("#plingbtn").attr("src","/images/system/pling-btn-active.png"),$(a).find("#plingbtn").attr("data-src","/images/system/pling-btn-active.png"))}),!1):($("#like-product-modal").find("#votelabel").html('
To pling a product and help the artist please consider becoming a supporter. Thanks!

Become a supporter
'),void $("#like-product-modal").modal("show"));$("#like-product-modal").modal("show")})}},PartialsReview={setup:function(){$("body").on("click","a.partialreview",function(t){if(t.preventDefault(),this.href,$(this).attr("data-target"),$(this).data("toggle"),$(this).attr("data-fragment"),$("#review-product-modal").find("#loginuser").val()==$("#review-product-modal").find("#productcreator").val())return $("#review-product-modal").find("#votelabel").text("Project owner not allowed"),$("#review-product-modal").find(".modal-body").empty(),void $("#review-product-modal").modal("show");var e=$("#review-product-modal").find("#userrate").val();return $(this).hasClass("voteup")?1==e?($("#review-product-modal").find("#votelabel").empty().append(' is given already with comment:'),$("#review-product-modal").find("#commenttext").val($("#review-product-modal").find("#otxt").val()),$("#review-product-modal").find(":submit").text("Remove Rating")):($("#review-product-modal").find("input#voteup").val(1),$("#review-product-modal").find("#votelabel").empty().append(' Add Comment (min. 1 char):'),$("#review-product-modal").find("#commenttext").val("+"),$("#review-product-modal").find(":submit").text("Rate Now"),$("#review-product-modal").find("#commenttext").removeAttr("disabled"),$("#review-product-modal").find(":submit").css("display","block").removeAttr("disabled")):0==e?($("#review-product-modal").find("#votelabel").empty().append(' is given already with comment: '),$("#review-product-modal").find("#commenttext").val($("#review-product-modal").find("#otxt").val()),$("#review-product-modal").find(":submit").text("Remove Rating")):($("#review-product-modal").find("input#voteup").val(2),$("#review-product-modal").find("#votelabel").empty().append(' Add Comment (min. 5 char) Please explain the reason for downvote to help the creator to make it better '),$("#review-product-modal").find("#commenttext").val("-"),$("#review-product-modal").find("#commenttext").removeAttr("disabled"),$("#review-product-modal").find(":submit").removeAttr("disabled").css("display","block"),$("#review-product-modal").find(":submit").text("Rate Now")),$("#review-product-modal").modal("show"),$("#review-product-modal").hasClass("noid")&&setTimeout(function(){$("#review-product-modal").modal("hide")},2e3),!1})}},PartialsReviewDownloadHistory={setup:function(){$("body").on("click","button.partialReviewDownloadHistory",function(t){t.preventDefault();var e=$(this).attr("data-userrate");return $("#review-product-modal").find("#commenttext").val($(this).attr("data-comment")),$("#review-product-modal").find("#form_p").val($(this).attr("data-project")),$(this).hasClass("voteup")?1==e?($("#review-product-modal").find("#votelabel").empty().append(' is given already with comment:'),$("#review-product-modal").find(":submit").attr("disabled","disabled").css("display","none"),$("#review-product-modal").find("#commenttext").attr("disabled","disabled")):($("#review-product-modal").find("input#voteup").val(1),$("#review-product-modal").find("#votelabel").empty().append(' Add Comment (min. 1 char):'),$("#review-product-modal").find("#commenttext").val("+"),$("#review-product-modal").find("#commenttext").removeAttr("disabled"),$("#review-product-modal").find(":submit").css("display","block").removeAttr("disabled")):0==e?($("#review-product-modal").find("#votelabel").empty().append(' is given already with comment: '),$("#review-product-modal").find("#commenttext").attr("disabled","disabled"),$("#review-product-modal").find(":submit").attr("disabled","disabled").css("display","none")):($("#review-product-modal").find("input#voteup").val(2),$("#review-product-modal").find("#votelabel").empty().append(' Add Comment (min. 5 chars): '),$("#review-product-modal").find("#commenttext").val("-"),$("#review-product-modal").find("#commenttext").removeAttr("disabled"),$("#review-product-modal").find(":submit").removeAttr("disabled").css("display","block")),$("#review-product-modal").modal("show"),$("#review-product-modal").hasClass("noid")&&setTimeout(function(){$("#review-product-modal").modal("hide")},2e3),!1})}},PartialForms={setup:function(){$("body").on("submit","form.partial",function(t){t.preventDefault(),t.stopImmediatePropagation(),$(this).find(":submit").attr("disabled","disabled"),$(this).find(":submit").css("white-space","normal");var e=$('');$(this).find(":submit").append(e);var a=$(this).attr("data-target"),i=$(this).attr("data-trigger");return console.log(this),jQuery.ajax({data:$(this).serialize(),url:this.action,type:this.method,error:function(){return $(a).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
"),!1},success:function(t){return $(a).empty().html(t),$(a).find(i).trigger("click"),!1}}),!1})}},PartialJson={setup:function(){$("body").on("submit","form.partialjson",function(t){t.preventDefault(),t.stopImmediatePropagation();var e=$(this).attr("data-target"),a=$(this).attr("data-trigger");return jQuery.ajax({data:$(this).serialize(),url:this.action,type:this.method,dataType:"json",error:function(){$(e).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
")},success:function(t,i){t.redirect?window.location=t.redirect:(e&&$(e).empty().html(t.message),a&&$(e).find(a).trigger("click"))}}),!1})}},PartialJsonFraud={setup:function(){$("body").on("submit","form.partialjsonfraud",function(t){t.preventDefault(),t.stopImmediatePropagation();var e=$(this).attr("data-target"),a=$(this).attr("data-trigger");return $("form.partialjsonfraud").find("#report-text").val().length<5?($("form.partialjsonfraud").find("p.warning").remove(),$("form.partialjsonfraud").find("#report-text").parent().append('

at least 5 chars

'),!1):(jQuery.ajax({data:$(this).serialize(),url:this.action,type:this.method,dataType:"json",error:function(){$(e).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
")},success:function(t,i){t.redirect?window.location=t.redirect:(e&&$(e).empty().html(t.message),a&&$(e).find(a).trigger("click"))}}),!1)})}},PartialPayPal={setup:function(){this.initPayPalForm(),this.initPayPalFee()},initPayPalForm:function(){$("body").on("submit","form.partialpaypal",function(t){t.preventDefault(),t.stopImmediatePropagation();var e=$(this).attr("data-target"),a=$(this).attr("data-trigger");return jQuery.ajax({data:$(this).serialize(),url:this.action,type:this.method,error:function(t,e,a){$("#modal-dialog").modal("hide");var i=$('');i.html($(t.responseText).filter(".page-container").children()),i.append(''),setTimeout(function(){i.modal("show")},900)},success:function(t){$(e).empty().html(t),$(e).find(a).trigger("click"),$("#modal-dialog").modal("hide")}}),!1})},initPayPalFee:function(){$("body").on("change","#amount_plings",function(t){PartialPayPal.changeFee()})},changeFee:function(){var t=document.getElementById("amount_plings"),e=parseFloat(t.value),a=this.round(.05*e,2),i=.03*(a+e+.3)+.3,n=e+a+(i=this.round(i,2));document.getElementById("pling_fee").value=this.round(a,2).toFixed(2),document.getElementById("paypal_fee").value=this.round(i,2).toFixed(2),document.getElementById("sum").value=this.round(n,2)},round:function(t,e){var a=Math.pow(10,e);return Math.round(t*a)/a}},PartialCommentReviewForm={setup:function(){this.initForm()},initForm:function(){$("body").on("submit","form.product-add-comment-review",function(t){t.preventDefault(),t.stopImmediatePropagation();var e=$.trim($("#commenttext").val());if(2==$("#voteup").val()&&e.length<5)0==$("#review-product-modal").find("#votelabel").find(".warning").length&&$("#review-product-modal").find("#votelabel").append("
Please give a comment, thanks!");else{if(!(e.length<1)){$(this).find(":submit").attr("disabled","disabled"),$(this).find(":submit").css("white-space","normal");var a=$('');return $(this).find(":submit").append(a),jQuery.ajax({data:$(this).serialize(),url:this.action,type:this.method,error:function(t,e,a){$("#review-product-modal").modal("hide");var i=$("#generic-dialog");i.modal("hide"),i.find(".modal-header-text").empty().append("Please try later."),i.find(".modal-body").empty().append("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
"),setTimeout(function(){i.modal("show")},900)},success:function(t){$("#review-product-modal").modal("hide"),location.reload()}}),!1}0==$("#review-product-modal").find("#votelabel").find(".warning").length&&$("#review-product-modal").find("#votelabel").append("
Please give a comment, thanks!")}})}},PartialFormsAjax={setup:function(){var t=$("form.partialajax"),e=t.attr("data-target"),a=t.attr("data-trigger");$(t).find(":submit").on("click",function(e){e.preventDefault(),$(t).find(":submit").attr("disabled","disabled"),$(t).find(":submit").css("white-space","normal");var a=$('');$(t).find(":submit").append(a),$(t).submit()}),t.ajaxForm({error:function(){$(e).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
")},success:function(t){$(e).empty().html(t),$(e).find(a).trigger("click")}})}},AjaxFormWithProgress={setup:function(t){var e=$(t),a=e.attr("data-target"),i=e.attr("data-trigger"),n=e.find(".progress-bar"),o=e.find(".progress-percent");$(e).find(":submit").on("click",function(t){t.preventDefault(),$(e).find(":submit").attr("disabled","disabled"),$(e).find(":submit").css("white-space","normal");var a=$('');$(e).find(":submit").append(a),$(e).submit()}),e.ajaxForm({beforeSend:function(){n.parent().removeClass("hidden"),n.width("0%"),o.html("0%")},uploadProgress:function(t,e,a,i){var r=i+"%";n.width(r),o.html(r)},error:function(){$(a).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
")},success:function(t){n.width("100%"),o.html("100%"),$(a).empty().html(t),$(a).find(i).trigger("click")}})}},PartialFormsAjaxMemberBg={setup:function(){var t=$("form.partialajaxbg"),e=t.attr("data-target"),a=t.attr("data-trigger");$(t).find(":submit").on("click",function(e){e.preventDefault(),$(t).find(":submit").attr("disabled","disabled"),$(t).find(":submit").css("white-space","normal");var a=$('');$(t).find(":submit").append(a),$(t).submit()}),t.ajaxForm({error:function(){$(e).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.
")},success:function(t){$(e).empty().html(t),$(e).find(a).trigger("click")}})}},AjaxForm={setup:function(t,e){var a=$(e);$("body").on("submit","form.product-add-comment",function(t){return t.preventDefault(),t.stopImmediatePropagation(),$(this).find("button").attr("disabled","disabled"),$(this).find(".glyphicon.glyphicon-send").removeClass("glyphicon-send").addClass("glyphicon-refresh spinning"),jQuery.ajax({data:$(this).serialize(),url:this.action,type:this.method,dataType:"json",error:function(t,e,a){var i=JSON&&JSON.parse(t.responseText)||$.parseJSON(t.responseText),n=$("#generic-dialog");n.modal("hide"),n.find(".modal-header-text").empty().append(i.title),n.find(".modal-body").empty().append(i.message),setTimeout(function(){n.modal("show")},900)},success:function(t){"ok"==t.status&&$(a).empty().html(t.data),"error"==t.status&&(""!=t.message?alert(t.message):alert("Service is temporarily unavailable."))}}),!1})}},WidgetModalAjax={setup:function(){$(".my-product-item").find("a.widget-button").on("click",function(){var t=$(this).attr("rel"),e=t.split("product")[1],a=$(".modal-body#widget-code-"+t);$.ajax({url:"/widget/config/"+e,type:"html",success:function(t){a.prepend(t),angular.bootstrap(a,["widgetApp"])}})})}},LoginContainer={update:function(){Date.now||(Date.now=function(){return(new Date).getTime()});var t="/authorization/htmllogin?"+(Date.now()/1e3|0);$("#login_container").load(t,function(t,e,a){})}},RssNews={setup:function(){$.getJSON("https://blog.opendesktop.org/?json=1&callback=?",function(t){var e="";$.each(t.posts,function(t,a){if(t>=3)return!1;var i=moment(a.date);e+='
'+a.title+'
'+i.format("MMM DD YYYY")+''+a.comments.length+" Comment"+(a.comments.length>1?"s":"")+"
"}),$("#rss-feeds").html(e)})}},BlogJson={setup:function(){var t="https://forum.opendesktop.org/";$.ajax("https://forum.opendesktop.org/latest.json").then(function(e){var a=e.topic_list.topics,i="",n=3;a.sort(function(t,e){return new Date(e.last_posted_at)-new Date(t.last_posted_at)}),$.each(a,function(e,a){if(!a.pinned){var o=moment(a.last_posted_at),r="Reply",s=a.posts_count-1;r=0==s?"Replies":1==s?"Reply":"Replies",i+='
'+a.title+'
'+o.fromNow()+''+s+" "+r+"
",n--}if(0==n)return!1}),$("#blogJson").html(i)})}},GitlabNewProjectsJson={setup:function(t){var e=t+"/api/v4/projects?order_by=created_at&sort=desc&visibility=public&page=1&per_page=5";$.ajax(e).then(function(e){var a=e,i="";$.each(a,function(e,a){var n=moment(a.created_at);i+='"}),$("#lastgitprojects").html(i)})}};function showGitUserAvatar(t,e,a){var i=t+"/api/v4/users?username="+e;$.ajax(i).then(function(t){var i=t;$.each(i,function(t,i){$img=$("#avatar_"+e+"_"+a),$img.attr("src",i.avatar_url)})})}var ProductDetailCarousel={setup:function(){$(".carousel-inner img").each(function(t){$(this).on("click",function(){$("#product-main-img-container").hasClass("imgfull")?$("#product-main-img-container").prependTo($("#product-main")):$("#product-main-img-container").prependTo($("#product-page-content")),$("#product-main-img-container").toggleClass("imgfull"),$("#product-main-img-container").toggleClass("imgsmall")})})}},AppimagequestionOnClick={setup:function(t){$("body").on("click","i.appimagequestion",function(t){var e=$("#generic-dialog");e.modal("show"),e.find(".modal-header-text").empty().append("AppImage Info"),e.find(".modal-body").empty().append("")})}},ProductDetailBtnGetItClick={setup:function(t){$("body").on("click","button#project_btn_download",function(e){$.fancybox({hideOnContentClick:!0,autoScale:!0,cyclic:"true",transitionIn:"elastic",transitionOut:"elastic",type:"ajax",helpers:{overlay:{locked:!1}},autoSize:!0,href:"/p/"+t+"/ppload"})})}},GhnsExcludedClick={setup:function(t){$("body").on("click","#ghns_excluded-this-checkbox",function(e){e.stopPropagation();var a=1,i="",n="";this.checked?(a=1,i="Please specify why this product should be excluded (min 5 chars) :",n=" ghns exclude"):(a=0,i="Please specify why this product should be included (min 5 chars) :",n=" ghns include");var o=$("#generic-dialog");return o.modal("show"),o.find(".modal-header-text").empty().append("GHNS "),o.find(".modal-body").empty().append(i+'

"),$("body").on("click","#btn-ghns-excluded",function(){var t=$("#ghns-excluded-text").val();if(t.length<5)return alert("min 5 chars"),!1;var e=$(this).attr("data-projectid"),a=$(this).attr("data-status");$.ajax({url:"/backend/project/doghnsexclude",method:"POST",data:{project_id:e,ghns_excluded:a,msg:t},success:function(t){var e=$("#generic-dialog");0==a?(e.find(".modal-body").empty().append("Project is successfully included into GHNS"),$("#ghns_excluded-this-checkbox").prop("checked",!1)):(e.find(".modal-body").empty().append("Project is successfully excluded into GHNS"),$("#ghns_excluded-this-checkbox").prop("checked",!0)),setTimeout(function(){e.modal("hide")},1e3)},error:function(){alert("Service is temporarily unavailable.")}})}),!1})}},AboutMeMyProjectsPaging={setup:function(){$(window).scroll(function(){if($("footer").offset().top-($(window).scrollTop()+$(window).height())<300){if(!$("button#btnshowmoreproducts").length)return;let t='',e=$("button#btnshowmoreproducts").attr("data-page");$("button#btnshowmoreproducts").remove(),$url=window.location.href,target="#my-products-list";let a=$("

").append(t).load($url,{projectpage:e},function(t,e,a){if("error"==e)if(401==a.status){if(t){var i=jQuery.parseJSON(t).login_url;window.location=i||"/login"}}else $(target).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.")});$("#my-products-list").append(a)}})}},AboutMeMyProjectsPagingButton={setup:function(){$("body").on("click","button#btnshowmoreproducts",function(t){let e=$(this).attr("data-page");$(this).remove(),$url=window.location.href,target="#my-products-list";let a=$("
").append('').load($url,{projectpage:e},function(t,e,a){if("error"==e)if(401==a.status){if(t){var i=jQuery.parseJSON(t).login_url;window.location=i||"/login"}}else $(target).empty().html("Service is temporarily unavailable. Our engineers are working quickly to resolve this issue.
Find out why you may have encountered this error.")});$("#my-products-list").append(a)})}},ProductDetailCommentTooltip={setup:function(){TooltipUser.setup("tooltipuser","right")}};function generateTooltipster(t,e){$(t).each(function(){$(this).tooltipster({side:e,theme:["tooltipster-light","tooltipster-light-customized"],contentCloning:!0,contentAsHTML:!0,interactive:!0,functionBefore:function(t,e){var a=$(e.origin),i=a.attr("data-user");!0!==a.data("loaded")&&$.get("/member/"+i+"/tooltip/",function(e){var i=e.data,n='
'+i.username+' '+i.countrycity+'
'+i.cntProjects+' products
'+i.totalComments+' comments
Likes '+i.cntLikesGave+' products
Got '+i.cntLikesGot+' Likes
Last time active : '+i.lastactive_at+'
Member since : '+i.created_at+"
";n+="
",t.content(n),a.data("loaded",!0)})}})})}var TooltipUser={setup:function(t,e){$("."+t).tooltipster({side:e,theme:["tooltipster-light","tooltipster-light-customized"],contentCloning:!0,contentAsHTML:!0,interactive:!0,functionBefore:function(t,e){var a=$(e.origin),i=a.attr("data-user");!0!==a.data("loaded")&&$.get("/member/"+i+"/tooltip/",function(e){var i=e.data,n='
'+i.username+' '+i.countrycity+'
'+i.cntProjects+' products
'+i.totalComments+' comments
Likes '+i.cntLikesGave+' products
Got '+i.cntLikesGot+' Likes
Last time active : '+i.lastactive_at+'
Member since : '+i.created_at+"
";n+="
",t.content(n),a.data("loaded",!0)})}})}};function generateTooltipUserPlings(t,e){$(t).each(function(){$(this).tooltipster({side:e,theme:["tooltipster-light","tooltipster-light-customized"],contentCloning:!0,contentAsHTML:!0,interactive:!0,functionBefore:function(t,e){var a=$(e.origin),i=a.attr("data-user");!0!==a.data("loaded")&&$.get("/plings/tooltip/id/"+i,function(e){var i='
';$.each(e.data,function(t,e){if(t>10)return!1;e.profile_image_url.indexOf("http")<0&&(e.profile_image_url="https://cn.opendesktop.org/cache/40x40-2/img/"+e.profile_image_url),e.profile_image_url.indexOf(".gif")>0&&(e.profile_image_url="https://cn.opendesktop.org/img/"+e.profile_image_url),i=i+'
'+e.username+"
"}),i+="
",t.content(i),a.data("loaded",!0)})}})})}var TooltipUserPlings={setup:function(t,e){$("."+t).tooltipster({side:e,theme:["tooltipster-light","tooltipster-light-customized"],contentCloning:!0,contentAsHTML:!0,interactive:!0,functionBefore:function(t,e){var a=$(e.origin),i=a.attr("data-user");!0!==a.data("loaded")&&$.get("/plings/tooltip/id/"+i,function(e){var i='
';$.each(e.data,function(t,e){if(t>10)return!1;e.profile_image_url.indexOf("http")<0&&(e.profile_image_url="https://cn.opendesktop.org/cache/40x40-2/img/"+e.profile_image_url),e.profile_image_url.indexOf(".gif")>0&&(e.profile_image_url="https://cn.opendesktop.org/img/"+e.profile_image_url),i=i+'
'+e.username+"
"}),i+="
",t.content(i),a.data("loaded",!0)})}})}},AboutMePage={setup:function(t){var e=t+"'s Profile "+$(document).prop("title");$(document).prop("title",e)}},InitActiveHashTab={setup:function(){var t=document.location.hash;$('a[href="'+t+'"]')&&$('a[href="'+t+'"]').tab("show")}},CommunityTabToplistMemberScrollPaging={setup:function(t,e){$(window).scroll(function(){if($("footer").offset().top-($(window).scrollTop()+$(window).height())<300){if(!$("button#toplistmemberscrollshowmore").length)return;var a=$("button#toplistmemberscrollshowmore").attr("data-page");$("button#toplistmemberscrollshowmore").remove();var i=e+"/nopage/1/page/"+a,n=$('
');$(t).find(".product-list").append(n),$(n).load(i,function(){generateTooltipster($(n).find(".tooltipuser"),"right")})}})}},CommunityTab={setup:function(){$("body").on("click","a.communitytab",function(t){t.preventDefault();var e=$(this).attr("href"),a=$(this).attr("data-href");0==$(e).find(".list").find(".user").length&&$(e).find(".list").append('').load(a,function(){generateTooltipster($(e).find(".tooltipuser"),"right"),$(e).find(".tooltipuserplings").length>0&&generateTooltipUserPlings($(e).find(".tooltipuserplings"),"right"),"#toplistMemberPanel"==e&&CommunityTabToplistMemberScrollPaging.setup(e,a),$(e).find(".opendesktopwidgetpager span").each(function(t){$(this).on("click",function(){$(this).parent().addClass("active").siblings().removeClass("active");var t=a+"/nopage/1/page/"+$(this).html();$(e).find(".product-list").html(""),$(e).find(".product-list").load(t,function(){generateTooltipster($(e).find(".tooltipuser"),"right"),$(e).find(".tooltipuserplings").length>0&&generateTooltipUserPlings($(e).find(".tooltipuserplings"),"right")})})})})});var t=document.location.hash;$('a[href="'+t+'"]').length>0?($('a[href="'+t+'"]').tab("show"),$('a[href="'+t+'"]').trigger("click")):(t="#supportersPanel",$('a[href="'+t+'"]').trigger("click")),$("body").on("mouseenter",".product-thumbnail-startpage",function(){$(this).popover("show")}),$("body").on("mouseleave",".product-thumbnail-startpage",function(){$(this).popover("hide")})}},TagingProduct={setup:function(){$("input[name=tagsuser]").tagify({whitelist:["good","great"],autocomplete:!0}).on("remove",function(t,e){console.log("removed",e)}).on("add",function(t,e){console.log("added",e)})}},TagingProductSelect2={setup:function(){$.fn.select2.amd.require(["select2/selection/search"],function(t){t.prototype.searchRemoveChoice=function(t,e){this.trigger("unselect",{data:e}),this.$search.val(""),this.handleSearch()}},null,!0);var t=$(".taggingSelect2").select2({placeholder:"Add Tags here ...",tags:!0,tokenSeparators:[","," "],minimumInputLength:3,maximumSelectionLength:5,width:"resolve",ajax:{url:"/tag/filter",dataType:"json",type:"GET",delay:500,processResults:function(t){return{results:t.data.tags}}}});t.on("select2:select",function(e){var a=e.params.data;$("#tagsuserselect").attr("data-pid"),t.parent().find("ul.select2-selection__rendered").find("li.select2-selection__choice").length>5?t.find("option[value='"+a.id+"']").remove():(new RegExp("^[0-9A-Za-z_.-]+$").test(a.text)||(t.find("option[value='"+a.id+"']").remove(),alert("Must be letter or number and can include hyphens")),a.text.length>10&&(t.find("option[value='"+a.id+"']").remove(),alert("Max. length 45 chars")))})}},TagingProductDetail={setup:function(){TagingProductDetailSelect2.setup(),$("body").on("click","button.topic-tags-btn",function(t){if($(this).toggleClass("Done"),$(".product_category").find(".usertagslabel").remove(),$(".tagsuserselectpanel").toggle(),"Done"==$(this).text()){$(this).text("Manage tags");var e="",a=$("li.select2-selection__choice");$.each(a,function(t,a){e=e+''+a.title+""}),$(".product_category").find(".topicslink").html(e)}else $(this).text("Done")})}},TagingProductDetailSelect2={setup:function(){$.fn.select2.amd.require(["select2/selection/search"],function(t){t.prototype.searchRemoveChoice=function(t,e){this.trigger("unselect",{data:e}),this.$search.val(""),this.handleSearch()}},null,!0);var t=$("#tagsuserselect").select2({placeholder:"Input tags please...",tags:!0,minimumInputLength:3,closeOnSelect:!0,maximumSelectionLength:5,tokenSeparators:[","," "],ajax:{url:"/tag/filter",dataType:"json",type:"GET",delay:500,processResults:function(t){return{results:t.data.tags}}}});t.on("select2:select",function(e){var a=e.params.data,i=$("#tagsuserselect").attr("data-pid");$.post("/tag/add",{p:i,t:a.id}).done(function(e){"error"==e.status?($("span.topic-tags-saved").css({color:"red"}).html(e.message).show().delay(2e3).fadeOut(),t.find("option[value='"+e.data.tag+"']").last().remove()):$("span.topic-tags-saved").css({color:"green"}).html(' Saved').show().delay(1e3).fadeOut()})}),t.on("select2:unselect",function(t){var e=t.params.data,a=$("#tagsuserselect").attr("data-pid");$.post("/tag/del",{p:a,t:e.id}).done(function(t){console.log(t),$("span.topic-tags-saved").css({color:"green"}).html(''+t.message).show().delay(1e3).fadeOut()})})}},TagingLoopMyProducts={setup:function(){TagingLoopMyProductsSelect2.setup(),$("body").on("click","button.topic-tags-btn",function(t){if($(this).toggleClass("Done"),$(this).parent().find(".topicsuser").html(""),$(this).parent().find(".tagsuserselectpanel").toggle(),"Done"==$(this).text()){$(this).text("Manage tags");var e="",a=$(this).parent().find("li.select2-selection__choice");$.each(a,function(t,a){e=e+''+a.title+""}),$(this).parent().find(".topicsuser").html(e)}else $(this).text("Done")})}},TagingLoopMyProductsSelect2={setup:function(){$.fn.select2.amd.require(["select2/selection/search"],function(t){t.prototype.searchRemoveChoice=function(t,e){this.trigger("unselect",{data:e}),this.$search.val(""),this.handleSearch()}},null,!0);var t=$(".taggingSelect2").select2({placeholder:"Input tags please...",tags:!0,minimumInputLength:3,closeOnSelect:!0,maximumSelectionLength:5,tokenSeparators:[","," "],ajax:{url:"/tag/filter",dataType:"json",type:"GET",delay:500,processResults:function(t){return{results:t.data.tags}}}});t.on("select2:select",function(e){var a=e.params.data,i=$(this).attr("id").replace("tagsuserselect","");$.post("/tag/add",{p:i,t:a.id}).done(function(e){"error"==e.status?($("#topic-tags-saved"+i).css({color:"red"}).html(e.message).show().delay(2e3).fadeOut(),t.find("option[value='"+e.data.tag+"']").last().remove()):"existing"==e.status?$("#topic-tags-saved"+i).css({color:"red"}).html(e.message).show().delay(2e3).fadeOut():$("#topic-tags-saved"+i).css({color:"green"}).html(' Saved').show().delay(1e3).fadeOut()})}),t.on("select2:unselect",function(t){var e=t.params.data,a=$(this).attr("id").replace("tagsuserselect","");$.post("/tag/del",{p:a,t:e.id}).done(function(t){$("#topic-tags-saved"+a).css({color:"green"}).html(''+t.message).show().delay(1e3).fadeOut()})})}},productRatingToggle={setup:function(){$("#showRatingAll").on("click",function(){$("#ratings-panel").find(".spinning").show(),setTimeout(function(){$("#ratings-panel").find(".spinning").hide()},500),$(".btnRateFilter").removeClass("activeRating"),$(this).addClass("activeRating"),$(".productRating-rows").show(),$(".productRating-rows-inactive").show()}),$("#showRatingActive").on("click",function(){$("#ratings-panel").find(".spinning").show(),setTimeout(function(){$("#ratings-panel").find(".spinning").hide()},500),$(".btnRateFilter").removeClass("activeRating"),$(this).addClass("activeRating"),$(".productRating-rows").show(),$(".productRating-rows-inactive").hide()}),$("#showRatingUpvotes").on("click",function(){$("#ratings-panel").find(".spinning").show(),setTimeout(function(){$("#ratings-panel").find(".spinning").hide()},500),$(".btnRateFilter").removeClass("activeRating"),$(this).addClass("activeRating"),$(".productRating-rows").show(),$(".clsDownvotes").hide(),$(".productRating-rows-inactive").hide()}),$("#showRatingDownvotes").on("click",function(){$("#ratings-panel").find(".spinning").show(),setTimeout(function(){$("#ratings-panel").find(".spinning").hide()},500),$(".btnRateFilter").removeClass("activeRating"),$(this).addClass("activeRating"),$(".productRating-rows").show(),$(".productRating-rows-inactive").hide(),$(".clsUpvotes").hide()})}},FilterBrowseOriginalFn={setup:function(){$("body").on("click","input#filter_browse_original",function(t){var e=$(this).is(":checked"),a=window.location.href;a.indexOf("browse")<0&&(a+="/browse/"),a.indexOf("filteroriginal")>0&&(a=a.substring(0,a.indexOf("filteroriginal"))),window.location.href=e?a+"filteroriginal/1":a+"filteroriginal/0"})}},FilterBrowseTagGroupFn={setup:function(){$("body").on("change","select.filter_browse_tag_group",function(t){var e=$(this).val(),a=$(this).attr("data_group_id");$.ajax({url:"/explore/savetaggroupfilter?group_id="+a+"&tag_id="+e,cache:!1}).done(function(t){var e=window.location.href;window.location.href=e})})}}; \ No newline at end of file