feat: VivesPOS landing on Winter CMS 1.2 — theme + plugin + Dockerfile
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
- Base: wintercms/winter branch 1.2 (full framework) - Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS - Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication - Partials: hero (offline-first), features, modes (offline/nube toggle), screenshots, pricing (3 planes), comparison, FAQ, CTA - Plugin VivesPOS.Site with ContactForm - Dockerfile: PHP 8.2 Apache, port 80, healthcheck - Added winter/wn-pages, blog, sitemap, seo plugins - Active theme set to vivespos
17
modules/backend/.eslintignore
Normal file
@@ -0,0 +1,17 @@
|
||||
# Ignore build files
|
||||
**/node_modules/**
|
||||
build/*.js
|
||||
**/build/*.js
|
||||
**/mix.webpack.js
|
||||
|
||||
# Ignore all JS except for Mix-based assets
|
||||
assets/js
|
||||
assets/vendor
|
||||
behaviors/**/*.js
|
||||
controllers/**/*.js
|
||||
formwidgets/**/*.js
|
||||
reportwidgets/**/*.js
|
||||
widgets/**/*.js
|
||||
|
||||
# Ignore test fixtures
|
||||
tests
|
||||
45
modules/backend/.eslintrc.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"env": {
|
||||
"es6": true,
|
||||
"browser": true
|
||||
},
|
||||
"globals": {
|
||||
"Snowboard": "writable"
|
||||
},
|
||||
"extends": [
|
||||
"airbnb-base",
|
||||
"plugin:vue/vue3-recommended"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
"assets/js",
|
||||
"assets/vendor",
|
||||
"behaviors/**/*.js",
|
||||
"controllers/**/*.js",
|
||||
"formwidgets/**/*.js",
|
||||
"reportwidgets/**/*.js",
|
||||
"widgets/**/*.js"
|
||||
],
|
||||
"rules": {
|
||||
"class-methods-use-this": ["off"],
|
||||
"indent": ["error", 4, {
|
||||
"SwitchCase": 1
|
||||
}],
|
||||
"max-len": ["off"],
|
||||
"new-cap": ["error", { "properties": false }],
|
||||
"no-alert": ["off"],
|
||||
"no-param-reassign": ["error", {
|
||||
"props": false
|
||||
}],
|
||||
"vue/html-indent": ["error", 4],
|
||||
"vue/html-self-closing": ["error", {
|
||||
"html": {
|
||||
"void": "never",
|
||||
"normal": "any",
|
||||
"component": "always"
|
||||
},
|
||||
"svg": "always",
|
||||
"math": "always"
|
||||
}],
|
||||
"vue/multi-word-component-names": ["off"]
|
||||
}
|
||||
}
|
||||
6
modules/backend/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# Backend module ignores
|
||||
|
||||
# Ignore Mix files
|
||||
node_modules
|
||||
package-lock.json
|
||||
mix.webpack.js
|
||||
22
modules/backend/LICENSE
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2013-2021.03.01 October CMS
|
||||
Copyright (c) 2021 Winter CMS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
5
modules/backend/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Winter CMS - Backend Module
|
||||
|
||||
This repository is a read-only sub-split of the Winter CMS `Backend` module for use in Composer. Please note that we do not accept any pull requests to this repository.
|
||||
|
||||
If you wish to make changes to this module, please submit them to the [main repository](https://github.com/wintercms/winter).
|
||||
338
modules/backend/ServiceProvider.php
Normal file
@@ -0,0 +1,338 @@
|
||||
<?php
|
||||
|
||||
namespace Backend;
|
||||
|
||||
use Backend\Classes\WidgetManager;
|
||||
use Backend\Facades\Backend;
|
||||
use Backend\Facades\BackendAuth;
|
||||
use Backend\Facades\BackendMenu;
|
||||
use Backend\Models\AccessLog;
|
||||
use Backend\Models\UserRole;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use System\Classes\Asset\PackageManager;
|
||||
use System\Classes\CombineAssets;
|
||||
use System\Classes\MailManager;
|
||||
use System\Classes\SettingsManager;
|
||||
use System\Classes\UpdateManager;
|
||||
use Winter\Storm\Support\Facades\Config;
|
||||
use Winter\Storm\Support\Facades\Flash;
|
||||
use Winter\Storm\Support\ModuleServiceProvider;
|
||||
|
||||
class ServiceProvider extends ModuleServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
parent::register();
|
||||
|
||||
$this->registerConsole();
|
||||
$this->registerMailer();
|
||||
$this->registerBackendPermissions();
|
||||
$this->registerBackendUserEvents();
|
||||
|
||||
/*
|
||||
* Backend specific
|
||||
*/
|
||||
if ($this->app->runningInBackend()) {
|
||||
$this->registerBackendNavigation();
|
||||
$this->registerBackendReportWidgets();
|
||||
$this->registerBackendWidgets();
|
||||
$this->registerBackendSettings();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap the module events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerAssetBundles();
|
||||
parent::boot('backend');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register console commands
|
||||
*/
|
||||
protected function registerConsole()
|
||||
{
|
||||
$this->registerConsoleCommand('create.controller', \Backend\Console\CreateController::class);
|
||||
$this->registerConsoleCommand('create.formwidget', \Backend\Console\CreateFormWidget::class);
|
||||
$this->registerConsoleCommand('create.reportwidget', \Backend\Console\CreateReportWidget::class);
|
||||
$this->registerConsoleCommand('user.create', \Backend\Console\UserCreate::class);
|
||||
$this->registerConsoleCommand('winter.passwd', \Backend\Console\WinterPasswd::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register mail templates
|
||||
*/
|
||||
protected function registerMailer()
|
||||
{
|
||||
MailManager::instance()->registerCallback(function ($manager) {
|
||||
$manager->registerMailTemplates([
|
||||
'backend::mail.invite',
|
||||
'backend::mail.restore',
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register asset bundles
|
||||
*/
|
||||
protected function registerAssetBundles()
|
||||
{
|
||||
CombineAssets::registerCallback(function ($combiner) {
|
||||
$combiner->registerBundle('~/modules/backend/assets/less/winter.less');
|
||||
$combiner->registerBundle('~/modules/backend/assets/js/winter.js');
|
||||
$combiner->registerBundle('~/modules/backend/widgets/table/assets/js/build.js');
|
||||
$combiner->registerBundle('~/modules/backend/assets/vendor/ace-codeeditor/build.js');
|
||||
$combiner->registerBundle('~/modules/backend/widgets/mediamanager/assets/js/mediamanager-browser.js');
|
||||
$combiner->registerBundle('~/modules/backend/widgets/mediamanager/assets/less/mediamanager.less');
|
||||
$combiner->registerBundle('~/modules/backend/widgets/reportcontainer/assets/less/reportcontainer.less');
|
||||
$combiner->registerBundle('~/modules/backend/widgets/table/assets/less/table.less');
|
||||
$combiner->registerBundle('~/modules/backend/formwidgets/repeater/assets/less/repeater.less');
|
||||
$combiner->registerBundle('~/modules/backend/formwidgets/fieldset/assets/less/fieldset.less');
|
||||
$combiner->registerBundle('~/modules/backend/formwidgets/fileupload/assets/less/fileupload.less');
|
||||
$combiner->registerBundle('~/modules/backend/formwidgets/nestedform/assets/less/nestedform.less');
|
||||
$combiner->registerBundle('~/modules/backend/formwidgets/richeditor/assets/js/build-plugins.js');
|
||||
$combiner->registerBundle('~/modules/backend/formwidgets/permissioneditor/assets/less/permissioneditor.less');
|
||||
$combiner->registerBundle('~/modules/backend/formwidgets/markdowneditor/assets/less/markdowneditor.less');
|
||||
|
||||
/*
|
||||
* Rich Editor is protected by DRM
|
||||
*/
|
||||
if (file_exists(base_path('modules/backend/formwidgets/richeditor/assets/vendor/froala_drm'))) {
|
||||
$combiner->registerBundle('~/modules/backend/formwidgets/richeditor/assets/less/richeditor.less');
|
||||
$combiner->registerBundle('~/modules/backend/formwidgets/richeditor/assets/js/build.js');
|
||||
}
|
||||
});
|
||||
|
||||
PackageManager::registerCallback(function ($mix) {
|
||||
$mix->registerPackage('module-backend.formwidgets.codeeditor', '~/modules/backend/formwidgets/codeeditor/assets/winter.mix.js');
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Register navigation
|
||||
*/
|
||||
protected function registerBackendNavigation()
|
||||
{
|
||||
BackendMenu::registerCallback(function ($manager) {
|
||||
$manager->registerMenuItems('Winter.Backend', [
|
||||
'dashboard' => [
|
||||
'label' => 'backend::lang.dashboard.menu_label',
|
||||
'icon' => 'icon-dashboard',
|
||||
'iconSvg' => 'modules/backend/assets/images/dashboard-icon.svg',
|
||||
'url' => Backend::url('backend'),
|
||||
'permissions' => ['backend.access_dashboard'],
|
||||
'order' => 10
|
||||
],
|
||||
'media' => [
|
||||
'label' => 'backend::lang.media.menu_label',
|
||||
'icon' => 'icon-folder',
|
||||
'iconSvg' => 'modules/backend/assets/images/media-icon.svg',
|
||||
'url' => Backend::url('backend/media'),
|
||||
'permissions' => ['media.*'],
|
||||
'order' => 200
|
||||
]
|
||||
]);
|
||||
$manager->registerOwnerAlias('Winter.Backend', 'October.Backend');
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Register report widgets
|
||||
*/
|
||||
protected function registerBackendReportWidgets()
|
||||
{
|
||||
WidgetManager::instance()->registerReportWidgets(function ($manager) {
|
||||
$manager->registerReportWidget(\Backend\ReportWidgets\Welcome::class, [
|
||||
'label' => 'backend::lang.dashboard.welcome.widget_title_default',
|
||||
'context' => 'dashboard'
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Register permissions
|
||||
*/
|
||||
protected function registerBackendPermissions()
|
||||
{
|
||||
BackendAuth::registerCallback(function ($manager) {
|
||||
$manager->registerPermissions('Winter.Backend', [
|
||||
'backend.access_dashboard' => [
|
||||
'label' => 'system::lang.permissions.view_the_dashboard',
|
||||
'tab' => 'system::lang.permissions.name',
|
||||
'roles' => [UserRole::CODE_DEVELOPER, UserRole::CODE_PUBLISHER],
|
||||
],
|
||||
'backend.manage_default_dashboard' => [
|
||||
'label' => 'system::lang.permissions.manage_default_dashboard',
|
||||
'tab' => 'system::lang.permissions.name',
|
||||
'comment' => 'system::lang.permissions.manage_default_dashboard_comment',
|
||||
'roles' => [UserRole::CODE_DEVELOPER],
|
||||
],
|
||||
'backend.manage_users' => [
|
||||
'label' => 'system::lang.permissions.manage_other_administrators',
|
||||
'tab' => 'system::lang.permissions.name',
|
||||
'comment' => 'system::lang.permissions.manage_other_administrators_comment',
|
||||
'roles' => [UserRole::CODE_DEVELOPER],
|
||||
],
|
||||
'backend.impersonate_users' => [
|
||||
'label' => 'system::lang.permissions.impersonate_users',
|
||||
'tab' => 'system::lang.permissions.name',
|
||||
'comment' => 'system::lang.permissions.impersonate_users_comment',
|
||||
'roles' => [UserRole::CODE_DEVELOPER],
|
||||
],
|
||||
'backend.manage_preferences' => [
|
||||
'label' => 'system::lang.permissions.manage_preferences',
|
||||
'tab' => 'system::lang.permissions.name',
|
||||
'roles' => [UserRole::CODE_DEVELOPER, UserRole::CODE_PUBLISHER],
|
||||
],
|
||||
'backend.manage_editor' => [
|
||||
'label' => 'system::lang.permissions.manage_editor',
|
||||
'tab' => 'system::lang.permissions.name',
|
||||
'comment' => 'system::lang.permissions.manage_editor_comment',
|
||||
'roles' => [UserRole::CODE_DEVELOPER],
|
||||
],
|
||||
'backend.manage_own_editor' => [
|
||||
'label' => 'system::lang.permissions.manage_own_editor',
|
||||
'tab' => 'system::lang.permissions.name',
|
||||
'roles' => [UserRole::CODE_DEVELOPER, UserRole::CODE_PUBLISHER],
|
||||
],
|
||||
'backend.manage_branding' => [
|
||||
'label' => 'system::lang.permissions.manage_branding',
|
||||
'tab' => 'system::lang.permissions.name',
|
||||
'comment' => 'system::lang.permissions.manage_branding_comment',
|
||||
'roles' => [UserRole::CODE_DEVELOPER],
|
||||
],
|
||||
'media.manage_media' => [
|
||||
'label' => 'backend::lang.permissions.manage_media',
|
||||
'tab' => 'system::lang.permissions.name',
|
||||
'roles' => [UserRole::CODE_DEVELOPER, UserRole::CODE_PUBLISHER],
|
||||
],
|
||||
'backend.allow_unsafe_markdown' => [
|
||||
'label' => 'backend::lang.permissions.allow_unsafe_markdown',
|
||||
'tab' => 'system::lang.permissions.name',
|
||||
'comment' => 'backend::lang.permissions.allow_unsafe_markdown_comment',
|
||||
'roles' => [UserRole::CODE_DEVELOPER],
|
||||
],
|
||||
]);
|
||||
$manager->registerPermissionOwnerAlias('Winter.Backend', 'October.Backend');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the backend user events
|
||||
*/
|
||||
protected function registerBackendUserEvents()
|
||||
{
|
||||
Event::listen('backend.user.login', function (\Backend\Models\User $user) {
|
||||
// @TODO: Deprecate this, and only run migrations when it makes sense
|
||||
$runMigrationsOnLogin = (bool) Config::get('cms.runMigrationsOnLogin', Config::get('app.debug', false));
|
||||
if ($runMigrationsOnLogin) {
|
||||
try {
|
||||
// Load version updates
|
||||
UpdateManager::instance()->update();
|
||||
} catch (Exception $e) {
|
||||
Flash::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Log the sign in event
|
||||
AccessLog::add($user);
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Register widgets
|
||||
*/
|
||||
protected function registerBackendWidgets()
|
||||
{
|
||||
WidgetManager::instance()->registerFormWidgets(function ($manager) {
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\CodeEditor::class, 'codeeditor');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\ColorPicker::class, 'colorpicker');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\DataTable::class, 'datatable');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\DatePicker::class, 'datepicker');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\FieldSet::class, 'fieldset');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\FileUpload::class, 'fileupload');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\IconPicker::class, 'iconpicker');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\MarkdownEditor::class, 'markdown');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\MediaFinder::class, 'mediafinder');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\NestedForm::class, 'nestedform');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\RecordFinder::class, 'recordfinder');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\Relation::class, 'relation');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\RelationManager::class, 'relationmanager');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\Repeater::class, 'repeater');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\RichEditor::class, 'richeditor');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\Sensitive::class, 'sensitive');
|
||||
$manager->registerFormWidget(\Backend\FormWidgets\TagList::class, 'taglist');
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Register settings
|
||||
*/
|
||||
protected function registerBackendSettings()
|
||||
{
|
||||
SettingsManager::instance()->registerCallback(function ($manager) {
|
||||
$manager->registerSettingItems('Winter.Backend', [
|
||||
'branding' => [
|
||||
'label' => 'backend::lang.branding.menu_label',
|
||||
'description' => 'backend::lang.branding.menu_description',
|
||||
'category' => SettingsManager::CATEGORY_SYSTEM,
|
||||
'icon' => 'icon-paint-brush',
|
||||
'class' => 'Backend\Models\BrandSetting',
|
||||
'permissions' => ['backend.manage_branding'],
|
||||
'order' => 500,
|
||||
'keywords' => 'brand style'
|
||||
],
|
||||
'editor' => [
|
||||
'label' => 'backend::lang.editor.menu_label',
|
||||
'description' => 'backend::lang.editor.menu_description',
|
||||
'category' => SettingsManager::CATEGORY_SYSTEM,
|
||||
'icon' => 'icon-code',
|
||||
'class' => 'Backend\Models\EditorSetting',
|
||||
'permissions' => ['backend.manage_editor'],
|
||||
'order' => 500,
|
||||
'keywords' => 'html code class style'
|
||||
],
|
||||
'myaccount' => [
|
||||
'label' => 'backend::lang.myaccount.menu_label',
|
||||
'description' => 'backend::lang.myaccount.menu_description',
|
||||
'category' => SettingsManager::CATEGORY_MYSETTINGS,
|
||||
'icon' => 'icon-user',
|
||||
'url' => Backend::url('backend/myaccount'),
|
||||
'order' => 500,
|
||||
'context' => 'mysettings',
|
||||
'keywords' => 'backend::lang.myaccount.menu_keywords'
|
||||
],
|
||||
'preferences' => [
|
||||
'label' => 'backend::lang.backend_preferences.menu_label',
|
||||
'description' => 'backend::lang.backend_preferences.menu_description',
|
||||
'category' => SettingsManager::CATEGORY_MYSETTINGS,
|
||||
'icon' => 'icon-laptop',
|
||||
'url' => Backend::url('backend/preferences'),
|
||||
'permissions' => ['backend.manage_preferences'],
|
||||
'order' => 510,
|
||||
'context' => 'mysettings'
|
||||
],
|
||||
'access_logs' => [
|
||||
'label' => 'backend::lang.access_log.menu_label',
|
||||
'description' => 'backend::lang.access_log.menu_description',
|
||||
'category' => SettingsManager::CATEGORY_LOGS,
|
||||
'icon' => 'icon-lock',
|
||||
'url' => Backend::url('backend/accesslogs'),
|
||||
'permissions' => ['system.access_logs'],
|
||||
'order' => 920
|
||||
]
|
||||
]);
|
||||
$manager->registerOwnerAlias('Winter.Backend', 'October.Backend');
|
||||
});
|
||||
}
|
||||
}
|
||||
1
modules/backend/assets/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!vendor
|
||||
12
modules/backend/assets/css/dashboard/dashboard.css
Normal file
@@ -0,0 +1,12 @@
|
||||
.dashboard-container > .report-container.loading {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.dashboard-container > .report-container.loading .loading-indicator-container {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
1118
modules/backend/assets/css/winter.css
Normal file
17
modules/backend/assets/images/dashboard-icon.svg
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.4.4 (17249) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>dashboard-icon</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="speed" sketch:type="MSLayerGroup">
|
||||
<path fill="#88C9E7" d="M20 3.542C9.14 3.542.336 12.347.336 23.207c0 4.713 1.66 9.032 4.424 12.42l1.552-3.105H33.69l1.55 3.104c2.763-3.387 4.425-7.706 4.425-12.42 0-10.86-8.806-19.664-19.665-19.664z"/>
|
||||
<path fill="#ECEFF1" d="M36.56 23.206c0-9.145-7.415-16.56-16.56-16.56-9.144 0-16.56 7.415-16.56 16.56 0 3.454 1.062 6.66 2.872 9.314L4.76 35.625h30.48l-1.55-3.104c1.807-2.654 2.87-5.86 2.87-9.314z"/>
|
||||
<path fill="#081821" d="M3.473 22.17c-.02.345-.032.687-.032 1.036 0 .35.012.69.033 1.035h4.16c-.028-.34-.053-.686-.053-1.034 0-.35.024-.694.052-1.036h-4.16zm6.402 8.192c-.407-.557-.768-1.145-1.08-1.766l-3.55 2.157c.325.614.67 1.2 1.067 1.767l3.563-2.158zm2.823-17.187c.557-.405 1.146-.765 1.77-1.075l-2.114-3.585c-.615.322-1.226.69-1.792 1.083l2.136 3.577zM8.75 17.97c.293-.63.63-1.233 1.02-1.8l-3.567-2.125c-.378.576-.77 1.247-1.075 1.87L8.75 17.97zm12.286-7.13V6.68c-.346-.023-.687-.033-1.036-.033s-.69-.022-1.035 0v4.193c.343-.03.687-.054 1.035-.054s.692.025 1.036.053zm9.074 19.626l3.6 2.055c.378-.574.76-1.215 1.064-1.836l-3.646-2.018c-.293.628-.63 1.232-1.018 1.8zm6.417-6.226c.02-.344.032-.686.032-1.034 0-.35-.012-.69-.033-1.036h-4.16c.027.342.052.687.052 1.036 0 .35-.025.693-.053 1.035h4.16zm-7.41-14.858c-.573-.38-1.205-.74-1.827-1.047l-2.055 3.622c.63.293 1.235.63 1.802 1.02l2.08-3.595z"/>
|
||||
<path fill="#90A4AE" d="M15.86 28.38h8.28v2.07h-8.28v-2.07z"/>
|
||||
<path fill="none" stroke="#E01346" stroke-miterlimit="10" d="M20 23.206l12.42-7.245"/>
|
||||
<path fill="#E01346" d="M19.883 20.002c1.683 0 3.047 1.365 3.047 3.045 0 1.685-1.363 3.048-3.047 3.048-1.682 0-3.045-1.363-3.045-3.048 0-1.68 1.363-3.045 3.045-3.045z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
BIN
modules/backend/assets/images/favicon.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
1
modules/backend/assets/images/logo.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 1988 2212" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-miterlimit:10;"><g id="Snowflake"><g><path d="M993.872,1105.52l-0,833.334" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/><path d="M807.62,1476.42l186.252,-186.252l186.252,186.252" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;stroke-linecap:square;"/><path d="M752.928,1781.55l240.944,-240.944l240.944,240.944" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/></g><g><path d="M993.872,1105.52l-721.688,416.667" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/><path d="M579.534,1129.67l254.425,68.173l-68.173,254.425" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;stroke-linecap:square;"/><path d="M287.943,1234.87l329.135,88.191l-88.191,329.135" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/></g><g><path d="M993.872,1105.52l-721.688,-416.666" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/><path d="M765.786,758.767l68.173,254.425l-254.425,68.173" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;stroke-linecap:square;"/><path d="M528.887,558.841l88.191,329.135l-329.135,88.191" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/></g><g><path d="M993.872,1105.52l-0,-833.333" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/><path d="M1180.12,734.614l-186.252,186.252l-186.252,-186.252" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;stroke-linecap:square;"/><path d="M1234.82,429.49l-240.944,240.944l-240.944,-240.944" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/></g><g><path d="M993.872,1105.52l721.688,-416.666" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/><path d="M1408.21,1081.37l-254.425,-68.173l68.173,-254.425" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;stroke-linecap:square;"/><path d="M1699.8,976.167l-329.135,-88.191l88.191,-329.135" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/></g><g><path d="M993.872,1105.52l721.688,416.667" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/><path d="M1221.96,1452.27l-68.173,-254.425l254.425,-68.173" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;stroke-linecap:square;"/><path d="M1458.86,1652.19l-88.191,-329.135l329.135,-88.191" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
22
modules/backend/assets/images/media-icon.svg
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="42px" height="42px" viewBox="0 0 42 42" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.4.4 (17249) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>media-icon</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="slr_back_side" sketch:type="MSLayerGroup" transform="translate(0.000000, 2.000000)">
|
||||
<path d="M37.8,4.22222222 L29.82,4.22222222 L27.72,1.05555556 C27.3,0.422222222 26.67,0.105555556 25.935,0.105555556 L15.855,0.105555556 C15.12,0.105555556 14.49,0.422222222 14.07,1.05555556 L11.97,4.22222222 L4.2,4.22222222 C1.89,4.22222222 0,6.12222222 0,8.44444444 L0,33.7777778 C0,36.1 1.89,38 4.2,38 L37.8,38 C40.11,38 42,36.1 42,33.7777778 L42,8.44444444 C42,6.12222222 40.11,4.22222222 37.8,4.22222222 L37.8,4.22222222 Z" id="Shape" fill="#B281C5" sketch:type="MSShapeGroup"></path>
|
||||
<path d="M7.35,10.5555556 L28.35,10.5555556 C28.98,10.5555556 29.4,10.9777778 29.4,11.6111111 L29.4,28.5 C29.4,29.1333333 28.98,29.5555556 28.35,29.5555556 L7.35,29.5555556 C6.72,29.5555556 6.3,29.1333333 6.3,28.5 L6.3,11.6111111 C6.3,10.9777778 6.72,10.5555556 7.35,10.5555556 L7.35,10.5555556 Z" id="Shape" fill="#2DA7C7" sketch:type="MSShapeGroup"></path>
|
||||
<path d="M15.645,16.8888889 L8.4,27.4444444 L22.89,27.4444444 L15.645,16.8888889 Z" id="Shape" fill="#227F96" sketch:type="MSShapeGroup"></path>
|
||||
<ellipse id="Oval" fill="#F8E095" sketch:type="MSShapeGroup" cx="24.15" cy="15.8333333" rx="2.1" ry="2.11111111"></ellipse>
|
||||
<path d="M22.26,21.1111111 L17.22,27.4444444 L27.3,27.4444444 L22.26,21.1111111 Z" id="Shape" fill="#88c9e7" sketch:type="MSShapeGroup"></path>
|
||||
<g id="Group" transform="translate(31.500000, 2.111111)" fill="#7B4E8E" sketch:type="MSShapeGroup">
|
||||
<path d="M0,2.11111111 L6.3,2.11111111 L6.3,1.26666667 C6.3,0.527777778 5.775,0 5.04,0 L1.26,0 C0.525,0 0,0.527777778 0,1.26666667 L0,2.11111111 L0,2.11111111 Z" id="Shape"></path>
|
||||
<ellipse id="Oval" cx="4.2" cy="10.5555556" rx="2.1" ry="2.11111111"></ellipse>
|
||||
<ellipse id="Oval" cx="4.2" cy="16.8888889" rx="2.1" ry="2.11111111"></ellipse>
|
||||
<ellipse id="Oval" cx="4.2" cy="23.2222222" rx="2.1" ry="2.11111111"></ellipse>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="77px" height="25px" viewBox="0 -0.167 77 25" enable-background="new 0 -0.167 77 25"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<path fill="#FFFFFF" d="M60,25h15c-5.037,0-5-25-15-25V25z"/>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M15,25H0C5.037,25,5,0,15,0V25z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 704 B |
16
modules/backend/assets/images/tab-shape.svg
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="100px" height="110px" viewBox="0 0 100 110" enable-background="new 0 0 100 110" xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<path d="M0,30C5,30,10,0,20,0c5,0,60,0,65,0c10,0,10,30,15,30"/>
|
||||
<path fill="#2DA7C7" d="M0,70c5,0,10-30,20-30c0,10,0,15,0,15v15"/>
|
||||
<path fill="#2DA7C7" d="M100,70c-5,0-10-30-20-30c0,10,0,15,0,15v15"/>
|
||||
<path fill="#227F96" d="M0,110c5,0,10-30,20-30c0,10,0,15,0,15v15"/>
|
||||
<path fill="#227F96" d="M100,110c-5,0-10-30-20-30c0,10,0,15,0,15v15"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 909 B |
BIN
modules/backend/assets/images/treeview-icons.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
modules/backend/assets/images/treeview-submenu-tabs.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
46
modules/backend/assets/images/winter-logo-white.svg
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 2159 531" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-miterlimit:10;">
|
||||
<g transform="matrix(1,0,0,1,-203.164,-34.6758)">
|
||||
<g id="Snowflake" transform="matrix(1,0,0,1,1723.13,0)">
|
||||
<g>
|
||||
<path d="M400,300L400,500" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;"/>
|
||||
<path d="M355.3,389.017L400,344.316L444.7,389.017" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;stroke-linecap:square;"/>
|
||||
<path d="M342.174,462.247L400,404.42L457.826,462.247" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M400,300L226.795,400" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;"/>
|
||||
<path d="M300.559,305.797L361.621,322.158L345.259,383.22" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;stroke-linecap:square;"/>
|
||||
<path d="M230.577,331.044L309.57,352.21L288.404,431.202" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M400,300L226.795,200" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;"/>
|
||||
<path d="M345.259,216.78L361.621,277.842L300.559,294.203" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;stroke-linecap:square;"/>
|
||||
<path d="M288.404,168.798L309.57,247.79L230.577,268.956" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M400,300L400,100" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;"/>
|
||||
<path d="M444.7,210.983L400,255.684L355.3,210.983" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;stroke-linecap:square;"/>
|
||||
<path d="M457.826,137.753L400,195.58L342.174,137.753" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M400,300L573.205,200" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;"/>
|
||||
<path d="M499.441,294.203L438.379,277.842L454.741,216.78" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;stroke-linecap:square;"/>
|
||||
<path d="M569.423,268.956L490.43,247.79L511.596,168.798" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M400,300L573.205,400" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;"/>
|
||||
<path d="M454.741,383.22L438.379,322.158L499.441,305.797" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;stroke-linecap:square;"/>
|
||||
<path d="M511.596,431.202L490.43,352.21L569.423,331.044" style="fill:none;fill-rule:nonzero;stroke:rgb(45,167,199);stroke-width:13px;"/>
|
||||
</g>
|
||||
</g>
|
||||
<g transform="matrix(4.85947,0,0,4.85947,-731.059,-919.349)">
|
||||
<path d="M217.275,286.281L210.955,286.281L192.351,215.563L197.717,215.563L214.055,278.172L231.228,215.563L238.502,215.563L255.794,278.172L272.132,215.563L277.499,215.563L258.895,286.281L252.574,286.281L234.925,222.361L217.275,286.281Z" style="fill:white;fill-rule:nonzero;stroke:white;stroke-width:0.21px;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:2;"/>
|
||||
<rect x="286.681" y="215.563" width="4.77" height="70.718" style="fill:white;fill-rule:nonzero;stroke:white;stroke-width:0.21px;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:2;"/>
|
||||
<path d="M311.486,286.281L306.716,286.281L306.716,215.563L313.275,215.563L355.968,280.438L355.968,215.563L360.738,215.563L360.738,286.281L354.179,286.281L311.486,222.361L311.486,286.281Z" style="fill:white;fill-rule:nonzero;stroke:white;stroke-width:0.21px;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:2;"/>
|
||||
<path d="M397.827,286.281L393.056,286.281L393.056,220.214L368.848,220.214L368.848,215.563L422.274,215.563L422.274,220.214L397.827,220.214L397.827,286.281Z" style="fill:white;fill-rule:nonzero;stroke:white;stroke-width:0.21px;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:2;"/>
|
||||
<path d="M476.535,286.281L430.383,286.281L430.383,215.563L476.535,215.563L476.535,220.214L435.153,220.214L435.153,247.404L472.957,247.404L472.957,251.817L435.153,251.817L435.153,281.75L476.535,281.75L476.535,286.281Z" style="fill:white;fill-rule:nonzero;stroke:white;stroke-width:0.21px;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:2;"/>
|
||||
<path d="M490.249,286.281L485.479,286.281L485.479,215.563L519.228,215.563C524.078,215.563 528.212,217.392 531.63,221.049C535.049,224.627 536.758,228.999 536.758,234.167C536.758,238.699 535.725,242.634 533.658,245.973C531.511,249.312 528.848,251.26 525.668,251.817C528.609,252.612 530.994,255.116 532.823,259.33C534.651,263.543 535.566,268.632 535.566,274.594C535.566,277.933 535.645,280.438 535.804,282.107C535.963,284.095 536.281,285.486 536.758,286.281L531.988,286.281C531.193,285.327 530.676,283.578 530.438,281.034L530.08,270.897C530.08,266.127 528.927,262.033 526.622,258.614C524.396,255.275 521.653,253.606 518.393,253.606L490.249,253.606L490.249,286.281ZM490.249,249.193L518.393,249.193C522.13,249.193 525.35,247.762 528.053,244.9C530.676,242.117 531.988,238.699 531.988,234.644C531.988,230.669 530.676,227.25 528.053,224.388C525.35,221.606 522.13,220.214 518.393,220.214L490.249,220.214L490.249,249.193Z" style="fill:white;fill-rule:nonzero;stroke:white;stroke-width:0.21px;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:2;"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.1 KiB |
1
modules/backend/assets/images/winter-logo.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 8992 2212" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-miterlimit:10;"><g id="Snowflake"><g><path d="M7997.78,1105.52l0,833.334" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/><path d="M7811.52,1476.42l186.252,-186.252l186.252,186.252" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;stroke-linecap:square;"/><path d="M7756.83,1781.55l240.943,-240.944l240.944,240.944" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/></g><g><path d="M7997.78,1105.52l-721.688,416.667" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/><path d="M7583.44,1129.67l254.425,68.173l-68.173,254.425" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;stroke-linecap:square;"/><path d="M7291.85,1234.87l329.135,88.191l-88.192,329.135" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/></g><g><path d="M7997.78,1105.52l-721.688,-416.666" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/><path d="M7769.69,758.767l68.173,254.425l-254.425,68.173" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;stroke-linecap:square;"/><path d="M7532.79,558.841l88.192,329.135l-329.135,88.191" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/></g><g><path d="M7997.78,1105.52l0,-833.333" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/><path d="M8184.03,734.614l-186.252,186.252l-186.252,-186.252" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;stroke-linecap:square;"/><path d="M8238.72,429.49l-240.944,240.944l-240.943,-240.944" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/></g><g><path d="M7997.78,1105.52l721.688,-416.666" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/><path d="M8412.11,1081.37l-254.425,-68.173l68.173,-254.425" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;stroke-linecap:square;"/><path d="M8703.7,976.167l-329.135,-88.191l88.191,-329.135" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/></g><g><path d="M7997.78,1105.52l721.688,416.667" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/><path d="M8225.86,1452.27l-68.173,-254.425l254.425,-68.173" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;stroke-linecap:square;"/><path d="M8462.76,1652.19l-88.191,-329.135l329.135,-88.191" style="fill:none;fill-rule:nonzero;stroke:#2da7c7;stroke-width:54.17px;"/></g></g><path d="M504.66,1821.46l-127.976,0l-376.684,-1431.88l108.659,-0l330.806,1267.69l347.709,-1267.69l147.293,-0l350.123,1267.69l330.806,-1267.69l108.659,-0l-376.684,1431.88l-127.976,0l-357.367,-1294.25l-357.368,1294.25Z" style="fill:#103141;fill-rule:nonzero;"/><rect x="1909.98" y="389.576" width="96.586" height="1431.88" style="fill:#103141;fill-rule:nonzero;"/><path d="M2412.23,1821.46l-96.586,0l-0,-1431.88l132.805,-0l864.443,1313.57l-0,-1313.57l96.585,-0l0,1431.88l-132.805,0l-864.442,-1294.25l-0,1294.25Z" style="fill:#103141;fill-rule:nonzero;"/><path d="M4160.43,1821.46l-96.585,0l-0,-1337.71l-490.173,-0l0,-94.171l1081.76,-0l0,94.171l-495.002,-0l0,1337.71Z" style="fill:#103141;fill-rule:nonzero;"/><path d="M5754.1,1821.46l-934.467,0l0,-1431.88l934.467,-0l0,94.171l-837.881,-0l-0,550.538l765.442,0l-0,89.342l-765.442,0l-0,606.076l837.881,-0l0,91.756Z" style="fill:#103141;fill-rule:nonzero;"/><path d="M6031.78,1821.46l-96.586,0l0,-1431.88l683.344,-0c98.196,-0 181.904,37.024 251.123,111.073c69.22,72.44 103.83,160.977 103.83,265.611c-0,91.757 -20.927,171.44 -62.781,239.05c-43.463,67.61 -97.39,107.049 -161.781,118.317c59.561,16.098 107.854,66.805 144.879,152.123c37.024,85.317 55.537,188.342 55.537,309.074c-0,67.61 1.609,118.318 4.829,152.123c3.219,40.244 9.658,68.415 19.317,84.512l-96.586,0c-16.097,-19.317 -26.561,-54.732 -31.39,-106.244l-7.244,-205.245c-0,-96.586 -23.342,-179.488 -70.025,-248.708c-45.073,-67.61 -100.61,-101.415 -166.61,-101.415l-569.856,-0l0,661.612Zm0,-750.954l569.856,0c75.659,0 140.854,-28.976 195.586,-86.927c53.122,-56.342 79.683,-125.561 79.683,-207.659c0,-80.488 -26.561,-149.708 -79.683,-207.66c-54.732,-56.341 -119.927,-84.512 -195.586,-84.512l-569.856,-0l0,586.758Z" style="fill:#103141;fill-rule:nonzero;"/></svg>
|
||||
|
After Width: | Height: | Size: 4.6 KiB |
BIN
modules/backend/assets/images/wordmark.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
5
modules/backend/assets/js/auth/auth.js
Normal file
@@ -0,0 +1,5 @@
|
||||
$(document).ready(function(){
|
||||
$(document.body).removeClass('preload')
|
||||
|
||||
$('form input[type=text], form input[type=password]').first().focus()
|
||||
})
|
||||
102
modules/backend/assets/js/backend.js
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Winter General Utilities
|
||||
*/
|
||||
|
||||
/*
|
||||
* Path helpers
|
||||
*/
|
||||
|
||||
if ($.wn === undefined)
|
||||
$.wn = {}
|
||||
if ($.oc === undefined)
|
||||
$.oc = $.wn
|
||||
|
||||
$.wn.backendUrl = function(url) {
|
||||
var backendBasePath = $('meta[name="backend-base-path"]').attr('content')
|
||||
|
||||
if (!backendBasePath)
|
||||
return url
|
||||
|
||||
if (url.substr(0, 1) == '/')
|
||||
url = url.substr(1)
|
||||
|
||||
return backendBasePath + '/' + url
|
||||
}
|
||||
|
||||
/*
|
||||
* String escape
|
||||
*/
|
||||
if ($.wn === undefined)
|
||||
$.wn = {}
|
||||
if ($.oc === undefined)
|
||||
$.oc = $.wn
|
||||
|
||||
$.wn.escapeHtmlString = function(string) {
|
||||
var htmlEscapes = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
'/': '/'
|
||||
},
|
||||
htmlEscaper = /[&<>"'\/]/g
|
||||
|
||||
return ('' + string).replace(htmlEscaper, function(match) {
|
||||
return htmlEscapes[match];
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
* Inverse Click Event (not used)
|
||||
*
|
||||
* Calls the handler function if the user has clicked outside the object
|
||||
* and not on any of the elements in the exception list.
|
||||
*/
|
||||
/*
|
||||
$.fn.extend({
|
||||
clickOutside: function(handler, exceptions) {
|
||||
var $this = this;
|
||||
|
||||
$('body').on('click', function(event) {
|
||||
if (exceptions && $.inArray(event.target, exceptions) > -1) {
|
||||
return;
|
||||
} else if ($.contains($this[0], event.target)) {
|
||||
return;
|
||||
} else {
|
||||
handler(event, $this);
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
})
|
||||
*/
|
||||
|
||||
/*
|
||||
* Browser Fixes
|
||||
* - If another fix using JS is necessary, move this logic to backend.fixes.js
|
||||
*/
|
||||
|
||||
/*
|
||||
* Internet Explorer v11
|
||||
* - IE11 will not honor height 100% when overflow is used on the Y axis.
|
||||
*/
|
||||
if (!!window.MSInputMethodContext && !!document.documentMode) {
|
||||
$(window).on('resize', function() {
|
||||
fixMediaManager()
|
||||
fixSidebar()
|
||||
})
|
||||
|
||||
function fixMediaManager() {
|
||||
var $el = $('div[data-control="media-manager"] .control-scrollpad')
|
||||
$el.height($el.parent().height())
|
||||
}
|
||||
|
||||
function fixSidebar() {
|
||||
$('#layout-sidenav').height(Math.max(
|
||||
$('#layout-body').innerHeight(),
|
||||
$(window).height() - $('#layout-mainmenu').height()
|
||||
))
|
||||
}
|
||||
}
|
||||
1
modules/backend/assets/js/preferences/preferences.js
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";(self.webpackChunk_wintercms_wn_backend_module=self.webpackChunk_wintercms_wn_backend_module||[]).push([[429],{449:function(e,t,i){var n=i(171);(e=>{class t extends e.Singleton{construct(){this.widget=null}listens(){return{"backend.widget.initialized":"onWidgetInitialized"}}onWidgetInitialized(e,t){e===document.getElementById("CodeEditor-formEditorPreview-_editor_preview")&&(this.widget=t,this.enablePreferences())}enablePreferences(){(0,n.M)("change");Object.entries({show_gutter:"showGutter",highlight_active_line:"highlightActiveLine",use_hard_tabs:"!useSoftTabs",display_indent_guides:"displayIndentGuides",show_invisibles:"showInvisibles",show_print_margin:"showPrintMargin",show_minimap:"showMinimap",enable_folding:"codeFolding",bracket_colors:"bracketColors",show_colors:"showColors"}).forEach(([e,t])=>{this.element(e).addEventListener("change",e=>{this.widget.setConfig(t.replace(/^!/,""),/^!/.test(t)?!e.target.checked:e.target.checked)})}),this.element("theme").addEventListener("$change",e=>{this.widget.loadTheme(e.target.value)}),this.element("font_size").addEventListener("$change",e=>{this.widget.setConfig("fontSize",e.target.value)}),this.element("tab_size").addEventListener("$change",e=>{this.widget.setConfig("tabSize",e.target.value)}),this.element("word_wrap").addEventListener("$change",e=>{const{value:t}=e.target;switch(t){case"off":this.widget.setConfig("wordWrap",!1);break;case"fluid":this.widget.setConfig("wordWrap","fluid");break;default:this.widget.setConfig("wordWrap",parseInt(t,10))}}),document.querySelectorAll("[data-switch-lang]").forEach(e=>{e.addEventListener("click",t=>{t.preventDefault();const i=e.dataset.switchLang,n=document.querySelector(`[data-lang-snippet="${i}"]`);n&&(this.widget.setValue(n.textContent.trim()),this.widget.setLanguage(i))})}),this.widget.events.once("create",()=>{const e=new MouseEvent("click");document.querySelector('[data-switch-lang="css"]').dispatchEvent(e)})}element(e){return document.getElementById(`Form-field-Preference-editor_${e}`)}}e.addPlugin("backend.preferences",t)})(window.Snowboard)}},function(e){e.O(0,[810],function(){return t=449,e(e.s=t);var t});e.O()}]);
|
||||
5
modules/backend/assets/js/vendor/jquery-and-migrate.min.js
vendored
Normal file
2
modules/backend/assets/js/vendor/jquery-migrate.min.js
vendored
Normal file
447
modules/backend/assets/js/vendor/jquery.autoellipsis.js
vendored
Normal file
@@ -0,0 +1,447 @@
|
||||
/*!
|
||||
|
||||
Copyright (c) 2011 Peter van der Spek
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
(function($) {
|
||||
|
||||
/**
|
||||
* Hash containing mapping of selectors to settings hashes for target selectors that should be live updated.
|
||||
*
|
||||
* @type {Object.<string, Object>}
|
||||
* @private
|
||||
*/
|
||||
var liveUpdatingTargetSelectors = {};
|
||||
|
||||
/**
|
||||
* Interval ID for live updater. Contains interval ID when the live updater interval is active, or is undefined
|
||||
* otherwise.
|
||||
*
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
var liveUpdaterIntervalId;
|
||||
|
||||
/**
|
||||
* Boolean indicating whether the live updater is running.
|
||||
*
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
var liveUpdaterRunning = false;
|
||||
|
||||
/**
|
||||
* Set of default settings.
|
||||
*
|
||||
* @type {Object.<string, string>}
|
||||
* @private
|
||||
*/
|
||||
var defaultSettings = {
|
||||
ellipsis: '...',
|
||||
setTitle: 'never',
|
||||
live: false
|
||||
};
|
||||
|
||||
/**
|
||||
* Perform ellipsis on selected elements.
|
||||
*
|
||||
* @param {string} selector the inner selector of elements that ellipsis may work on. Inner elements not referred to by this
|
||||
* selector are left untouched.
|
||||
* @param {Object.<string, string>=} options optional options to override default settings.
|
||||
* @return {jQuery} the current jQuery object for chaining purposes.
|
||||
* @this {jQuery} the current jQuery object.
|
||||
*/
|
||||
$.fn.ellipsis = function(selector, options) {
|
||||
var subjectElements, settings;
|
||||
|
||||
subjectElements = $(this);
|
||||
|
||||
// Check for options argument only.
|
||||
if (typeof selector !== 'string') {
|
||||
options = selector;
|
||||
selector = undefined;
|
||||
}
|
||||
|
||||
// Create the settings from the given options and the default settings.
|
||||
settings = $.extend({}, defaultSettings, options);
|
||||
|
||||
// If selector is not set, work on immediate children (default behaviour).
|
||||
settings.selector = selector;
|
||||
|
||||
// Do ellipsis on each subject element.
|
||||
subjectElements.each(function() {
|
||||
var elem = $(this);
|
||||
|
||||
// Do ellipsis on subject element.
|
||||
ellipsisOnElement(elem, settings);
|
||||
});
|
||||
|
||||
// If live option is enabled, add subject elements to live updater. Otherwise remove from live updater.
|
||||
if (settings.live) {
|
||||
addToLiveUpdater(subjectElements.selector, settings);
|
||||
|
||||
} else {
|
||||
removeFromLiveUpdater(subjectElements.selector);
|
||||
}
|
||||
|
||||
// Return jQuery object for chaining.
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Perform ellipsis on the given container.
|
||||
*
|
||||
* @param {jQuery} containerElement jQuery object containing one DOM element to perform ellipsis on.
|
||||
* @param {Object.<string, string>} settings the settings for this ellipsis operation.
|
||||
* @private
|
||||
*/
|
||||
function ellipsisOnElement(containerElement, settings) {
|
||||
var containerData = containerElement.data('jqae');
|
||||
if (!containerData) containerData = {};
|
||||
|
||||
// Check if wrapper div was already created and bound to the container element.
|
||||
var wrapperElement = containerData.wrapperElement;
|
||||
|
||||
// If not, create wrapper element.
|
||||
if (!wrapperElement) {
|
||||
wrapperElement = containerElement.wrapInner('<div/>').find('>div');
|
||||
|
||||
// Wrapper div should not add extra size.
|
||||
wrapperElement.css({
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
border: 0
|
||||
});
|
||||
}
|
||||
|
||||
// Check if the original wrapper element content was already bound to the wrapper element.
|
||||
var wrapperElementData = wrapperElement.data('jqae');
|
||||
if (!wrapperElementData) wrapperElementData = {};
|
||||
|
||||
var wrapperOriginalContent = wrapperElementData.originalContent;
|
||||
|
||||
// If so, clone the original content, re-bind the original wrapper content to the clone, and replace the
|
||||
// wrapper with the clone.
|
||||
if (wrapperOriginalContent) {
|
||||
wrapperElement = wrapperElementData.originalContent.clone(true)
|
||||
.data('jqae', {originalContent: wrapperOriginalContent}).replaceAll(wrapperElement);
|
||||
|
||||
} else {
|
||||
// Otherwise, clone the current wrapper element and bind it as original content to the wrapper element.
|
||||
|
||||
wrapperElement.data('jqae', {originalContent: wrapperElement.clone(true)});
|
||||
}
|
||||
|
||||
// Bind the wrapper element and current container width and height to the container element. Current container
|
||||
// width and height are stored to detect changes to the container size.
|
||||
containerElement.data('jqae', {
|
||||
wrapperElement: wrapperElement,
|
||||
containerWidth: containerElement.width(),
|
||||
containerHeight: containerElement.height()
|
||||
});
|
||||
|
||||
// Calculate with current container element height.
|
||||
var containerElementHeight = containerElement.height();
|
||||
|
||||
// Calculate wrapper offset.
|
||||
var wrapperOffset = (parseInt(containerElement.css('padding-top'), 10) || 0) + (parseInt(containerElement.css('border-top-width'), 10) || 0) - (wrapperElement.offset().top - containerElement.offset().top);
|
||||
|
||||
// Normally the ellipsis characters are applied to the last non-empty text-node in the selected element. If the
|
||||
// selected element becomes empty during ellipsis iteration, the ellipsis characters cannot be applied to that
|
||||
// selected element, and must be deferred to the previous selected element. This parameter keeps track of that.
|
||||
var deferAppendEllipsis = false;
|
||||
|
||||
// Loop through all selected elements in reverse order.
|
||||
var selectedElements = wrapperElement;
|
||||
if (settings.selector) selectedElements = $(wrapperElement.find(settings.selector).get().reverse());
|
||||
|
||||
selectedElements.each(function() {
|
||||
var selectedElement = $(this),
|
||||
originalText = selectedElement.text(),
|
||||
ellipsisApplied = false;
|
||||
|
||||
// Check if we can safely remove the selected element. This saves a lot of unnecessary iterations.
|
||||
if (wrapperElement.innerHeight() - selectedElement.innerHeight() > containerElementHeight + wrapperOffset) {
|
||||
selectedElement.remove();
|
||||
|
||||
} else {
|
||||
// Reverse recursively remove empty elements, until the element that contains a non-empty text-node.
|
||||
removeLastEmptyElements(selectedElement);
|
||||
|
||||
// If the selected element has not become empty, start ellipsis iterations on the selected element.
|
||||
if (selectedElement.contents().length) {
|
||||
|
||||
// If a deffered ellipsis is still pending, apply it now to the last text-node.
|
||||
if (deferAppendEllipsis) {
|
||||
getLastTextNode(selectedElement).get(0).nodeValue += settings.ellipsis;
|
||||
deferAppendEllipsis = false;
|
||||
}
|
||||
|
||||
// Iterate until wrapper element height is less than or equal to the original container element
|
||||
// height plus possible wrapperOffset.
|
||||
while (wrapperElement.innerHeight() > containerElementHeight + wrapperOffset) {
|
||||
// Apply ellipsis on last text node, by removing one word.
|
||||
ellipsisApplied = ellipsisOnLastTextNode(selectedElement);
|
||||
|
||||
// If ellipsis was succesfully applied, remove any remaining empty last elements and append the
|
||||
// ellipsis characters.
|
||||
if (ellipsisApplied) {
|
||||
removeLastEmptyElements(selectedElement);
|
||||
|
||||
// If the selected element is not empty, append the ellipsis characters.
|
||||
if (selectedElement.contents().length) {
|
||||
getLastTextNode(selectedElement).get(0).nodeValue += settings.ellipsis;
|
||||
|
||||
} else {
|
||||
// If the selected element has become empty, defer the appending of the ellipsis characters
|
||||
// to the previous selected element.
|
||||
deferAppendEllipsis = true;
|
||||
selectedElement.remove();
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
// If ellipsis could not be applied, defer the appending of the ellipsis characters to the
|
||||
// previous selected element.
|
||||
deferAppendEllipsis = true;
|
||||
selectedElement.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If the "setTitle" property is set to "onEllipsis" and the ellipsis has been applied, or if the
|
||||
// property is set to "always", the add the "title" attribute with the original text. Else remove the
|
||||
// "title" attribute. When the "setTitle" property is set to "never" we do not touch the "title"
|
||||
// attribute.
|
||||
if (((settings.setTitle == 'onEllipsis') && ellipsisApplied) || (settings.setTitle == 'always')) {
|
||||
selectedElement.attr('title', originalText);
|
||||
|
||||
} else if (settings.setTitle != 'never') {
|
||||
selectedElement.removeAttr('title');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs ellipsis on the last text node of the given element. Ellipsis is done by removing a full word.
|
||||
*
|
||||
* @param {jQuery} element jQuery object containing a single DOM element.
|
||||
* @return {boolean} true when ellipsis has been done, false otherwise.
|
||||
* @private
|
||||
*/
|
||||
function ellipsisOnLastTextNode(element) {
|
||||
var lastTextNode = getLastTextNode(element);
|
||||
|
||||
// If the last text node is found, do ellipsis on that node.
|
||||
if (lastTextNode.length) {
|
||||
var text = lastTextNode.get(0).nodeValue;
|
||||
|
||||
// Find last space character, and remove text from there. If no space is found the full remaining text is
|
||||
// removed.
|
||||
var pos = text.lastIndexOf(' ');
|
||||
if (pos > -1) {
|
||||
text = $.trim(text.substring(0, pos));
|
||||
lastTextNode.get(0).nodeValue = text;
|
||||
|
||||
} else {
|
||||
lastTextNode.get(0).nodeValue = '';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get last text node of the given element.
|
||||
*
|
||||
* @param {jQuery} element jQuery object containing a single element.
|
||||
* @return {jQuery} jQuery object containing a single text node.
|
||||
* @private
|
||||
*/
|
||||
function getLastTextNode(element) {
|
||||
if (element.contents().length) {
|
||||
|
||||
// Get last child node.
|
||||
var contents = element.contents();
|
||||
var lastNode = contents.eq(contents.length - 1);
|
||||
|
||||
// If last node is a text node, return it.
|
||||
if (lastNode.filter(textNodeFilter).length) {
|
||||
return lastNode;
|
||||
|
||||
} else {
|
||||
// Else it is an element node, and we recurse into it.
|
||||
|
||||
return getLastTextNode(lastNode);
|
||||
}
|
||||
|
||||
} else {
|
||||
// If there is no last child node, we append an empty text node and return that. Normally this should not
|
||||
// happen, as we test for emptiness before calling getLastTextNode.
|
||||
|
||||
element.append('');
|
||||
var contents = element.contents();
|
||||
return contents.eq(contents.length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove last empty elements. This is done recursively until the last element contains a non-empty text node.
|
||||
*
|
||||
* @param {jQuery} element jQuery object containing a single element.
|
||||
* @return {boolean} true when elements have been removed, false otherwise.
|
||||
* @private
|
||||
*/
|
||||
function removeLastEmptyElements(element) {
|
||||
if (element.contents().length) {
|
||||
|
||||
// Get last child node.
|
||||
var contents = element.contents();
|
||||
var lastNode = contents.eq(contents.length - 1);
|
||||
|
||||
// If last child node is a text node, check for emptiness.
|
||||
if (lastNode.filter(textNodeFilter).length) {
|
||||
var text = lastNode.get(0).nodeValue;
|
||||
text = $.trim(text);
|
||||
|
||||
if (text == '') {
|
||||
// If empty, remove the text node.
|
||||
lastNode.remove();
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
// If the last child node is an element node, remove the last empty child nodes on that node.
|
||||
while (removeLastEmptyElements(lastNode)) {
|
||||
}
|
||||
|
||||
// If the last child node contains no more child nodes, remove the last child node.
|
||||
if (lastNode.contents().length) {
|
||||
return false;
|
||||
|
||||
} else {
|
||||
lastNode.remove();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter for testing on text nodes.
|
||||
*
|
||||
* @return {boolean} true when this node is a text node, false otherwise.
|
||||
* @this {Node}
|
||||
* @private
|
||||
*/
|
||||
function textNodeFilter() {
|
||||
return this.nodeType === 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add target selector to hash of target selectors. If this is the first target selector added, start the live
|
||||
* updater.
|
||||
*
|
||||
* @param {string} targetSelector the target selector to run the live updater for.
|
||||
* @param {Object.<string, string>} settings the settings to apply on this target selector.
|
||||
* @private
|
||||
*/
|
||||
function addToLiveUpdater(targetSelector, settings) {
|
||||
// Store target selector with its settings.
|
||||
liveUpdatingTargetSelectors[targetSelector] = settings;
|
||||
|
||||
// If the live updater has not yet been started, start it now.
|
||||
if (!liveUpdaterIntervalId) {
|
||||
liveUpdaterIntervalId = window.setInterval(function() {
|
||||
doLiveUpdater();
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the target selector from the hash of target selectors. It this is the last remaining target selector
|
||||
* being removed, stop the live updater.
|
||||
*
|
||||
* @param {string} targetSelector the target selector to stop running the live updater for.
|
||||
* @private
|
||||
*/
|
||||
function removeFromLiveUpdater(targetSelector) {
|
||||
// If the hash contains the target selector, remove it.
|
||||
if (liveUpdatingTargetSelectors[targetSelector]) {
|
||||
delete liveUpdatingTargetSelectors[targetSelector];
|
||||
|
||||
// If no more target selectors are in the hash, stop the live updater.
|
||||
if (!liveUpdatingTargetSelectors.length) {
|
||||
if (liveUpdaterIntervalId) {
|
||||
window.clearInterval(liveUpdaterIntervalId);
|
||||
liveUpdaterIntervalId = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Run the live updater. The live updater is periodically run to check if its monitored target selectors require
|
||||
* re-applying of the ellipsis.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function doLiveUpdater() {
|
||||
// If the live updater is already running, skip this time. We only want one instance running at a time.
|
||||
if (!liveUpdaterRunning) {
|
||||
liveUpdaterRunning = true;
|
||||
|
||||
// Loop through target selectors.
|
||||
for (var targetSelector in liveUpdatingTargetSelectors) {
|
||||
$(targetSelector).each(function() {
|
||||
var containerElement, containerData;
|
||||
|
||||
containerElement = $(this);
|
||||
containerData = containerElement.data('jqae');
|
||||
|
||||
// If container element dimensions have changed, or the container element is new, run ellipsis on
|
||||
// that container element.
|
||||
if ((containerData.containerWidth != containerElement.width()) ||
|
||||
(containerData.containerHeight != containerElement.height())) {
|
||||
ellipsisOnElement(containerElement, liveUpdatingTargetSelectors[targetSelector]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
liveUpdaterRunning = false;
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
117
modules/backend/assets/js/vendor/jquery.cookie.js
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
/*!
|
||||
* jQuery Cookie Plugin v1.4.1
|
||||
* https://github.com/carhartl/jquery-cookie
|
||||
*
|
||||
* Copyright 2006, 2014 Klaus Hartl
|
||||
* Released under the MIT license
|
||||
*/
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// CommonJS
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
var pluses = /\+/g;
|
||||
|
||||
function encode(s) {
|
||||
return config.raw ? s : encodeURIComponent(s);
|
||||
}
|
||||
|
||||
function decode(s) {
|
||||
return config.raw ? s : decodeURIComponent(s);
|
||||
}
|
||||
|
||||
function stringifyCookieValue(value) {
|
||||
return encode(config.json ? JSON.stringify(value) : String(value));
|
||||
}
|
||||
|
||||
function parseCookieValue(s) {
|
||||
if (s.indexOf('"') === 0) {
|
||||
// This is a quoted cookie as according to RFC2068, unescape...
|
||||
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
||||
}
|
||||
|
||||
try {
|
||||
// Replace server-side written pluses with spaces.
|
||||
// If we can't decode the cookie, ignore it, it's unusable.
|
||||
// If we can't parse the cookie, ignore it, it's unusable.
|
||||
s = decodeURIComponent(s.replace(pluses, ' '));
|
||||
return config.json ? JSON.parse(s) : s;
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function read(s, converter) {
|
||||
var value = config.raw ? s : parseCookieValue(s);
|
||||
return $.isFunction(converter) ? converter(value) : value;
|
||||
}
|
||||
|
||||
var config = $.cookie = function (key, value, options) {
|
||||
|
||||
// Write
|
||||
|
||||
if (arguments.length > 1 && !$.isFunction(value)) {
|
||||
options = $.extend({}, config.defaults, options);
|
||||
|
||||
if (typeof options.expires === 'number') {
|
||||
var days = options.expires, t = options.expires = new Date();
|
||||
t.setTime(+t + days * 864e+5);
|
||||
}
|
||||
|
||||
return (document.cookie = [
|
||||
encode(key), '=', stringifyCookieValue(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// Read
|
||||
|
||||
var result = key ? undefined : {};
|
||||
|
||||
// To prevent the for loop in the first place assign an empty array
|
||||
// in case there are no cookies at all. Also prevents odd result when
|
||||
// calling $.cookie().
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
|
||||
for (var i = 0, l = cookies.length; i < l; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var name = decode(parts.shift());
|
||||
var cookie = parts.join('=');
|
||||
|
||||
if (key && key === name) {
|
||||
// If second argument (value) is a function it's a converter...
|
||||
result = read(cookie, value);
|
||||
break;
|
||||
}
|
||||
|
||||
// Prevent storing a cookie that we couldn't decode.
|
||||
if (!key && (cookie = read(cookie)) !== undefined) {
|
||||
result[name] = cookie;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
config.defaults = {};
|
||||
|
||||
$.removeCookie = function (key, options) {
|
||||
if ($.cookie(key) === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Must not alter options, thus extending a fresh object...
|
||||
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
||||
return !$.cookie(key);
|
||||
};
|
||||
|
||||
}));
|
||||
2
modules/backend/assets/js/vendor/jquery.min.js
vendored
Normal file
82
modules/backend/assets/js/vendor/jquery.touchwipe.js
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!)
|
||||
* Common usage: wipe images (left and right to show the previous or next image)
|
||||
*
|
||||
* @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
|
||||
* @version 1.1.1 (9th December 2010) - fix bug (older IE's had problems)
|
||||
* @version 1.1 (1st September 2010) - support wipe up and wipe down
|
||||
* @version 1.0 (15th July 2010)
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.touchwipe = function(settings) {
|
||||
var config = {
|
||||
min_move_x: 20,
|
||||
min_move_y: 20,
|
||||
wipeLeft: function() { },
|
||||
wipeRight: function() { },
|
||||
wipeUp: function() { },
|
||||
wipeDown: function() { },
|
||||
preventDefaultEvents: true
|
||||
};
|
||||
|
||||
if (settings) $.extend(config, settings);
|
||||
|
||||
this.each(function() {
|
||||
var startX;
|
||||
var startY;
|
||||
var isMoving = false;
|
||||
|
||||
function cancelTouch() {
|
||||
this.removeEventListener('touchmove', onTouchMove);
|
||||
startX = null;
|
||||
isMoving = false;
|
||||
}
|
||||
|
||||
function onTouchMove(e) {
|
||||
if(config.preventDefaultEvents) {
|
||||
e.preventDefault();
|
||||
}
|
||||
if(isMoving) {
|
||||
var x = e.touches[0].pageX;
|
||||
var y = e.touches[0].pageY;
|
||||
var dx = startX - x;
|
||||
var dy = startY - y;
|
||||
if(Math.abs(dx) >= config.min_move_x) {
|
||||
cancelTouch();
|
||||
if(dx > 0) {
|
||||
config.wipeLeft();
|
||||
}
|
||||
else {
|
||||
config.wipeRight();
|
||||
}
|
||||
}
|
||||
else if(Math.abs(dy) >= config.min_move_y) {
|
||||
cancelTouch();
|
||||
if(dy > 0) {
|
||||
config.wipeDown();
|
||||
}
|
||||
else {
|
||||
config.wipeUp();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onTouchStart(e)
|
||||
{
|
||||
if (e.touches.length == 1) {
|
||||
startX = e.touches[0].pageX;
|
||||
startY = e.touches[0].pageY;
|
||||
isMoving = true;
|
||||
this.addEventListener('touchmove', onTouchMove, false);
|
||||
}
|
||||
}
|
||||
if ('ontouchstart' in document.documentElement) {
|
||||
this.addEventListener('touchstart', onTouchStart, false);
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
63
modules/backend/assets/js/vendor/jquery.waterfall.js
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
(function($) {
|
||||
/**
|
||||
* Runs functions given in arguments in series, each functions passing their results to the next one.
|
||||
* Return jQuery Deferred object.
|
||||
*
|
||||
* @example
|
||||
* $.waterfall(
|
||||
* function() { return $.ajax({url : first_url}) },
|
||||
* function() { return $.ajax({url : second_url}) },
|
||||
* function() { return $.ajax({url : another_url}) }
|
||||
*).fail(function() {
|
||||
* console.log(arguments)
|
||||
*).done(function() {
|
||||
* console.log(arguments)
|
||||
*})
|
||||
*
|
||||
* @example2
|
||||
* event_chain = [];
|
||||
* event_chain.push(function() { var deferred = $.Deferred(); deferred.resolve(); return deferred; });
|
||||
* $.waterfall.apply(this, event_chain).fail(function(){}).done(function(){});
|
||||
*
|
||||
* @author Dmitry (dio) Levashov, dio@std42.ru
|
||||
* @return jQuery.Deferred
|
||||
*/
|
||||
$.waterfall = function() {
|
||||
var steps = [],
|
||||
dfrd = $.Deferred(),
|
||||
pointer = 0;
|
||||
|
||||
$.each(arguments, function(i, a) {
|
||||
steps.push(function() {
|
||||
var args = [].slice.apply(arguments), d;
|
||||
|
||||
if (typeof(a) == 'function') {
|
||||
if (!((d = a.apply(null, args)) && d.promise)) {
|
||||
d = $.Deferred()[d === false ? 'reject' : 'resolve'](d);
|
||||
}
|
||||
} else if (a && a.promise) {
|
||||
d = a;
|
||||
} else {
|
||||
d = $.Deferred()[a === false ? 'reject' : 'resolve'](a);
|
||||
}
|
||||
|
||||
d.fail(function() {
|
||||
dfrd.reject.apply(dfrd, [].slice.apply(arguments));
|
||||
})
|
||||
.done(function(data) {
|
||||
pointer++;
|
||||
args.push(data);
|
||||
|
||||
pointer == steps.length
|
||||
? dfrd.resolve.apply(dfrd, args)
|
||||
: steps[pointer].apply(null, args);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
steps.length ? steps[0]() : dfrd.resolve();
|
||||
|
||||
return dfrd;
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
762
modules/backend/assets/js/winter-min.js
vendored
Normal file
@@ -0,0 +1,762 @@
|
||||
(function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var startY;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false;}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault();}if(isMoving){var x=e.touches[0].pageX;var y=e.touches[0].pageY;var dx=startX-x;var dy=startY-y;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft();}else{config.wipeRight();}}else if(Math.abs(dy)>=config.min_move_y){cancelTouch();if(dy>0){config.wipeDown();}else{config.wipeUp();}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;startY=e.touches[0].pageY;isMoving=true;this.addEventListener('touchmove',onTouchMove,false);}}if('ontouchstart'in document.documentElement){
|
||||
this.addEventListener('touchstart',onTouchStart,false);}});return this;};})(jQuery);(function($){var liveUpdatingTargetSelectors={};var liveUpdaterIntervalId;var liveUpdaterRunning=false;var defaultSettings={ellipsis:'...',setTitle:'never',live:false};$.fn.ellipsis=function(selector,options){var subjectElements,settings;subjectElements=$(this);if(typeof selector!=='string'){options=selector;selector=undefined;}settings=$.extend({},defaultSettings,options);settings.selector=selector;subjectElements.each(function(){var elem=$(this);ellipsisOnElement(elem,settings);});if(settings.live){addToLiveUpdater(subjectElements.selector,settings);}else{removeFromLiveUpdater(subjectElements.selector);}return this;};function ellipsisOnElement(containerElement,settings){var containerData=containerElement.data('jqae');if(!containerData)containerData={};var wrapperElement=containerData.wrapperElement;if(!wrapperElement){wrapperElement=containerElement.wrapInner('<div/>').find('>div');wrapperElement.css({
|
||||
margin:0,padding:0,border:0});}var wrapperElementData=wrapperElement.data('jqae');if(!wrapperElementData)wrapperElementData={};var wrapperOriginalContent=wrapperElementData.originalContent;if(wrapperOriginalContent){wrapperElement=wrapperElementData.originalContent.clone(true).data('jqae',{originalContent:wrapperOriginalContent}).replaceAll(wrapperElement);}else{wrapperElement.data('jqae',{originalContent:wrapperElement.clone(true)});}containerElement.data('jqae',{wrapperElement:wrapperElement,containerWidth:containerElement.width(),containerHeight:containerElement.height()});var containerElementHeight=containerElement.height();var wrapperOffset=(parseInt(containerElement.css('padding-top'),10)||0)+(parseInt(containerElement.css('border-top-width'),10)||0)-(wrapperElement.offset().top-containerElement.offset().top);var deferAppendEllipsis=false;var selectedElements=wrapperElement;if(settings.selector)selectedElements=$(wrapperElement.find(settings.selector).get().reverse());
|
||||
selectedElements.each(function(){var selectedElement=$(this),originalText=selectedElement.text(),ellipsisApplied=false;if(wrapperElement.innerHeight()-selectedElement.innerHeight()>containerElementHeight+wrapperOffset){selectedElement.remove();}else{removeLastEmptyElements(selectedElement);if(selectedElement.contents().length){if(deferAppendEllipsis){getLastTextNode(selectedElement).get(0).nodeValue+=settings.ellipsis;deferAppendEllipsis=false;}while(wrapperElement.innerHeight()>containerElementHeight+wrapperOffset){ellipsisApplied=ellipsisOnLastTextNode(selectedElement);if(ellipsisApplied){removeLastEmptyElements(selectedElement);if(selectedElement.contents().length){getLastTextNode(selectedElement).get(0).nodeValue+=settings.ellipsis;}else{deferAppendEllipsis=true;selectedElement.remove();break;}}else{deferAppendEllipsis=true;selectedElement.remove();break;}}if(((settings.setTitle=='onEllipsis')&&ellipsisApplied)||(settings.setTitle=='always')){selectedElement.attr('title',originalText);
|
||||
}else if(settings.setTitle!='never'){selectedElement.removeAttr('title');}}}});}function ellipsisOnLastTextNode(element){var lastTextNode=getLastTextNode(element);if(lastTextNode.length){var text=lastTextNode.get(0).nodeValue;var pos=text.lastIndexOf(' ');if(pos>-1){text=$.trim(text.substring(0,pos));lastTextNode.get(0).nodeValue=text;}else{lastTextNode.get(0).nodeValue='';}return true;}return false;}function getLastTextNode(element){if(element.contents().length){var contents=element.contents();var lastNode=contents.eq(contents.length-1);if(lastNode.filter(textNodeFilter).length){return lastNode;}else{return getLastTextNode(lastNode);}}else{element.append('');var contents=element.contents();return contents.eq(contents.length-1);}}function removeLastEmptyElements(element){if(element.contents().length){var contents=element.contents();var lastNode=contents.eq(contents.length-1);if(lastNode.filter(textNodeFilter).length){var text=lastNode.get(0).nodeValue;text=$.trim(text);if(text==''){
|
||||
lastNode.remove();return true;}else{return false;}}else{while(removeLastEmptyElements(lastNode)){}if(lastNode.contents().length){return false;}else{lastNode.remove();return true;}}}return false;}function textNodeFilter(){return this.nodeType===3;}function addToLiveUpdater(targetSelector,settings){liveUpdatingTargetSelectors[targetSelector]=settings;if(!liveUpdaterIntervalId){liveUpdaterIntervalId=window.setInterval(function(){doLiveUpdater();},200);}}function removeFromLiveUpdater(targetSelector){if(liveUpdatingTargetSelectors[targetSelector]){delete liveUpdatingTargetSelectors[targetSelector];if(!liveUpdatingTargetSelectors.length){if(liveUpdaterIntervalId){window.clearInterval(liveUpdaterIntervalId);liveUpdaterIntervalId=undefined;}}}};function doLiveUpdater(){if(!liveUpdaterRunning){liveUpdaterRunning=true;for(var targetSelector in liveUpdatingTargetSelectors){$(targetSelector).each(function(){var containerElement,containerData;containerElement=$(this);containerData=containerElement.data('jqae');
|
||||
if((containerData.containerWidth!=containerElement.width())||(containerData.containerHeight!=containerElement.height())){ellipsisOnElement(containerElement,liveUpdatingTargetSelectors[targetSelector]);}});}liveUpdaterRunning=false;}};})(jQuery);(function($){$.waterfall=function(){var steps=[],dfrd=$.Deferred(),pointer=0;$.each(arguments,function(i,a){steps.push(function(){var args=[].slice.apply(arguments),d;if(typeof(a)=='function'){if(!((d=a.apply(null,args))&&d.promise)){d=$.Deferred()[d===false?'reject':'resolve'](d);}}else if(a&&a.promise){d=a;}else{d=$.Deferred()[a===false?'reject':'resolve'](a);}d.fail(function(){dfrd.reject.apply(dfrd,[].slice.apply(arguments));}).done(function(data){pointer++;args.push(data);pointer==steps.length?dfrd.resolve.apply(dfrd,args):steps[pointer].apply(null,args);});});});steps.length?steps[0]():dfrd.resolve();return dfrd;}})(jQuery);(function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else if(typeof exports==='object'){
|
||||
factory(require('jquery'));}else{factory(jQuery);}}(function($){var pluses=/\+/g;function encode(s){return config.raw?s:encodeURIComponent(s);}function decode(s){return config.raw?s:decodeURIComponent(s);}function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value));}function parseCookieValue(s){if(s.indexOf('"')===0){s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,'\\');}try{s=decodeURIComponent(s.replace(pluses,' '));return config.json?JSON.parse(s):s;}catch(e){}}function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value;}var config=$.cookie=function(key,value,options){if(arguments.length>1&&!$.isFunction(value)){options=$.extend({},config.defaults,options);if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setTime(+t+days*864e+5);}return(document.cookie=[encode(key),'=',stringifyCookieValue(value),options.expires?'; expires='+options.expires.toUTCString():'',
|
||||
options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));}var result=key?undefined:{};var cookies=document.cookie?document.cookie.split('; '):[];for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split('=');var name=decode(parts.shift());var cookie=parts.join('=');if(key&&key===name){result=read(cookie,value);break;}if(!key&&(cookie=read(cookie))!==undefined){result[name]=cookie;}}return result;};config.defaults={};$.removeCookie=function(key,options){if($.cookie(key)===undefined){return false;}$.cookie(key,'',$.extend({},options,{expires:-1}));return!$.cookie(key);};}));"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();
|
||||
function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}var Emitter=function(){function Emitter(){_classCallCheck(this,Emitter);}_createClass(Emitter,[{key:"on",value:function on(event,fn){this._callbacks=this._callbacks||{};if(!this._callbacks[event]){
|
||||
this._callbacks[event]=[];}this._callbacks[event].push(fn);return this;}},{key:"emit",value:function emit(event){this._callbacks=this._callbacks||{};var callbacks=this._callbacks[event];if(callbacks){for(var _len=arguments.length,args=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}for(var _iterator=callbacks,_isArray=true,_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++];}else{_i=_iterator.next();if(_i.done)break;_ref=_i.value;}var callback=_ref;callback.apply(this,args);}}return this;}},{key:"off",value:function off(event,fn){if(!this._callbacks||arguments.length===0){this._callbacks={};return this;}var callbacks=this._callbacks[event];if(!callbacks){return this;}if(arguments.length===1){delete this._callbacks[event];return this;}for(var i=0;i<callbacks.length;i++){var callback=callbacks[i];if(callback===fn){callbacks.splice(i,1);break;}}return this;}}]);return Emitter;
|
||||
}();var Dropzone=function(_Emitter){_inherits(Dropzone,_Emitter);_createClass(Dropzone,null,[{key:"initClass",value:function initClass(){this.prototype.Emitter=Emitter;this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"];this.prototype.defaultOptions={url:null,method:"post",withCredentials:false,timeout:30000,parallelUploads:2,uploadMultiple:false,chunking:false,forceChunking:false,chunkSize:2000000,parallelChunkUploads:false,retryChunks:false,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:true,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:'crop',resizeWidth:null,
|
||||
resizeHeight:null,resizeMimeType:null,resizeQuality:0.8,resizeMethod:'contain',filesizeBase:1000,maxFiles:null,headers:null,clickable:true,ignoreHiddenFiles:true,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:true,autoQueue:true,addRemoveLinks:false,previewsContainer:null,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:false,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",
|
||||
dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function init(){},params:function params(files,xhr,chunk){if(chunk){return{dzuuid:chunk.file.upload.uuid,dzchunkindex:chunk.index,dztotalfilesize:chunk.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:chunk.file.upload.totalChunkCount,dzchunkbyteoffset:chunk.index*this.options.chunkSize};}},accept:function accept(file,done){return done();},chunksUploaded:function chunksUploaded(file,done){done();},fallback:function fallback(){var messageElement=void 0;this.element.className=this.element.className+" dz-browser-not-supported";for(var _iterator2=this.element.getElementsByTagName("div"),_isArray2=true,_i2=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i2>=_iterator2.length)break;_ref2=_iterator2[_i2++];}else{_i2=_iterator2.next();if(_i2.done)break;_ref2=_i2.value;}var child=_ref2;
|
||||
if(/(^| )dz-message($| )/.test(child.className)){messageElement=child;child.className="dz-message";break;}}if(!messageElement){messageElement=Dropzone.createElement("<div class=\"dz-message\"><span></span></div>");this.element.appendChild(messageElement);}var span=messageElement.getElementsByTagName("span")[0];if(span){if(span.textContent!=null){span.textContent=this.options.dictFallbackMessage;}else if(span.innerText!=null){span.innerText=this.options.dictFallbackMessage;}}return this.element.appendChild(this.getFallbackForm());},resize:function resize(file,width,height,resizeMethod){var info={srcX:0,srcY:0,srcWidth:file.width,srcHeight:file.height};var srcRatio=file.width/file.height;if(width==null&&height==null){width=info.srcWidth;height=info.srcHeight;}else if(width==null){width=height*srcRatio;}else if(height==null){height=width/srcRatio;}width=Math.min(width,info.srcWidth);height=Math.min(height,info.srcHeight);var trgRatio=width/height;if(info.srcWidth>width||info.srcHeight>height){
|
||||
if(resizeMethod==='crop'){if(srcRatio>trgRatio){info.srcHeight=file.height;info.srcWidth=info.srcHeight*trgRatio;}else{info.srcWidth=file.width;info.srcHeight=info.srcWidth/trgRatio;}}else if(resizeMethod==='contain'){if(srcRatio>trgRatio){height=width/srcRatio;}else{width=height*srcRatio;}}else{throw new Error("Unknown resizeMethod '"+resizeMethod+"'");}}info.srcX=(file.width-info.srcWidth)/2;info.srcY=(file.height-info.srcHeight)/2;info.trgWidth=width;info.trgHeight=height;return info;},transformFile:function transformFile(file,done){if((this.options.resizeWidth||this.options.resizeHeight)&&file.type.match(/image.*/)){return this.resizeImage(file,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,done);}else{return done(file);}},previewTemplate:"<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-image\"><img data-dz-thumbnail /></div>\n <div class=\"dz-details\">\n <div class=\"dz-size\"><span data-dz-size></span></div>\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n </div>\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n <div class=\"dz-success-mark\">\n <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n <title>Check</title>\n <defs></defs>\n <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n <path d=\"M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" stroke-opacity=\"0.198794158\" stroke=\"#747474\" fill-opacity=\"0.816519475\" fill=\"#FFFFFF\" sketch:type=\"MSShapeGroup\"></path>\n </g>\n </svg>\n </div>\n <div class=\"dz-error-mark\">\n <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n <title>Error</title>\n <defs></defs>\n <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n <g id=\"Check-+-Oval-2\" sketch:type=\"MSLayerGroup\" stroke=\"#747474\" stroke-opacity=\"0.198794158\" fill=\"#FFFFFF\" fill-opacity=\"0.816519475\">\n <path d=\"M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" sketch:type=\"MSShapeGroup\"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>",
|
||||
drop:function drop(e){return this.element.classList.remove("dz-drag-hover");},dragstart:function dragstart(e){},dragend:function dragend(e){return this.element.classList.remove("dz-drag-hover");},dragenter:function dragenter(e){return this.element.classList.add("dz-drag-hover");},dragover:function dragover(e){return this.element.classList.add("dz-drag-hover");},dragleave:function dragleave(e){return this.element.classList.remove("dz-drag-hover");},paste:function paste(e){},reset:function reset(){return this.element.classList.remove("dz-started");},addedfile:function addedfile(file){var _this2=this;if(this.element===this.previewsContainer){this.element.classList.add("dz-started");}if(this.previewsContainer){file.previewElement=Dropzone.createElement(this.options.previewTemplate.trim());file.previewTemplate=file.previewElement;this.previewsContainer.appendChild(file.previewElement);for(var _iterator3=file.previewElement.querySelectorAll("[data-dz-name]"),_isArray3=true,_i3=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){
|
||||
var _ref3;if(_isArray3){if(_i3>=_iterator3.length)break;_ref3=_iterator3[_i3++];}else{_i3=_iterator3.next();if(_i3.done)break;_ref3=_i3.value;}var node=_ref3;node.textContent=file.name;}for(var _iterator4=file.previewElement.querySelectorAll("[data-dz-size]"),_isArray4=true,_i4=0,_iterator4=_isArray4?_iterator4:_iterator4[Symbol.iterator]();;){if(_isArray4){if(_i4>=_iterator4.length)break;node=_iterator4[_i4++];}else{_i4=_iterator4.next();if(_i4.done)break;node=_i4.value;}node.innerHTML=this.filesize(file.size);}if(this.options.addRemoveLinks){file._removeLink=Dropzone.createElement("<a class=\"dz-remove\" href=\"javascript:undefined;\" data-dz-remove>"+this.options.dictRemoveFile+"</a>");file.previewElement.appendChild(file._removeLink);}var removeFileEvent=function removeFileEvent(e){e.preventDefault();e.stopPropagation();if(file.status===Dropzone.UPLOADING){return Dropzone.confirm(_this2.options.dictCancelUploadConfirmation,function(){return _this2.removeFile(file);});}else{if(_this2.options.dictRemoveFileConfirmation){
|
||||
return Dropzone.confirm(_this2.options.dictRemoveFileConfirmation,function(){return _this2.removeFile(file);});}else{return _this2.removeFile(file);}}};for(var _iterator5=file.previewElement.querySelectorAll("[data-dz-remove]"),_isArray5=true,_i5=0,_iterator5=_isArray5?_iterator5:_iterator5[Symbol.iterator]();;){var _ref4;if(_isArray5){if(_i5>=_iterator5.length)break;_ref4=_iterator5[_i5++];}else{_i5=_iterator5.next();if(_i5.done)break;_ref4=_i5.value;}var removeLink=_ref4;removeLink.addEventListener("click",removeFileEvent);}}},removedfile:function removedfile(file){if(file.previewElement!=null&&file.previewElement.parentNode!=null){file.previewElement.parentNode.removeChild(file.previewElement);}return this._updateMaxFilesReachedClass();},thumbnail:function thumbnail(file,dataUrl){if(file.previewElement){file.previewElement.classList.remove("dz-file-preview");for(var _iterator6=file.previewElement.querySelectorAll("[data-dz-thumbnail]"),_isArray6=true,_i6=0,_iterator6=_isArray6?_iterator6:_iterator6[Symbol.iterator]();;){
|
||||
var _ref5;if(_isArray6){if(_i6>=_iterator6.length)break;_ref5=_iterator6[_i6++];}else{_i6=_iterator6.next();if(_i6.done)break;_ref5=_i6.value;}var thumbnailElement=_ref5;thumbnailElement.alt=file.name;thumbnailElement.src=dataUrl;}return setTimeout(function(){return file.previewElement.classList.add("dz-image-preview");},1);}},error:function error(file,message){if(file.previewElement){file.previewElement.classList.add("dz-error");if(typeof message!=="String"&&message.error){message=message.error;}for(var _iterator7=file.previewElement.querySelectorAll("[data-dz-errormessage]"),_isArray7=true,_i7=0,_iterator7=_isArray7?_iterator7:_iterator7[Symbol.iterator]();;){var _ref6;if(_isArray7){if(_i7>=_iterator7.length)break;_ref6=_iterator7[_i7++];}else{_i7=_iterator7.next();if(_i7.done)break;_ref6=_i7.value;}var node=_ref6;node.textContent=message;}}},errormultiple:function errormultiple(){},processing:function processing(file){if(file.previewElement){file.previewElement.classList.add("dz-processing");
|
||||
if(file._removeLink){return file._removeLink.innerHTML=this.options.dictCancelUpload;}}},processingmultiple:function processingmultiple(){},uploadprogress:function uploadprogress(file,progress,bytesSent){if(file.previewElement){for(var _iterator8=file.previewElement.querySelectorAll("[data-dz-uploadprogress]"),_isArray8=true,_i8=0,_iterator8=_isArray8?_iterator8:_iterator8[Symbol.iterator]();;){var _ref7;if(_isArray8){if(_i8>=_iterator8.length)break;_ref7=_iterator8[_i8++];}else{_i8=_iterator8.next();if(_i8.done)break;_ref7=_i8.value;}var node=_ref7;node.nodeName==='PROGRESS'?node.value=progress:node.style.width=progress+"%";}}},totaluploadprogress:function totaluploadprogress(){},sending:function sending(){},sendingmultiple:function sendingmultiple(){},success:function success(file){if(file.previewElement){return file.previewElement.classList.add("dz-success");}},successmultiple:function successmultiple(){},canceled:function canceled(file){return this.emit("error",file,this.options.dictUploadCanceled);
|
||||
},canceledmultiple:function canceledmultiple(){},complete:function complete(file){if(file._removeLink){file._removeLink.innerHTML=this.options.dictRemoveFile;}if(file.previewElement){return file.previewElement.classList.add("dz-complete");}},completemultiple:function completemultiple(){},maxfilesexceeded:function maxfilesexceeded(){},maxfilesreached:function maxfilesreached(){},queuecomplete:function queuecomplete(){},addedfiles:function addedfiles(){}};this.prototype._thumbnailQueue=[];this.prototype._processingThumbnail=false;}},{key:"extend",value:function extend(target){for(var _len2=arguments.length,objects=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){objects[_key2-1]=arguments[_key2];}for(var _iterator9=objects,_isArray9=true,_i9=0,_iterator9=_isArray9?_iterator9:_iterator9[Symbol.iterator]();;){var _ref8;if(_isArray9){if(_i9>=_iterator9.length)break;_ref8=_iterator9[_i9++];}else{_i9=_iterator9.next();if(_i9.done)break;_ref8=_i9.value;}var object=_ref8;for(var key in object){
|
||||
var val=object[key];target[key]=val;}}return target;}}]);function Dropzone(el,options){_classCallCheck(this,Dropzone);var _this=_possibleConstructorReturn(this,(Dropzone.__proto__||Object.getPrototypeOf(Dropzone)).call(this));var fallback=void 0,left=void 0;_this.element=el;_this.version=Dropzone.version;_this.defaultOptions.previewTemplate=_this.defaultOptions.previewTemplate.replace(/\n*/g,"");_this.clickableElements=[];_this.listeners=[];_this.files=[];if(typeof _this.element==="string"){_this.element=document.querySelector(_this.element);}if(!_this.element||_this.element.nodeType==null){throw new Error("Invalid dropzone element.");}if(_this.element.dropzone){throw new Error("Dropzone already attached.");}Dropzone.instances.push(_this);_this.element.dropzone=_this;var elementOptions=(left=Dropzone.optionsForElement(_this.element))!=null?left:{};_this.options=Dropzone.extend({},_this.defaultOptions,elementOptions,options!=null?options:{});if(_this.options.forceFallback||!Dropzone.isBrowserSupported()){
|
||||
var _ret;return _ret=_this.options.fallback.call(_this),_possibleConstructorReturn(_this,_ret);}if(_this.options.url==null){_this.options.url=_this.element.getAttribute("action");}if(!_this.options.url){throw new Error("No URL provided.");}if(_this.options.acceptedFiles&&_this.options.acceptedMimeTypes){throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");}if(_this.options.uploadMultiple&&_this.options.chunking){throw new Error('You cannot set both: uploadMultiple and chunking.');}if(_this.options.acceptedMimeTypes){_this.options.acceptedFiles=_this.options.acceptedMimeTypes;delete _this.options.acceptedMimeTypes;}if(_this.options.renameFilename!=null){_this.options.renameFile=function(file){return _this.options.renameFilename.call(_this,file.name,file);};}_this.options.method=_this.options.method.toUpperCase();if((fallback=_this.getExistingFallback())&&fallback.parentNode){fallback.parentNode.removeChild(fallback);}if(_this.options.previewsContainer!==false){
|
||||
if(_this.options.previewsContainer){_this.previewsContainer=Dropzone.getElement(_this.options.previewsContainer,"previewsContainer");}else{_this.previewsContainer=_this.element;}}if(_this.options.clickable){if(_this.options.clickable===true){_this.clickableElements=[_this.element];}else{_this.clickableElements=Dropzone.getElements(_this.options.clickable,"clickable");}}_this.init();return _this;}_createClass(Dropzone,[{key:"getAcceptedFiles",value:function getAcceptedFiles(){return this.files.filter(function(file){return file.accepted;}).map(function(file){return file;});}},{key:"getRejectedFiles",value:function getRejectedFiles(){return this.files.filter(function(file){return!file.accepted;}).map(function(file){return file;});}},{key:"getFilesWithStatus",value:function getFilesWithStatus(status){return this.files.filter(function(file){return file.status===status;}).map(function(file){return file;});}},{key:"getQueuedFiles",value:function getQueuedFiles(){return this.getFilesWithStatus(Dropzone.QUEUED);
|
||||
}},{key:"getUploadingFiles",value:function getUploadingFiles(){return this.getFilesWithStatus(Dropzone.UPLOADING);}},{key:"getAddedFiles",value:function getAddedFiles(){return this.getFilesWithStatus(Dropzone.ADDED);}},{key:"getActiveFiles",value:function getActiveFiles(){return this.files.filter(function(file){return file.status===Dropzone.UPLOADING||file.status===Dropzone.QUEUED;}).map(function(file){return file;});}},{key:"init",value:function init(){var _this3=this;if(this.element.tagName==="form"){this.element.setAttribute("enctype","multipart/form-data");}if(this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")){this.element.appendChild(Dropzone.createElement("<div class=\"dz-default dz-message\"><span>"+this.options.dictDefaultMessage+"</span></div>"));}if(this.clickableElements.length){var setupHiddenFileInput=function setupHiddenFileInput(){if(_this3.hiddenFileInput){_this3.hiddenFileInput.parentNode.removeChild(_this3.hiddenFileInput);}_this3.hiddenFileInput=document.createElement("input");
|
||||
_this3.hiddenFileInput.setAttribute("type","file");if(_this3.options.maxFiles===null||_this3.options.maxFiles>1){_this3.hiddenFileInput.setAttribute("multiple","multiple");}_this3.hiddenFileInput.className="dz-hidden-input";if(_this3.options.acceptedFiles!==null){_this3.hiddenFileInput.setAttribute("accept",_this3.options.acceptedFiles);}if(_this3.options.capture!==null){_this3.hiddenFileInput.setAttribute("capture",_this3.options.capture);}_this3.hiddenFileInput.style.visibility="hidden";_this3.hiddenFileInput.style.position="absolute";_this3.hiddenFileInput.style.top="0";_this3.hiddenFileInput.style.left="0";_this3.hiddenFileInput.style.height="0";_this3.hiddenFileInput.style.width="0";Dropzone.getElement(_this3.options.hiddenInputContainer,'hiddenInputContainer').appendChild(_this3.hiddenFileInput);return _this3.hiddenFileInput.addEventListener("change",function(){var files=_this3.hiddenFileInput.files;if(files.length){for(var _iterator10=files,_isArray10=true,_i10=0,_iterator10=_isArray10?_iterator10:_iterator10[Symbol.iterator]();;){
|
||||
var _ref9;if(_isArray10){if(_i10>=_iterator10.length)break;_ref9=_iterator10[_i10++];}else{_i10=_iterator10.next();if(_i10.done)break;_ref9=_i10.value;}var file=_ref9;_this3.addFile(file);}}_this3.emit("addedfiles",files);return setupHiddenFileInput();});};setupHiddenFileInput();}this.URL=window.URL!==null?window.URL:window.webkitURL;for(var _iterator11=this.events,_isArray11=true,_i11=0,_iterator11=_isArray11?_iterator11:_iterator11[Symbol.iterator]();;){var _ref10;if(_isArray11){if(_i11>=_iterator11.length)break;_ref10=_iterator11[_i11++];}else{_i11=_iterator11.next();if(_i11.done)break;_ref10=_i11.value;}var eventName=_ref10;this.on(eventName,this.options[eventName]);}this.on("uploadprogress",function(){return _this3.updateTotalUploadProgress();});this.on("removedfile",function(){return _this3.updateTotalUploadProgress();});this.on("canceled",function(file){return _this3.emit("complete",file);});this.on("complete",function(file){if(_this3.getAddedFiles().length===0&&_this3.getUploadingFiles().length===0&&_this3.getQueuedFiles().length===0){
|
||||
return setTimeout(function(){return _this3.emit("queuecomplete");},0);}});var noPropagation=function noPropagation(e){e.stopPropagation();if(e.preventDefault){return e.preventDefault();}else{return e.returnValue=false;}};this.listeners=[{element:this.element,events:{"dragstart":function dragstart(e){return _this3.emit("dragstart",e);},"dragenter":function dragenter(e){noPropagation(e);return _this3.emit("dragenter",e);},"dragover":function dragover(e){var efct=void 0;try{efct=e.dataTransfer.effectAllowed;}catch(error){}e.dataTransfer.dropEffect='move'===efct||'linkMove'===efct?'move':'copy';noPropagation(e);return _this3.emit("dragover",e);},"dragleave":function dragleave(e){return _this3.emit("dragleave",e);},"drop":function drop(e){noPropagation(e);return _this3.drop(e);},"dragend":function dragend(e){return _this3.emit("dragend",e);}}}];this.clickableElements.forEach(function(clickableElement){return _this3.listeners.push({element:clickableElement,events:{"click":function click(evt){
|
||||
if(clickableElement!==_this3.element||evt.target===_this3.element||Dropzone.elementInside(evt.target,_this3.element.querySelector(".dz-message"))){_this3.hiddenFileInput.click();}return true;}}});});this.enable();return this.options.init.call(this);}},{key:"destroy",value:function destroy(){this.disable();this.removeAllFiles(true);if(this.hiddenFileInput!=null?this.hiddenFileInput.parentNode:undefined){this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);this.hiddenFileInput=null;}delete this.element.dropzone;return Dropzone.instances.splice(Dropzone.instances.indexOf(this),1);}},{key:"updateTotalUploadProgress",value:function updateTotalUploadProgress(){var totalUploadProgress=void 0;var totalBytesSent=0;var totalBytes=0;var activeFiles=this.getActiveFiles();if(activeFiles.length){for(var _iterator12=this.getActiveFiles(),_isArray12=true,_i12=0,_iterator12=_isArray12?_iterator12:_iterator12[Symbol.iterator]();;){var _ref11;if(_isArray12){if(_i12>=_iterator12.length)break;
|
||||
_ref11=_iterator12[_i12++];}else{_i12=_iterator12.next();if(_i12.done)break;_ref11=_i12.value;}var file=_ref11;totalBytesSent+=file.upload.bytesSent;totalBytes+=file.upload.total;}totalUploadProgress=100*totalBytesSent/totalBytes;}else{totalUploadProgress=100;}return this.emit("totaluploadprogress",totalUploadProgress,totalBytes,totalBytesSent);}},{key:"_getParamName",value:function _getParamName(n){if(typeof this.options.paramName==="function"){return this.options.paramName(n);}else{return""+this.options.paramName+(this.options.uploadMultiple?"["+n+"]":"");}}},{key:"_renameFile",value:function _renameFile(file){if(typeof this.options.renameFile!=="function"){return file.name;}return this.options.renameFile(file);}},{key:"getFallbackForm",value:function getFallbackForm(){var existingFallback=void 0,form=void 0;if(existingFallback=this.getExistingFallback()){return existingFallback;}var fieldsString="<div class=\"dz-fallback\">";if(this.options.dictFallbackText){fieldsString+="<p>"+this.options.dictFallbackText+"</p>";
|
||||
}fieldsString+="<input type=\"file\" name=\""+this._getParamName(0)+"\" "+(this.options.uploadMultiple?'multiple="multiple"':undefined)+" /><input type=\"submit\" value=\"Upload!\"></div>";var fields=Dropzone.createElement(fieldsString);if(this.element.tagName!=="FORM"){form=Dropzone.createElement("<form action=\""+this.options.url+"\" enctype=\"multipart/form-data\" method=\""+this.options.method+"\"></form>");form.appendChild(fields);}else{this.element.setAttribute("enctype","multipart/form-data");this.element.setAttribute("method",this.options.method);}return form!=null?form:fields;}},{key:"getExistingFallback",value:function getExistingFallback(){var getFallback=function getFallback(elements){for(var _iterator13=elements,_isArray13=true,_i13=0,_iterator13=_isArray13?_iterator13:_iterator13[Symbol.iterator]();;){var _ref12;if(_isArray13){if(_i13>=_iterator13.length)break;_ref12=_iterator13[_i13++];}else{_i13=_iterator13.next();if(_i13.done)break;_ref12=_i13.value;}var el=_ref12;if(/(^| )fallback($| )/.test(el.className)){
|
||||
return el;}}};var _arr=["div","form"];for(var _i14=0;_i14<_arr.length;_i14++){var tagName=_arr[_i14];var fallback;if(fallback=getFallback(this.element.getElementsByTagName(tagName))){return fallback;}}}},{key:"setupEventListeners",value:function setupEventListeners(){return this.listeners.map(function(elementListeners){return function(){var result=[];for(var event in elementListeners.events){var listener=elementListeners.events[event];result.push(elementListeners.element.addEventListener(event,listener,false));}return result;}();});}},{key:"removeEventListeners",value:function removeEventListeners(){return this.listeners.map(function(elementListeners){return function(){var result=[];for(var event in elementListeners.events){var listener=elementListeners.events[event];result.push(elementListeners.element.removeEventListener(event,listener,false));}return result;}();});}},{key:"disable",value:function disable(){var _this4=this;this.clickableElements.forEach(function(element){return element.classList.remove("dz-clickable");
|
||||
});this.removeEventListeners();this.disabled=true;return this.files.map(function(file){return _this4.cancelUpload(file);});}},{key:"enable",value:function enable(){delete this.disabled;this.clickableElements.forEach(function(element){return element.classList.add("dz-clickable");});return this.setupEventListeners();}},{key:"filesize",value:function filesize(size){var selectedSize=0;var selectedUnit="b";if(size>0){var units=['tb','gb','mb','kb','b'];for(var i=0;i<units.length;i++){var unit=units[i];var cutoff=Math.pow(this.options.filesizeBase,4-i)/10;if(size>=cutoff){selectedSize=size/Math.pow(this.options.filesizeBase,4-i);selectedUnit=unit;break;}}selectedSize=Math.round(10*selectedSize)/10;}return"<strong>"+selectedSize+"</strong> "+this.options.dictFileSizeUnits[selectedUnit];}},{key:"_updateMaxFilesReachedClass",value:function _updateMaxFilesReachedClass(){if(this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles){if(this.getAcceptedFiles().length===this.options.maxFiles){
|
||||
this.emit('maxfilesreached',this.files);}return this.element.classList.add("dz-max-files-reached");}else{return this.element.classList.remove("dz-max-files-reached");}}},{key:"drop",value:function drop(e){if(!e.dataTransfer){return;}this.emit("drop",e);var files=[];for(var i=0;i<e.dataTransfer.files.length;i++){files[i]=e.dataTransfer.files[i];}this.emit("addedfiles",files);if(files.length){var items=e.dataTransfer.items;if(items&&items.length&&items[0].webkitGetAsEntry!=null){this._addFilesFromItems(items);}else{this.handleFiles(files);}}}},{key:"paste",value:function paste(e){if(__guard__(e!=null?e.clipboardData:undefined,function(x){return x.items;})==null){return;}this.emit("paste",e);var items=e.clipboardData.items;if(items.length){return this._addFilesFromItems(items);}}},{key:"handleFiles",value:function handleFiles(files){for(var _iterator14=files,_isArray14=true,_i15=0,_iterator14=_isArray14?_iterator14:_iterator14[Symbol.iterator]();;){var _ref13;if(_isArray14){if(_i15>=_iterator14.length)break;
|
||||
_ref13=_iterator14[_i15++];}else{_i15=_iterator14.next();if(_i15.done)break;_ref13=_i15.value;}var file=_ref13;this.addFile(file);}}},{key:"_addFilesFromItems",value:function _addFilesFromItems(items){var _this5=this;return function(){var result=[];for(var _iterator15=items,_isArray15=true,_i16=0,_iterator15=_isArray15?_iterator15:_iterator15[Symbol.iterator]();;){var _ref14;if(_isArray15){if(_i16>=_iterator15.length)break;_ref14=_iterator15[_i16++];}else{_i16=_iterator15.next();if(_i16.done)break;_ref14=_i16.value;}var item=_ref14;var entry;if(item.webkitGetAsEntry!=null&&(entry=item.webkitGetAsEntry())){if(entry.isFile){result.push(_this5.addFile(item.getAsFile()));}else if(entry.isDirectory){result.push(_this5._addFilesFromDirectory(entry,entry.name));}else{result.push(undefined);}}else if(item.getAsFile!=null){if(item.kind==null||item.kind==="file"){result.push(_this5.addFile(item.getAsFile()));}else{result.push(undefined);}}else{result.push(undefined);}}return result;}();}},{key:"_addFilesFromDirectory",
|
||||
value:function _addFilesFromDirectory(directory,path){var _this6=this;var dirReader=directory.createReader();var errorHandler=function errorHandler(error){return __guardMethod__(console,'log',function(o){return o.log(error);});};var readEntries=function readEntries(){return dirReader.readEntries(function(entries){if(entries.length>0){for(var _iterator16=entries,_isArray16=true,_i17=0,_iterator16=_isArray16?_iterator16:_iterator16[Symbol.iterator]();;){var _ref15;if(_isArray16){if(_i17>=_iterator16.length)break;_ref15=_iterator16[_i17++];}else{_i17=_iterator16.next();if(_i17.done)break;_ref15=_i17.value;}var entry=_ref15;if(entry.isFile){entry.file(function(file){if(_this6.options.ignoreHiddenFiles&&file.name.substring(0,1)==='.'){return;}file.fullPath=path+"/"+file.name;return _this6.addFile(file);});}else if(entry.isDirectory){_this6._addFilesFromDirectory(entry,path+"/"+entry.name);}}readEntries();}return null;},errorHandler);};return readEntries();}},{key:"accept",value:function accept(file,done){
|
||||
if(this.options.maxFilesize&&file.size>this.options.maxFilesize*1024*1024){return done(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(file.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize));}else if(!Dropzone.isValidFile(file,this.options.acceptedFiles)){return done(this.options.dictInvalidFileType);}else if(this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles){done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles));return this.emit("maxfilesexceeded",file);}else{return this.options.accept.call(this,file,done);}}},{key:"addFile",value:function addFile(file){var _this7=this;file.upload={uuid:Dropzone.uuidv4(),progress:0,total:file.size,bytesSent:0,filename:this._renameFile(file),chunked:this.options.chunking&&(this.options.forceChunking||file.size>this.options.chunkSize),totalChunkCount:Math.ceil(file.size/this.options.chunkSize)};this.files.push(file);file.status=Dropzone.ADDED;this.emit("addedfile",file);
|
||||
this._enqueueThumbnail(file);return this.accept(file,function(error){if(error){file.accepted=false;_this7._errorProcessing([file],error);}else{file.accepted=true;if(_this7.options.autoQueue){_this7.enqueueFile(file);}}return _this7._updateMaxFilesReachedClass();});}},{key:"enqueueFiles",value:function enqueueFiles(files){for(var _iterator17=files,_isArray17=true,_i18=0,_iterator17=_isArray17?_iterator17:_iterator17[Symbol.iterator]();;){var _ref16;if(_isArray17){if(_i18>=_iterator17.length)break;_ref16=_iterator17[_i18++];}else{_i18=_iterator17.next();if(_i18.done)break;_ref16=_i18.value;}var file=_ref16;this.enqueueFile(file);}return null;}},{key:"enqueueFile",value:function enqueueFile(file){var _this8=this;if(file.status===Dropzone.ADDED&&file.accepted===true){file.status=Dropzone.QUEUED;if(this.options.autoProcessQueue){return setTimeout(function(){return _this8.processQueue();},0);}}else{throw new Error("This file can't be queued because it has already been processed or was rejected.");
|
||||
}}},{key:"_enqueueThumbnail",value:function _enqueueThumbnail(file){var _this9=this;if(this.options.createImageThumbnails&&file.type.match(/image.*/)&&file.size<=this.options.maxThumbnailFilesize*1024*1024){this._thumbnailQueue.push(file);return setTimeout(function(){return _this9._processThumbnailQueue();},0);}}},{key:"_processThumbnailQueue",value:function _processThumbnailQueue(){var _this10=this;if(this._processingThumbnail||this._thumbnailQueue.length===0){return;}this._processingThumbnail=true;var file=this._thumbnailQueue.shift();return this.createThumbnail(file,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,true,function(dataUrl){_this10.emit("thumbnail",file,dataUrl);_this10._processingThumbnail=false;return _this10._processThumbnailQueue();});}},{key:"removeFile",value:function removeFile(file){if(file.status===Dropzone.UPLOADING){this.cancelUpload(file);}this.files=without(this.files,file);this.emit("removedfile",file);if(this.files.length===0){
|
||||
return this.emit("reset");}}},{key:"removeAllFiles",value:function removeAllFiles(cancelIfNecessary){if(cancelIfNecessary==null){cancelIfNecessary=false;}for(var _iterator18=this.files.slice(),_isArray18=true,_i19=0,_iterator18=_isArray18?_iterator18:_iterator18[Symbol.iterator]();;){var _ref17;if(_isArray18){if(_i19>=_iterator18.length)break;_ref17=_iterator18[_i19++];}else{_i19=_iterator18.next();if(_i19.done)break;_ref17=_i19.value;}var file=_ref17;if(file.status!==Dropzone.UPLOADING||cancelIfNecessary){this.removeFile(file);}}return null;}},{key:"resizeImage",value:function resizeImage(file,width,height,resizeMethod,callback){var _this11=this;return this.createThumbnail(file,width,height,resizeMethod,true,function(dataUrl,canvas){if(canvas==null){return callback(file);}else{var resizeMimeType=_this11.options.resizeMimeType;if(resizeMimeType==null){resizeMimeType=file.type;}var resizedDataURL=canvas.toDataURL(resizeMimeType,_this11.options.resizeQuality);if(resizeMimeType==='image/jpeg'||resizeMimeType==='image/jpg'){
|
||||
resizedDataURL=ExifRestore.restore(file.dataURL,resizedDataURL);}return callback(Dropzone.dataURItoBlob(resizedDataURL));}});}},{key:"createThumbnail",value:function createThumbnail(file,width,height,resizeMethod,fixOrientation,callback){var _this12=this;var fileReader=new FileReader();fileReader.onload=function(){file.dataURL=fileReader.result;if(file.type==="image/svg+xml"){if(callback!=null){callback(fileReader.result);}return;}return _this12.createThumbnailFromUrl(file,width,height,resizeMethod,fixOrientation,callback);};return fileReader.readAsDataURL(file);}},{key:"createThumbnailFromUrl",value:function createThumbnailFromUrl(file,width,height,resizeMethod,fixOrientation,callback,crossOrigin){var _this13=this;var img=document.createElement("img");if(crossOrigin){img.crossOrigin=crossOrigin;}img.onload=function(){var loadExif=function loadExif(callback){return callback(1);};if(typeof EXIF!=='undefined'&&EXIF!==null&&fixOrientation){loadExif=function loadExif(callback){return EXIF.getData(img,function(){
|
||||
return callback(EXIF.getTag(this,'Orientation'));});};}return loadExif(function(orientation){file.width=img.width;file.height=img.height;var resizeInfo=_this13.options.resize.call(_this13,file,width,height,resizeMethod);var canvas=document.createElement("canvas");var ctx=canvas.getContext("2d");canvas.width=resizeInfo.trgWidth;canvas.height=resizeInfo.trgHeight;if(orientation>4){canvas.width=resizeInfo.trgHeight;canvas.height=resizeInfo.trgWidth;}switch(orientation){case 2:ctx.translate(canvas.width,0);ctx.scale(-1,1);break;case 3:ctx.translate(canvas.width,canvas.height);ctx.rotate(Math.PI);break;case 4:ctx.translate(0,canvas.height);ctx.scale(1,-1);break;case 5:ctx.rotate(0.5*Math.PI);ctx.scale(1,-1);break;case 6:ctx.rotate(0.5*Math.PI);ctx.translate(0,-canvas.width);break;case 7:ctx.rotate(0.5*Math.PI);ctx.translate(canvas.height,-canvas.width);ctx.scale(-1,1);break;case 8:ctx.rotate(-0.5*Math.PI);ctx.translate(-canvas.height,0);break;}drawImageIOSFix(ctx,img,resizeInfo.srcX!=null?resizeInfo.srcX:0,resizeInfo.srcY!=null?resizeInfo.srcY:0,resizeInfo.srcWidth,resizeInfo.srcHeight,resizeInfo.trgX!=null?resizeInfo.trgX:0,resizeInfo.trgY!=null?resizeInfo.trgY:0,resizeInfo.trgWidth,resizeInfo.trgHeight);
|
||||
var thumbnail=canvas.toDataURL("image/png");if(callback!=null){return callback(thumbnail,canvas);}});};if(callback!=null){img.onerror=callback;}return img.src=file.dataURL;}},{key:"processQueue",value:function processQueue(){var parallelUploads=this.options.parallelUploads;var processingLength=this.getUploadingFiles().length;var i=processingLength;if(processingLength>=parallelUploads){return;}var queuedFiles=this.getQueuedFiles();if(!(queuedFiles.length>0)){return;}if(this.options.uploadMultiple){return this.processFiles(queuedFiles.slice(0,parallelUploads-processingLength));}else{while(i<parallelUploads){if(!queuedFiles.length){return;}this.processFile(queuedFiles.shift());i++;}}}},{key:"processFile",value:function processFile(file){return this.processFiles([file]);}},{key:"processFiles",value:function processFiles(files){for(var _iterator19=files,_isArray19=true,_i20=0,_iterator19=_isArray19?_iterator19:_iterator19[Symbol.iterator]();;){var _ref18;if(_isArray19){if(_i20>=_iterator19.length)break;
|
||||
_ref18=_iterator19[_i20++];}else{_i20=_iterator19.next();if(_i20.done)break;_ref18=_i20.value;}var file=_ref18;file.processing=true;file.status=Dropzone.UPLOADING;this.emit("processing",file);}if(this.options.uploadMultiple){this.emit("processingmultiple",files);}return this.uploadFiles(files);}},{key:"_getFilesWithXhr",value:function _getFilesWithXhr(xhr){var files=void 0;return files=this.files.filter(function(file){return file.xhr===xhr;}).map(function(file){return file;});}},{key:"cancelUpload",value:function cancelUpload(file){if(file.status===Dropzone.UPLOADING){var groupedFiles=this._getFilesWithXhr(file.xhr);for(var _iterator20=groupedFiles,_isArray20=true,_i21=0,_iterator20=_isArray20?_iterator20:_iterator20[Symbol.iterator]();;){var _ref19;if(_isArray20){if(_i21>=_iterator20.length)break;_ref19=_iterator20[_i21++];}else{_i21=_iterator20.next();if(_i21.done)break;_ref19=_i21.value;}var groupedFile=_ref19;groupedFile.status=Dropzone.CANCELED;}if(typeof file.xhr!=='undefined'){
|
||||
file.xhr.abort();}for(var _iterator21=groupedFiles,_isArray21=true,_i22=0,_iterator21=_isArray21?_iterator21:_iterator21[Symbol.iterator]();;){var _ref20;if(_isArray21){if(_i22>=_iterator21.length)break;_ref20=_iterator21[_i22++];}else{_i22=_iterator21.next();if(_i22.done)break;_ref20=_i22.value;}var _groupedFile=_ref20;this.emit("canceled",_groupedFile);}if(this.options.uploadMultiple){this.emit("canceledmultiple",groupedFiles);}}else if(file.status===Dropzone.ADDED||file.status===Dropzone.QUEUED){file.status=Dropzone.CANCELED;this.emit("canceled",file);if(this.options.uploadMultiple){this.emit("canceledmultiple",[file]);}}if(this.options.autoProcessQueue){return this.processQueue();}}},{key:"resolveOption",value:function resolveOption(option){if(typeof option==='function'){for(var _len3=arguments.length,args=Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3];}return option.apply(this,args);}return option;}},{key:"uploadFile",value:function uploadFile(file){
|
||||
return this.uploadFiles([file]);}},{key:"uploadFiles",value:function uploadFiles(files){var _this14=this;this._transformFiles(files,function(transformedFiles){if(files[0].upload.chunked){var file=files[0];var transformedFile=transformedFiles[0];var startedChunkCount=0;file.upload.chunks=[];var handleNextChunk=function handleNextChunk(){var chunkIndex=0;while(file.upload.chunks[chunkIndex]!==undefined){chunkIndex++;}if(chunkIndex>=file.upload.totalChunkCount)return;startedChunkCount++;var start=chunkIndex*_this14.options.chunkSize;var end=Math.min(start+_this14.options.chunkSize,file.size);var dataBlock={name:_this14._getParamName(0),data:transformedFile.webkitSlice?transformedFile.webkitSlice(start,end):transformedFile.slice(start,end),filename:file.upload.filename,chunkIndex:chunkIndex};file.upload.chunks[chunkIndex]={file:file,index:chunkIndex,dataBlock:dataBlock,status:Dropzone.UPLOADING,progress:0,retries:0};_this14._uploadData(files,[dataBlock]);};file.upload.finishedChunkUpload=function(chunk){
|
||||
var allFinished=true;chunk.status=Dropzone.SUCCESS;chunk.dataBlock=null;chunk.xhr=null;for(var i=0;i<file.upload.totalChunkCount;i++){if(file.upload.chunks[i]===undefined){return handleNextChunk();}if(file.upload.chunks[i].status!==Dropzone.SUCCESS){allFinished=false;}}if(allFinished){_this14.options.chunksUploaded(file,function(){_this14._finished(files,'',null);});}};if(_this14.options.parallelChunkUploads){for(var i=0;i<file.upload.totalChunkCount;i++){handleNextChunk();}}else{handleNextChunk();}}else{var dataBlocks=[];for(var _i23=0;_i23<files.length;_i23++){dataBlocks[_i23]={name:_this14._getParamName(_i23),data:transformedFiles[_i23],filename:files[_i23].upload.filename};}_this14._uploadData(files,dataBlocks);}});}},{key:"_getChunk",value:function _getChunk(file,xhr){for(var i=0;i<file.upload.totalChunkCount;i++){if(file.upload.chunks[i]!==undefined&&file.upload.chunks[i].xhr===xhr){return file.upload.chunks[i];}}}},{key:"_uploadData",value:function _uploadData(files,dataBlocks){
|
||||
var _this15=this;var xhr=new XMLHttpRequest();for(var _iterator22=files,_isArray22=true,_i24=0,_iterator22=_isArray22?_iterator22:_iterator22[Symbol.iterator]();;){var _ref21;if(_isArray22){if(_i24>=_iterator22.length)break;_ref21=_iterator22[_i24++];}else{_i24=_iterator22.next();if(_i24.done)break;_ref21=_i24.value;}var file=_ref21;file.xhr=xhr;}if(files[0].upload.chunked){files[0].upload.chunks[dataBlocks[0].chunkIndex].xhr=xhr;}var method=this.resolveOption(this.options.method,files);var url=this.resolveOption(this.options.url,files);xhr.open(method,url,true);xhr.timeout=this.resolveOption(this.options.timeout,files);xhr.withCredentials=!!this.options.withCredentials;xhr.onload=function(e){_this15._finishedUploading(files,xhr,e);};xhr.onerror=function(){_this15._handleUploadError(files,xhr);};var progressObj=xhr.upload!=null?xhr.upload:xhr;progressObj.onprogress=function(e){return _this15._updateFilesUploadProgress(files,xhr,e);};var headers={"Accept":"application/json",
|
||||
"Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};if(this.options.headers){Dropzone.extend(headers,this.options.headers);}for(var headerName in headers){var headerValue=headers[headerName];if(headerValue){xhr.setRequestHeader(headerName,headerValue);}}var formData=new FormData();if(this.options.params){var additionalParams=this.options.params;if(typeof additionalParams==='function'){additionalParams=additionalParams.call(this,files,xhr,files[0].upload.chunked?this._getChunk(files[0],xhr):null);}for(var key in additionalParams){var value=additionalParams[key];formData.append(key,value);}}for(var _iterator23=files,_isArray23=true,_i25=0,_iterator23=_isArray23?_iterator23:_iterator23[Symbol.iterator]();;){var _ref22;if(_isArray23){if(_i25>=_iterator23.length)break;_ref22=_iterator23[_i25++];}else{_i25=_iterator23.next();if(_i25.done)break;_ref22=_i25.value;}var _file=_ref22;this.emit("sending",_file,xhr,formData);}if(this.options.uploadMultiple){this.emit("sendingmultiple",files,xhr,formData);
|
||||
}this._addFormElementData(formData);for(var i=0;i<dataBlocks.length;i++){var dataBlock=dataBlocks[i];formData.append(dataBlock.name,dataBlock.data,dataBlock.filename);}this.submitRequest(xhr,formData,files);}},{key:"_transformFiles",value:function _transformFiles(files,done){var _this16=this;var transformedFiles=[];var doneCounter=0;var _loop=function _loop(i){_this16.options.transformFile.call(_this16,files[i],function(transformedFile){transformedFiles[i]=transformedFile;if(++doneCounter===files.length){done(transformedFiles);}});};for(var i=0;i<files.length;i++){_loop(i);}}},{key:"_addFormElementData",value:function _addFormElementData(formData){if(this.element.tagName==="FORM"){for(var _iterator24=this.element.querySelectorAll("input, textarea, select, button"),_isArray24=true,_i26=0,_iterator24=_isArray24?_iterator24:_iterator24[Symbol.iterator]();;){var _ref23;if(_isArray24){if(_i26>=_iterator24.length)break;_ref23=_iterator24[_i26++];}else{_i26=_iterator24.next();if(_i26.done)break;
|
||||
_ref23=_i26.value;}var input=_ref23;var inputName=input.getAttribute("name");var inputType=input.getAttribute("type");if(inputType)inputType=inputType.toLowerCase();if(typeof inputName==='undefined'||inputName===null)continue;if(input.tagName==="SELECT"&&input.hasAttribute("multiple")){for(var _iterator25=input.options,_isArray25=true,_i27=0,_iterator25=_isArray25?_iterator25:_iterator25[Symbol.iterator]();;){var _ref24;if(_isArray25){if(_i27>=_iterator25.length)break;_ref24=_iterator25[_i27++];}else{_i27=_iterator25.next();if(_i27.done)break;_ref24=_i27.value;}var option=_ref24;if(option.selected){formData.append(inputName,option.value);}}}else if(!inputType||inputType!=="checkbox"&&inputType!=="radio"||input.checked){formData.append(inputName,input.value);}}}}},{key:"_updateFilesUploadProgress",value:function _updateFilesUploadProgress(files,xhr,e){var progress=void 0;if(typeof e!=='undefined'){progress=100*e.loaded/e.total;if(files[0].upload.chunked){var file=files[0];var chunk=this._getChunk(file,xhr);
|
||||
chunk.progress=progress;chunk.total=e.total;chunk.bytesSent=e.loaded;var fileProgress=0,fileTotal=void 0,fileBytesSent=void 0;file.upload.progress=0;file.upload.total=0;file.upload.bytesSent=0;for(var i=0;i<file.upload.totalChunkCount;i++){if(file.upload.chunks[i]!==undefined&&file.upload.chunks[i].progress!==undefined){file.upload.progress+=file.upload.chunks[i].progress;file.upload.total+=file.upload.chunks[i].total;file.upload.bytesSent+=file.upload.chunks[i].bytesSent;}}file.upload.progress=file.upload.progress/file.upload.totalChunkCount;}else{for(var _iterator26=files,_isArray26=true,_i28=0,_iterator26=_isArray26?_iterator26:_iterator26[Symbol.iterator]();;){var _ref25;if(_isArray26){if(_i28>=_iterator26.length)break;_ref25=_iterator26[_i28++];}else{_i28=_iterator26.next();if(_i28.done)break;_ref25=_i28.value;}var _file2=_ref25;_file2.upload.progress=progress;_file2.upload.total=e.total;_file2.upload.bytesSent=e.loaded;}}for(var _iterator27=files,_isArray27=true,_i29=0,_iterator27=_isArray27?_iterator27:_iterator27[Symbol.iterator]();;){
|
||||
var _ref26;if(_isArray27){if(_i29>=_iterator27.length)break;_ref26=_iterator27[_i29++];}else{_i29=_iterator27.next();if(_i29.done)break;_ref26=_i29.value;}var _file3=_ref26;this.emit("uploadprogress",_file3,_file3.upload.progress,_file3.upload.bytesSent);}}else{var allFilesFinished=true;progress=100;for(var _iterator28=files,_isArray28=true,_i30=0,_iterator28=_isArray28?_iterator28:_iterator28[Symbol.iterator]();;){var _ref27;if(_isArray28){if(_i30>=_iterator28.length)break;_ref27=_iterator28[_i30++];}else{_i30=_iterator28.next();if(_i30.done)break;_ref27=_i30.value;}var _file4=_ref27;if(_file4.upload.progress!==100||_file4.upload.bytesSent!==_file4.upload.total){allFilesFinished=false;}_file4.upload.progress=progress;_file4.upload.bytesSent=_file4.upload.total;}if(allFilesFinished){return;}for(var _iterator29=files,_isArray29=true,_i31=0,_iterator29=_isArray29?_iterator29:_iterator29[Symbol.iterator]();;){var _ref28;if(_isArray29){if(_i31>=_iterator29.length)break;_ref28=_iterator29[_i31++];
|
||||
}else{_i31=_iterator29.next();if(_i31.done)break;_ref28=_i31.value;}var _file5=_ref28;this.emit("uploadprogress",_file5,progress,_file5.upload.bytesSent);}}}},{key:"_finishedUploading",value:function _finishedUploading(files,xhr,e){var response=void 0;if(files[0].status===Dropzone.CANCELED){return;}if(xhr.readyState!==4){return;}if(xhr.responseType!=='arraybuffer'&&xhr.responseType!=='blob'){response=xhr.responseText;if(xhr.getResponseHeader("content-type")&&~xhr.getResponseHeader("content-type").indexOf("application/json")){try{response=JSON.parse(response);}catch(error){e=error;response="Invalid JSON response from server.";}}}this._updateFilesUploadProgress(files);if(!(200<=xhr.status&&xhr.status<300)){this._handleUploadError(files,xhr,response);}else{if(files[0].upload.chunked){files[0].upload.finishedChunkUpload(this._getChunk(files[0],xhr));}else{this._finished(files,response,e);}}}},{key:"_handleUploadError",value:function _handleUploadError(files,xhr,response){if(files[0].status===Dropzone.CANCELED){
|
||||
return;}if(files[0].upload.chunked&&this.options.retryChunks){var chunk=this._getChunk(files[0],xhr);if(chunk.retries++<this.options.retryChunksLimit){this._uploadData(files,[chunk.dataBlock]);return;}else{console.warn('Retried this chunk too often. Giving up.');}}for(var _iterator30=files,_isArray30=true,_i32=0,_iterator30=_isArray30?_iterator30:_iterator30[Symbol.iterator]();;){var _ref29;if(_isArray30){if(_i32>=_iterator30.length)break;_ref29=_iterator30[_i32++];}else{_i32=_iterator30.next();if(_i32.done)break;_ref29=_i32.value;}var file=_ref29;this._errorProcessing(files,response||this.options.dictResponseError.replace("{{statusCode}}",xhr.status),xhr);}}},{key:"submitRequest",value:function submitRequest(xhr,formData,files){xhr.send(formData);}},{key:"_finished",value:function _finished(files,responseText,e){for(var _iterator31=files,_isArray31=true,_i33=0,_iterator31=_isArray31?_iterator31:_iterator31[Symbol.iterator]();;){var _ref30;if(_isArray31){if(_i33>=_iterator31.length)break;
|
||||
_ref30=_iterator31[_i33++];}else{_i33=_iterator31.next();if(_i33.done)break;_ref30=_i33.value;}var file=_ref30;file.status=Dropzone.SUCCESS;this.emit("success",file,responseText,e);this.emit("complete",file);}if(this.options.uploadMultiple){this.emit("successmultiple",files,responseText,e);this.emit("completemultiple",files);}if(this.options.autoProcessQueue){return this.processQueue();}}},{key:"_errorProcessing",value:function _errorProcessing(files,message,xhr){for(var _iterator32=files,_isArray32=true,_i34=0,_iterator32=_isArray32?_iterator32:_iterator32[Symbol.iterator]();;){var _ref31;if(_isArray32){if(_i34>=_iterator32.length)break;_ref31=_iterator32[_i34++];}else{_i34=_iterator32.next();if(_i34.done)break;_ref31=_i34.value;}var file=_ref31;file.status=Dropzone.ERROR;this.emit("error",file,message,xhr);this.emit("complete",file);}if(this.options.uploadMultiple){this.emit("errormultiple",files,message,xhr);this.emit("completemultiple",files);}if(this.options.autoProcessQueue){
|
||||
return this.processQueue();}}}],[{key:"uuidv4",value:function uuidv4(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c==='x'?r:r&0x3|0x8;return v.toString(16);});}}]);return Dropzone;}(Emitter);Dropzone.initClass();Dropzone.version="5.5.1";Dropzone.options={};Dropzone.optionsForElement=function(element){if(element.getAttribute("id")){return Dropzone.options[camelize(element.getAttribute("id"))];}else{return undefined;}};Dropzone.instances=[];Dropzone.forElement=function(element){if(typeof element==="string"){element=document.querySelector(element);}if((element!=null?element.dropzone:undefined)==null){throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");}return element.dropzone;};Dropzone.autoDiscover=true;Dropzone.discover=function(){var dropzones=void 0;if(document.querySelectorAll){
|
||||
dropzones=document.querySelectorAll(".dropzone");}else{dropzones=[];var checkElements=function checkElements(elements){return function(){var result=[];for(var _iterator33=elements,_isArray33=true,_i35=0,_iterator33=_isArray33?_iterator33:_iterator33[Symbol.iterator]();;){var _ref32;if(_isArray33){if(_i35>=_iterator33.length)break;_ref32=_iterator33[_i35++];}else{_i35=_iterator33.next();if(_i35.done)break;_ref32=_i35.value;}var el=_ref32;if(/(^| )dropzone($| )/.test(el.className)){result.push(dropzones.push(el));}else{result.push(undefined);}}return result;}();};checkElements(document.getElementsByTagName("div"));checkElements(document.getElementsByTagName("form"));}return function(){var result=[];for(var _iterator34=dropzones,_isArray34=true,_i36=0,_iterator34=_isArray34?_iterator34:_iterator34[Symbol.iterator]();;){var _ref33;if(_isArray34){if(_i36>=_iterator34.length)break;_ref33=_iterator34[_i36++];}else{_i36=_iterator34.next();if(_i36.done)break;_ref33=_i36.value;}var dropzone=_ref33;
|
||||
if(Dropzone.optionsForElement(dropzone)!==false){result.push(new Dropzone(dropzone));}else{result.push(undefined);}}return result;}();};Dropzone.blacklistedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i];Dropzone.isBrowserSupported=function(){var capableBrowser=true;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector){if(!("classList"in document.createElement("a"))){capableBrowser=false;}else{for(var _iterator35=Dropzone.blacklistedBrowsers,_isArray35=true,_i37=0,_iterator35=_isArray35?_iterator35:_iterator35[Symbol.iterator]();;){var _ref34;if(_isArray35){if(_i37>=_iterator35.length)break;_ref34=_iterator35[_i37++];}else{_i37=_iterator35.next();if(_i37.done)break;_ref34=_i37.value;}var regex=_ref34;if(regex.test(navigator.userAgent)){capableBrowser=false;continue;}}}}else{capableBrowser=false;}return capableBrowser;};Dropzone.dataURItoBlob=function(dataURI){var byteString=atob(dataURI.split(',')[1]);var mimeString=dataURI.split(',')[0].split(':')[1].split(';')[0];
|
||||
var ab=new ArrayBuffer(byteString.length);var ia=new Uint8Array(ab);for(var i=0,end=byteString.length,asc=0<=end;asc?i<=end:i>=end;asc?i++:i--){ia[i]=byteString.charCodeAt(i);}return new Blob([ab],{type:mimeString});};var without=function without(list,rejectedItem){return list.filter(function(item){return item!==rejectedItem;}).map(function(item){return item;});};var camelize=function camelize(str){return str.replace(/[\-_](\w)/g,function(match){return match.charAt(1).toUpperCase();});};Dropzone.createElement=function(string){var div=document.createElement("div");div.innerHTML=string;return div.childNodes[0];};Dropzone.elementInside=function(element,container){if(element===container){return true;}while(element=element.parentNode){if(element===container){return true;}}return false;};Dropzone.getElement=function(el,name){var element=void 0;if(typeof el==="string"){element=document.querySelector(el);}else if(el.nodeType!=null){element=el;}if(element==null){throw new Error("Invalid `"+name+"` option provided. Please provide a CSS selector or a plain HTML element.");
|
||||
}return element;};Dropzone.getElements=function(els,name){var el=void 0,elements=void 0;if(els instanceof Array){elements=[];try{for(var _iterator36=els,_isArray36=true,_i38=0,_iterator36=_isArray36?_iterator36:_iterator36[Symbol.iterator]();;){if(_isArray36){if(_i38>=_iterator36.length)break;el=_iterator36[_i38++];}else{_i38=_iterator36.next();if(_i38.done)break;el=_i38.value;}elements.push(this.getElement(el,name));}}catch(e){elements=null;}}else if(typeof els==="string"){elements=[];for(var _iterator37=document.querySelectorAll(els),_isArray37=true,_i39=0,_iterator37=_isArray37?_iterator37:_iterator37[Symbol.iterator]();;){if(_isArray37){if(_i39>=_iterator37.length)break;el=_iterator37[_i39++];}else{_i39=_iterator37.next();if(_i39.done)break;el=_i39.value;}elements.push(el);}}else if(els.nodeType!=null){elements=[els];}if(elements==null||!elements.length){throw new Error("Invalid `"+name+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");}
|
||||
return elements;};Dropzone.confirm=function(question,accepted,rejected){if(window.confirm(question)){return accepted();}else if(rejected!=null){return rejected();}};Dropzone.isValidFile=function(file,acceptedFiles){if(!acceptedFiles){return true;}acceptedFiles=acceptedFiles.split(",");var mimeType=file.type;var baseMimeType=mimeType.replace(/\/.*$/,"");for(var _iterator38=acceptedFiles,_isArray38=true,_i40=0,_iterator38=_isArray38?_iterator38:_iterator38[Symbol.iterator]();;){var _ref35;if(_isArray38){if(_i40>=_iterator38.length)break;_ref35=_iterator38[_i40++];}else{_i40=_iterator38.next();if(_i40.done)break;_ref35=_i40.value;}var validType=_ref35;validType=validType.trim();if(validType.charAt(0)==="."){if(file.name.toLowerCase().indexOf(validType.toLowerCase(),file.name.length-validType.length)!==-1){return true;}}else if(/\/\*$/.test(validType)){if(baseMimeType===validType.replace(/\/.*$/,"")){return true;}}else{if(mimeType===validType){return true;}}}return false;};if(typeof jQuery!=='undefined'&&jQuery!==null){
|
||||
jQuery.fn.dropzone=function(options){return this.each(function(){return new Dropzone(this,options);});};}if(typeof module!=='undefined'&&module!==null){module.exports=Dropzone;}else{window.Dropzone=Dropzone;}Dropzone.ADDED="added";Dropzone.QUEUED="queued";Dropzone.ACCEPTED=Dropzone.QUEUED;Dropzone.UPLOADING="uploading";Dropzone.PROCESSING=Dropzone.UPLOADING;Dropzone.CANCELED="canceled";Dropzone.ERROR="error";Dropzone.SUCCESS="success";var detectVerticalSquash=function detectVerticalSquash(img){var iw=img.naturalWidth;var ih=img.naturalHeight;var canvas=document.createElement("canvas");canvas.width=1;canvas.height=ih;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);var _ctx$getImageData=ctx.getImageData(1,0,1,ih),data=_ctx$getImageData.data;var sy=0;var ey=ih;var py=ih;while(py>sy){var alpha=data[(py-1)*4+3];if(alpha===0){ey=py;}else{sy=py;}py=ey+sy>>1;}var ratio=py/ih;if(ratio===0){return 1;}else{return ratio;}};var drawImageIOSFix=function drawImageIOSFix(ctx,img,sx,sy,sw,sh,dx,dy,dw,dh){
|
||||
var vertSquashRatio=detectVerticalSquash(img);return ctx.drawImage(img,sx,sy,sw,sh,dx,dy,dw,dh/vertSquashRatio);};var ExifRestore=function(){function ExifRestore(){_classCallCheck(this,ExifRestore);}_createClass(ExifRestore,null,[{key:"initClass",value:function initClass(){this.KEY_STR='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';}},{key:"encode64",value:function encode64(input){var output='';var chr1=undefined;var chr2=undefined;var chr3='';var enc1=undefined;var enc2=undefined;var enc3=undefined;var enc4='';var i=0;while(true){chr1=input[i++];chr2=input[i++];chr3=input[i++];enc1=chr1>>2;enc2=(chr1&3)<<4|chr2>>4;enc3=(chr2&15)<<2|chr3>>6;enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}output=output+this.KEY_STR.charAt(enc1)+this.KEY_STR.charAt(enc2)+this.KEY_STR.charAt(enc3)+this.KEY_STR.charAt(enc4);chr1=chr2=chr3='';enc1=enc2=enc3=enc4='';if(!(i<input.length)){break;}}return output;}},{key:"restore",value:function restore(origFileBase64,resizedFileBase64){
|
||||
if(!origFileBase64.match('data:image/jpeg;base64,')){return resizedFileBase64;}var rawImage=this.decode64(origFileBase64.replace('data:image/jpeg;base64,',''));var segments=this.slice2Segments(rawImage);var image=this.exifManipulation(resizedFileBase64,segments);return"data:image/jpeg;base64,"+this.encode64(image);}},{key:"exifManipulation",value:function exifManipulation(resizedFileBase64,segments){var exifArray=this.getExifArray(segments);var newImageArray=this.insertExif(resizedFileBase64,exifArray);var aBuffer=new Uint8Array(newImageArray);return aBuffer;}},{key:"getExifArray",value:function getExifArray(segments){var seg=undefined;var x=0;while(x<segments.length){seg=segments[x];if(seg[0]===255&seg[1]===225){return seg;}x++;}return[];}},{key:"insertExif",value:function insertExif(resizedFileBase64,exifArray){var imageData=resizedFileBase64.replace('data:image/jpeg;base64,','');var buf=this.decode64(imageData);var separatePoint=buf.indexOf(255,3);var mae=buf.slice(0,separatePoint);
|
||||
var ato=buf.slice(separatePoint);var array=mae;array=array.concat(exifArray);array=array.concat(ato);return array;}},{key:"slice2Segments",value:function slice2Segments(rawImageArray){var head=0;var segments=[];while(true){var length;if(rawImageArray[head]===255&rawImageArray[head+1]===218){break;}if(rawImageArray[head]===255&rawImageArray[head+1]===216){head+=2;}else{length=rawImageArray[head+2]*256+rawImageArray[head+3];var endPoint=head+length+2;var seg=rawImageArray.slice(head,endPoint);segments.push(seg);head=endPoint;}if(head>rawImageArray.length){break;}}return segments;}},{key:"decode64",value:function decode64(input){var output='';var chr1=undefined;var chr2=undefined;var chr3='';var enc1=undefined;var enc2=undefined;var enc3=undefined;var enc4='';var i=0;var buf=[];var base64test=/[^A-Za-z0-9\+\/\=]/g;if(base64test.exec(input)){console.warn('There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, \'+\', \'/\',and \'=\'\nExpect errors in decoding.');
|
||||
}input=input.replace(/[^A-Za-z0-9\+\/\=]/g,'');while(true){enc1=this.KEY_STR.indexOf(input.charAt(i++));enc2=this.KEY_STR.indexOf(input.charAt(i++));enc3=this.KEY_STR.indexOf(input.charAt(i++));enc4=this.KEY_STR.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;buf.push(chr1);if(enc3!==64){buf.push(chr2);}if(enc4!==64){buf.push(chr3);}chr1=chr2=chr3='';enc1=enc2=enc3=enc4='';if(!(i<input.length)){break;}}return buf;}}]);return ExifRestore;}();ExifRestore.initClass();var contentLoaded=function contentLoaded(win,fn){var done=false;var top=true;var doc=win.document;var root=doc.documentElement;var add=doc.addEventListener?"addEventListener":"attachEvent";var rem=doc.addEventListener?"removeEventListener":"detachEvent";var pre=doc.addEventListener?"":"on";var init=function init(e){if(e.type==="readystatechange"&&doc.readyState!=="complete"){return;}(e.type==="load"?win:doc)[rem](pre+e.type,init,false);if(!done&&(done=true)){return fn.call(win,e.type||e);
|
||||
}};var poll=function poll(){try{root.doScroll("left");}catch(e){setTimeout(poll,50);return;}return init("poll");};if(doc.readyState!=="complete"){if(doc.createEventObject&&root.doScroll){try{top=!win.frameElement;}catch(error){}if(top){poll();}}doc[add](pre+"DOMContentLoaded",init,false);doc[add](pre+"readystatechange",init,false);return win[add](pre+"load",init,false);}};Dropzone._autoDiscoverFunction=function(){if(Dropzone.autoDiscover){return Dropzone.discover();}};contentLoaded(window,Dropzone._autoDiscoverFunction);function __guard__(value,transform){return typeof value!=='undefined'&&value!==null?transform(value):undefined;}function __guardMethod__(obj,methodName,transform){if(typeof obj!=='undefined'&&obj!==null&&typeof obj[methodName]==='function'){return transform(obj,methodName);}else{return undefined;}}(function(window,document){var modalClass='.sweet-alert',overlayClass='.sweet-overlay',alertTypes=['error','warning','info','success'],defaultParams={title:'',text:'',type:null,
|
||||
allowOutsideClick:false,showCancelButton:false,showConfirmButton:true,closeOnConfirm:true,closeOnCancel:true,confirmButtonText:'OK',confirmButtonClass:'btn-primary',cancelButtonText:'Cancel',cancelButtonClass:'btn-default',containerClass:'',titleClass:'',textClass:'',imageUrl:null,imageSize:null,timer:null};var getModal=function(){return document.querySelector(modalClass);},getOverlay=function(){return document.querySelector(overlayClass);},hasClass=function(elem,className){return new RegExp(' '+className+' ').test(' '+elem.className+' ');},addClass=function(elem,className){if(className&&!hasClass(elem,className)){elem.className+=' '+className;}},removeClass=function(elem,className){var newClass=' '+elem.className.replace(/[\t\r\n]/g,' ')+' ';if(hasClass(elem,className)){while(newClass.indexOf(' '+className+' ')>=0){newClass=newClass.replace(' '+className+' ',' ');}elem.className=newClass.replace(/^\s+|\s+$/g,'');}},escapeHtml=function(str){var div=document.createElement('div');div.appendChild(document.createTextNode(str));
|
||||
return div.innerHTML;},_show=function(elem){elem.style.opacity='';elem.style.display='block';},show=function(elems){if(elems&&!elems.length){return _show(elems);}for(var i=0;i<elems.length;++i){_show(elems[i]);}},_hide=function(elem){elem.style.opacity='';elem.style.display='none';},hide=function(elems){if(elems&&!elems.length){return _hide(elems);}for(var i=0;i<elems.length;++i){_hide(elems[i]);}},isDescendant=function(parent,child){var node=child.parentNode;while(node!==null){if(node===parent){return true;}node=node.parentNode;}return false;},getTopMargin=function(elem){elem.style.left='-9999px';elem.style.display='block';var height=elem.clientHeight;var padding=parseInt(getComputedStyle(elem).getPropertyValue('padding'),10);elem.style.left='';elem.style.display='none';return('-'+parseInt(height/2+padding)+'px');},fadeIn=function(elem,interval){if(+elem.style.opacity<1){interval=interval||16;elem.style.opacity=0;elem.style.display='block';var last=+new Date();var tick=function(){elem.style.opacity=+elem.style.opacity+(new Date()-last)/100;
|
||||
last=+new Date();if(+elem.style.opacity<1){setTimeout(tick,interval);}};tick();}},fadeOut=function(elem,interval){interval=interval||16;elem.style.opacity=1;var last=+new Date();var tick=function(){elem.style.opacity=+elem.style.opacity-(new Date()-last)/100;last=+new Date();if(+elem.style.opacity>0){setTimeout(tick,interval);}else{elem.style.display='none';}};tick();},fireClick=function(node){if(MouseEvent){var mevt=new MouseEvent('click',{view:window,bubbles:false,cancelable:true});node.dispatchEvent(mevt);}else if(document.createEvent){var evt=document.createEvent('MouseEvents');evt.initEvent('click',false,false);node.dispatchEvent(evt);}else if(document.createEventObject){node.fireEvent('onclick');}else if(typeof node.onclick==='function'){node.onclick();}},stopEventPropagation=function(e){if(typeof e.stopPropagation==='function'){e.stopPropagation();e.preventDefault();}else if(window.event&&window.event.hasOwnProperty('cancelBubble')){window.event.cancelBubble=true;}};var previousActiveElement,
|
||||
previousDocumentClick,previousWindowKeyDown,lastFocusedButton;window.sweetAlertInitialize=function(){var sweetHTML='<div class="sweet-overlay"></div><div class="sweet-alert"><div class="icon error"><span class="x-mark"><span class="line left"></span><span class="line right"></span></span></div><div class="icon warning"> <span class="body"></span> <span class="dot"></span> </div> <div class="icon info"></div> <div class="icon success"> <span class="line tip"></span> <span class="line long"></span> <div class="placeholder"></div> <div class="fix"></div> </div> <div class="icon custom"></div> <h2>Title</h2><p class="lead text-muted">Text</p><p><button class="cancel btn" tabIndex="2">Cancel</button> <button class="confirm btn" tabIndex="1">OK</button></p></div>',sweetWrap=document.createElement('div');sweetWrap.innerHTML=sweetHTML;document.body.appendChild(sweetWrap);}
|
||||
window.sweetAlert=window.swal=function(){if(arguments[0]===undefined){window.console.error('sweetAlert expects at least 1 attribute!');return false;}var params=extend({},defaultParams);switch(typeof arguments[0]){case'string':params.title=arguments[0];params.text=arguments[1]||'';params.type=arguments[2]||'';break;case'object':if(arguments[0].title===undefined){window.console.error('Missing "title" argument!');return false;}params.title=arguments[0].title;params.text=arguments[0].text||defaultParams.text;params.type=arguments[0].type||defaultParams.type;params.allowOutsideClick=arguments[0].allowOutsideClick||defaultParams.allowOutsideClick;params.showCancelButton=arguments[0].showCancelButton!==undefined?arguments[0].showCancelButton:defaultParams.showCancelButton;params.showConfirmButton=arguments[0].showConfirmButton!==undefined?arguments[0].showConfirmButton:defaultParams.showConfirmButton;params.closeOnConfirm=arguments[0].closeOnConfirm!==undefined?arguments[0].closeOnConfirm:defaultParams.closeOnConfirm;
|
||||
params.closeOnCancel=arguments[0].closeOnCancel!==undefined?arguments[0].closeOnCancel:defaultParams.closeOnCancel;params.timer=arguments[0].timer||defaultParams.timer;params.confirmButtonText=(defaultParams.showCancelButton)?'Confirm':defaultParams.confirmButtonText;params.confirmButtonText=arguments[0].confirmButtonText||defaultParams.confirmButtonText;params.confirmButtonClass=arguments[0].confirmButtonClass||(arguments[0].type?'btn-'+arguments[0].type:null)||defaultParams.confirmButtonClass;params.cancelButtonText=arguments[0].cancelButtonText||defaultParams.cancelButtonText;params.cancelButtonClass=arguments[0].cancelButtonClass||defaultParams.cancelButtonClass;params.containerClass=arguments[0].containerClass||defaultParams.containerClass;params.titleClass=arguments[0].titleClass||defaultParams.titleClass;params.textClass=arguments[0].textClass||defaultParams.textClass;params.imageUrl=arguments[0].imageUrl||defaultParams.imageUrl;params.imageSize=arguments[0].imageSize||defaultParams.imageSize;
|
||||
params.doneFunction=arguments[1]||null;break;default:window.console.error('Unexpected type of argument! Expected "string" or "object", got '+typeof arguments[0]);return false;}setParameters(params);fixVerticalPosition();openModal();var modal=getModal();var onButtonEvent=function(e){var target=e.target||e.srcElement,targetedConfirm=(target.className.indexOf('confirm')>-1),modalIsVisible=hasClass(modal,'visible'),doneFunctionExists=(params.doneFunction&&modal.getAttribute('data-has-done-function')==='true');switch(e.type){case("click"):if(targetedConfirm&&doneFunctionExists&&modalIsVisible){params.doneFunction(true);if(params.closeOnConfirm){closeModal();}}else if(doneFunctionExists&&modalIsVisible){var functionAsStr=String(params.doneFunction).replace(/\s/g,'');var functionHandlesCancel=functionAsStr.substring(0,9)==="function("&&functionAsStr.substring(9,10)!==")";if(functionHandlesCancel){params.doneFunction(false);}if(params.closeOnCancel){closeModal();}}else{closeModal();}break;}};
|
||||
var $buttons=modal.querySelectorAll('button');for(var i=0;i<$buttons.length;i++){$buttons[i].onclick=onButtonEvent;}previousDocumentClick=document.onclick;document.onclick=function(e){var target=e.target||e.srcElement;var clickedOnModal=(modal===target),clickedOnModalChild=isDescendant(modal,e.target),modalIsVisible=hasClass(modal,'visible'),outsideClickIsAllowed=modal.getAttribute('data-allow-ouside-click')==='true';if(!clickedOnModal&&!clickedOnModalChild&&modalIsVisible&&outsideClickIsAllowed){closeModal();}};var $okButton=modal.querySelector('button.confirm'),$cancelButton=modal.querySelector('button.cancel'),$modalButtons=modal.querySelectorAll('button:not([type=hidden])');function handleKeyDown(e){var keyCode=e.keyCode||e.which;if([9,13,32,27].indexOf(keyCode)===-1){return;}var $targetElement=e.target||e.srcElement;var btnIndex=-1;for(var i=0;i<$modalButtons.length;i++){if($targetElement===$modalButtons[i]){btnIndex=i;break;}}if(keyCode===9){if(btnIndex===-1){$targetElement=$okButton;
|
||||
}else{if(btnIndex===$modalButtons.length-1){$targetElement=$modalButtons[0];}else{$targetElement=$modalButtons[btnIndex+1];}}stopEventPropagation(e);$targetElement.focus();}else{if(keyCode===13||keyCode===32){if(btnIndex===-1){$targetElement=$okButton;}else{$targetElement=undefined;}}else if(keyCode===27&&!($cancelButton.hidden||$cancelButton.style.display==='none')){$targetElement=$cancelButton;}else{$targetElement=undefined;}if($targetElement!==undefined){fireClick($targetElement,e);}}}previousWindowKeyDown=window.onkeydown;window.onkeydown=handleKeyDown;function handleOnBlur(e){var $targetElement=e.target||e.srcElement,$focusElement=e.relatedTarget,modalIsVisible=hasClass(modal,'visible'),bootstrapModalIsVisible=document.querySelector('.control-popup.modal')||false;if(bootstrapModalIsVisible){return;}if(modalIsVisible){var btnIndex=-1;if($focusElement!==null){for(var i=0;i<$modalButtons.length;i++){if($focusElement===$modalButtons[i]){btnIndex=i;break;}}if(btnIndex===-1){
|
||||
$targetElement.focus();}}else{lastFocusedButton=$targetElement;}}}$okButton.onblur=handleOnBlur;$cancelButton.onblur=handleOnBlur;window.onfocus=function(){window.setTimeout(function(){if(lastFocusedButton!==undefined){lastFocusedButton.focus();lastFocusedButton=undefined;}},0);};};window.swal.setDefaults=function(userParams){if(!userParams){throw new Error('userParams is required');}if(typeof userParams!=='object'){throw new Error('userParams has to be a object');}extend(defaultParams,userParams);};window.swal.close=function(){closeModal();}
|
||||
function setParameters(params){var modal=getModal();var $title=modal.querySelector('h2'),$text=modal.querySelector('p'),$cancelBtn=modal.querySelector('button.cancel'),$confirmBtn=modal.querySelector('button.confirm');$title.innerHTML=escapeHtml(params.title).split("\n").join("<br>");$text.innerHTML=escapeHtml(params.text||'').split("\n").join("<br>");if(params.text){show($text);}hide(modal.querySelectorAll('.icon'));if(params.type){var validType=false;for(var i=0;i<alertTypes.length;i++){if(params.type===alertTypes[i]){validType=true;break;}}if(!validType){window.console.error('Unknown alert type: '+params.type);return false;}var $icon=modal.querySelector('.icon.'+params.type);show($icon);switch(params.type){case"success":addClass($icon,'animate');addClass($icon.querySelector('.tip'),'animateSuccessTip');addClass($icon.querySelector('.long'),'animateSuccessLong');break;case"error":addClass($icon,'animateErrorIcon');addClass($icon.querySelector('.x-mark'),'animateXMark');break;case"warning":
|
||||
addClass($icon,'pulseWarning');addClass($icon.querySelector('.body'),'pulseWarningIns');addClass($icon.querySelector('.dot'),'pulseWarningIns');break;}}if(params.imageUrl){var $customIcon=modal.querySelector('.icon.custom');$customIcon.style.backgroundImage='url('+params.imageUrl+')';show($customIcon);var _imgWidth=80,_imgHeight=80;if(params.imageSize){var imgWidth=params.imageSize.split('x')[0];var imgHeight=params.imageSize.split('x')[1];if(!imgWidth||!imgHeight){window.console.error("Parameter imageSize expects value with format WIDTHxHEIGHT, got "+params.imageSize);}else{_imgWidth=imgWidth;_imgHeight=imgHeight;$customIcon.css({'width':imgWidth+'px','height':imgHeight+'px'});}}$customIcon.setAttribute('style',$customIcon.getAttribute('style')+'width:'+_imgWidth+'px; height:'+_imgHeight+'px');}modal.setAttribute('data-has-cancel-button',params.showCancelButton);if(params.showCancelButton){$cancelBtn.style.display='inline-block';}else{hide($cancelBtn);}modal.setAttribute('data-has-confirm-button',params.showConfirmButton);
|
||||
if(params.showConfirmButton){$confirmBtn.style.display='inline-block';}else{hide($confirmBtn);}if(params.cancelButtonText){$cancelBtn.innerHTML=escapeHtml(params.cancelButtonText);}if(params.confirmButtonText){$confirmBtn.innerHTML=escapeHtml(params.confirmButtonText);}$confirmBtn.className='confirm btn'
|
||||
addClass(modal,params.containerClass);addClass($confirmBtn,params.confirmButtonClass);addClass($cancelBtn,params.cancelButtonClass);addClass($title,params.titleClass);addClass($text,params.textClass);modal.setAttribute('data-allow-ouside-click',params.allowOutsideClick);var hasDoneFunction=(params.doneFunction)?true:false;modal.setAttribute('data-has-done-function',hasDoneFunction);modal.setAttribute('data-timer',params.timer);}function colorLuminance(hex,lum){hex=String(hex).replace(/[^0-9a-f]/gi,'');if(hex.length<6){hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];}lum=lum||0;var rgb="#",c,i;for(i=0;i<3;i++){c=parseInt(hex.substr(i*2,2),16);c=Math.round(Math.min(Math.max(0,c+(c*lum)),255)).toString(16);rgb+=("00"+c).substr(c.length);}return rgb;}function extend(a,b){for(var key in b){if(b.hasOwnProperty(key)){a[key]=b[key];}}return a;}function hexToRgb(hex){var result=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);return result?parseInt(result[1],16)+', '+parseInt(result[2],16)+', '+parseInt(result[3],16):null;
|
||||
}function setFocusStyle($button,bgColor){var rgbColor=hexToRgb(bgColor);$button.style.boxShadow='0 0 2px rgba('+rgbColor+', 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)';}function openModal(){var modal=getModal();fadeIn(getOverlay(),10);show(modal);addClass(modal,'showSweetAlert');removeClass(modal,'hideSweetAlert');previousActiveElement=document.activeElement;var $okButton=modal.querySelector('button.confirm');$okButton.focus();setTimeout(function(){addClass(modal,'visible');},500);var timer=modal.getAttribute('data-timer');if(timer!=="null"&&timer!==""){setTimeout(function(){closeModal();},timer);}}function closeModal(){var modal=getModal();fadeOut(getOverlay(),5);fadeOut(modal,5);removeClass(modal,'showSweetAlert');addClass(modal,'hideSweetAlert');removeClass(modal,'visible');var $successIcon=modal.querySelector('.icon.success');removeClass($successIcon,'animate');removeClass($successIcon.querySelector('.tip'),'animateSuccessTip');removeClass($successIcon.querySelector('.long'),'animateSuccessLong');
|
||||
var $errorIcon=modal.querySelector('.icon.error');removeClass($errorIcon,'animateErrorIcon');removeClass($errorIcon.querySelector('.x-mark'),'animateXMark');var $warningIcon=modal.querySelector('.icon.warning');removeClass($warningIcon,'pulseWarning');removeClass($warningIcon.querySelector('.body'),'pulseWarningIns');removeClass($warningIcon.querySelector('.dot'),'pulseWarningIns');window.onkeydown=previousWindowKeyDown;document.onclick=previousDocumentClick;if(previousActiveElement){previousActiveElement.focus();}lastFocusedButton=undefined;}function fixVerticalPosition(){var modal=getModal();modal.style.marginTop=getTopMargin(getModal());}(function(){if(document.readyState==="complete"||document.readyState==="interactive"&&document.body){sweetAlertInitialize();}else{if(document.addEventListener){document.addEventListener('DOMContentLoaded',function handler(){document.removeEventListener('DOMContentLoaded',handler,false);sweetAlertInitialize();},false);}else if(document.attachEvent){
|
||||
document.attachEvent('onreadystatechange',function handler(){if(document.readyState==='complete'){document.detachEvent('onreadystatechange',handler);sweetAlertInitialize();}});}}})();})(window,document);(function($){$.Jcrop=function(obj,opt){var options=$.extend({},$.Jcrop.defaults),docOffset,_ua=navigator.userAgent.toLowerCase(),is_msie=/msie/.test(_ua),ie6mode=/msie [1-6]\./.test(_ua);function px(n){return Math.round(n)+'px';}function cssClass(cl){return options.baseClass+'-'+cl;}function supportsColorFade(){return $.fx.step.hasOwnProperty('backgroundColor');}function getPos(obj){var pos=$(obj).offset();return[pos.left,pos.top];}function mouseAbs(e){return[(e.pageX-docOffset[0]),(e.pageY-docOffset[1])];}function setOptions(opt){if(typeof(opt)!=='object')opt={};options=$.extend(options,opt);$.each(['onChange','onSelect','onRelease','onDblClick'],function(i,e){if(typeof(options[e])!=='function')options[e]=function(){};});}function startDragMode(mode,pos,touch){docOffset=getPos($img);
|
||||
Tracker.setCursor(mode==='move'?mode:mode+'-resize');if(mode==='move'){return Tracker.activateHandlers(createMover(pos),doneSelect,touch);}var fc=Coords.getFixed();var opp=oppLockCorner(mode);var opc=Coords.getCorner(oppLockCorner(opp));Coords.setPressed(Coords.getCorner(opp));Coords.setCurrent(opc);Tracker.activateHandlers(dragmodeHandler(mode,fc),doneSelect,touch);}function dragmodeHandler(mode,f){return function(pos){if(!options.aspectRatio){switch(mode){case'e':pos[1]=f.y2;break;case'w':pos[1]=f.y2;break;case'n':pos[0]=f.x2;break;case's':pos[0]=f.x2;break;}}else{switch(mode){case'e':pos[1]=f.y+1;break;case'w':pos[1]=f.y+1;break;case'n':pos[0]=f.x+1;break;case's':pos[0]=f.x+1;break;}}Coords.setCurrent(pos);Selection.update();};}function createMover(pos){var lloc=pos;KeyManager.watchKeys();return function(pos){Coords.moveOffset([pos[0]-lloc[0],pos[1]-lloc[1]]);lloc=pos;Selection.update();};}function oppLockCorner(ord){switch(ord){case'n':return'sw';case's':return'nw';case'e':return'nw';
|
||||
case'w':return'ne';case'ne':return'sw';case'nw':return'se';case'se':return'nw';case'sw':return'ne';}}function createDragger(ord){return function(e){if(options.disabled){return false;}if((ord==='move')&&!options.allowMove){return false;}docOffset=getPos($img);btndown=true;startDragMode(ord,mouseAbs(e));e.stopPropagation();e.preventDefault();return false;};}function presize($obj,w,h){var nw=$obj.width(),nh=$obj.height();if((nw>w)&&w>0){nw=w;nh=(w/$obj.width())*$obj.height();}if((nh>h)&&h>0){nh=h;nw=(h/$obj.height())*$obj.width();}xscale=$obj.width()/nw;yscale=$obj.height()/nh;$obj.width(nw).height(nh);}function unscale(c){return{x:c.x*xscale,y:c.y*yscale,x2:c.x2*xscale,y2:c.y2*yscale,w:c.w*xscale,h:c.h*yscale};}function doneSelect(pos){var c=Coords.getFixed();if((c.w>options.minSelect[0])&&(c.h>options.minSelect[1])){Selection.enableHandles();Selection.done();}else{Selection.release();}Tracker.setCursor(options.allowSelect?'crosshair':'default');}function newSelection(e){if(options.disabled){
|
||||
return false;}if(!options.allowSelect){return false;}btndown=true;docOffset=getPos($img);Selection.disableHandles();Tracker.setCursor('crosshair');var pos=mouseAbs(e);Coords.setPressed(pos);Selection.update();Tracker.activateHandlers(selectDrag,doneSelect,e.type.substring(0,5)==='touch');KeyManager.watchKeys();e.stopPropagation();e.preventDefault();return false;}function selectDrag(pos){Coords.setCurrent(pos);Selection.update();}function newTracker(){var trk=$('<div></div>').addClass(cssClass('tracker'));if(is_msie){trk.css({opacity:0,backgroundColor:'white'});}return trk;}if(typeof(obj)!=='object'){obj=$(obj)[0];}if(typeof(opt)!=='object'){opt={};}setOptions(opt);var img_css={border:'none',visibility:'visible',margin:0,padding:0,position:'absolute',top:0,left:0};var $origimg=$(obj),img_mode=true;if(obj.tagName=='IMG'){if($origimg[0].width!=0&&$origimg[0].height!=0){$origimg.width($origimg[0].width);$origimg.height($origimg[0].height);}else{var tempImage=new Image();tempImage.src=$origimg[0].src;
|
||||
$origimg.width(tempImage.width);$origimg.height(tempImage.height);}var $img=$origimg.clone().removeAttr('id').css(img_css).show();$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide();}else{$img=$origimg.css(img_css).show();img_mode=false;if(options.shade===null){options.shade=true;}}presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({position:'relative',backgroundColor:options.bgColor}).insertAfter($origimg).append($img);if(options.addClass){$div.addClass(options.addClass);}var $img2=$('<div />'),$img_holder=$('<div />').width('100%').height('100%').css({zIndex:310,position:'absolute',overflow:'hidden'}),$hdl_holder=$('<div />').width('100%').height('100%').css('zIndex',320),$sel=$('<div />').css({position:'absolute',zIndex:600}).dblclick(function(){var c=Coords.getFixed();options.onDblClick.call(api,c);}).insertBefore($img).append($img_holder,$hdl_holder);
|
||||
if(img_mode){$img2=$('<img />').attr('src',$img.attr('src')).css(img_css).width(boundx).height(boundy),$img_holder.append($img2);}if(ie6mode){$sel.css({overflowY:'hidden'});}var bound=options.boundary;var $trk=newTracker().width(boundx+(bound*2)).height(boundy+(bound*2)).css({position:'absolute',top:px(-bound),left:px(-bound),zIndex:290}).mousedown(newSelection);var bgcolor=options.bgColor,bgopacity=options.bgOpacity,xlimit,ylimit,xmin,ymin,xscale,yscale,enabled=true,btndown,animating,shift_down;docOffset=getPos($img);var Touch=(function(){function hasTouchSupport(){var support={},events=['touchstart','touchmove','touchend'],el=document.createElement('div'),i;try{for(i=0;i<events.length;i++){var eventName=events[i];eventName='on'+eventName;var isSupported=(eventName in el);if(!isSupported){el.setAttribute(eventName,'return;');isSupported=typeof el[eventName]=='function';}support[events[i]]=isSupported;}return support.touchstart&&support.touchend&&support.touchmove;}catch(err){return false;
|
||||
}}function detectSupport(){if((options.touchSupport===true)||(options.touchSupport===false))return options.touchSupport;else return hasTouchSupport();}return{createDragger:function(ord){return function(e){if(options.disabled){return false;}if((ord==='move')&&!options.allowMove){return false;}docOffset=getPos($img);btndown=true;startDragMode(ord,mouseAbs(Touch.cfilter(e)),true);e.stopPropagation();e.preventDefault();return false;};},newSelection:function(e){return newSelection(Touch.cfilter(e));},cfilter:function(e){e.pageX=e.originalEvent.changedTouches[0].pageX;e.pageY=e.originalEvent.changedTouches[0].pageY;return e;},fixTouchSupport:function(e){if($(e.currentTarget).hasClass('jcrop-tracker'))e.stopPropagation();},isSupported:hasTouchSupport,support:detectSupport()};}());var Coords=(function(){var x1=0,y1=0,x2=0,y2=0,ox,oy;function setPressed(pos){pos=rebound(pos);x2=x1=pos[0];y2=y1=pos[1];}function setCurrent(pos){pos=rebound(pos);ox=pos[0]-x2;oy=pos[1]-y2;x2=pos[0];y2=pos[1];}
|
||||
function getOffset(){return[ox,oy];}function moveOffset(offset){var ox=offset[0],oy=offset[1];if(0>x1+ox){ox-=ox+x1;}if(0>y1+oy){oy-=oy+y1;}if(boundy<y2+oy){oy+=boundy-(y2+oy);}if(boundx<x2+ox){ox+=boundx-(x2+ox);}x1+=ox;x2+=ox;y1+=oy;y2+=oy;}function getCorner(ord){var c=getFixed();switch(ord){case'ne':return[c.x2,c.y];case'nw':return[c.x,c.y];case'se':return[c.x2,c.y2];case'sw':return[c.x,c.y2];}}function getFixed(){if(!options.aspectRatio){return getRect();}var aspect=options.aspectRatio,min_x=options.minSize[0]/xscale,max_x=options.maxSize[0]/xscale,max_y=options.maxSize[1]/yscale,rw=x2-x1,rh=y2-y1,rwa=Math.abs(rw),rha=Math.abs(rh),real_ratio=rwa/rha,xx,yy,w,h;if(max_x===0){max_x=boundx*10;}if(max_y===0){max_y=boundy*10;}if(real_ratio<aspect){yy=y2;w=rha*aspect;xx=rw<0?x1-w:w+x1;if(xx<0){xx=0;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}else if(xx>boundx){xx=boundx;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}}else{xx=x2;h=rwa/aspect;yy=rh<0?y1-h:y1+h;if(yy<0){yy=0;w=Math.abs((yy-y1)*aspect);
|
||||
xx=rw<0?x1-w:w+x1;}else if(yy>boundy){yy=boundy;w=Math.abs(yy-y1)*aspect;xx=rw<0?x1-w:w+x1;}}if(xx>x1){if(xx-x1<min_x){xx=x1+min_x;}else if(xx-x1>max_x){xx=x1+max_x;}if(yy>y1){yy=y1+(xx-x1)/aspect;}else{yy=y1-(xx-x1)/aspect;}}else if(xx<x1){if(x1-xx<min_x){xx=x1-min_x;}else if(x1-xx>max_x){xx=x1-max_x;}if(yy>y1){yy=y1+(x1-xx)/aspect;}else{yy=y1-(x1-xx)/aspect;}}if(xx<0){x1-=xx;xx=0;}else if(xx>boundx){x1-=xx-boundx;xx=boundx;}if(yy<0){y1-=yy;yy=0;}else if(yy>boundy){y1-=yy-boundy;yy=boundy;}return makeObj(flipCoords(x1,y1,xx,yy));}function rebound(p){if(p[0]<0)p[0]=0;if(p[1]<0)p[1]=0;if(p[0]>boundx)p[0]=boundx;if(p[1]>boundy)p[1]=boundy;return[Math.round(p[0]),Math.round(p[1])];}function flipCoords(x1,y1,x2,y2){var xa=x1,xb=x2,ya=y1,yb=y2;if(x2<x1){xa=x2;xb=x1;}if(y2<y1){ya=y2;yb=y1;}return[xa,ya,xb,yb];}function getRect(){var xsize=x2-x1,ysize=y2-y1,delta;if(xlimit&&(Math.abs(xsize)>xlimit)){x2=(xsize>0)?(x1+xlimit):(x1-xlimit);}if(ylimit&&(Math.abs(ysize)>ylimit)){y2=(ysize>0)?(y1+ylimit):(y1-ylimit);
|
||||
}if(ymin/yscale&&(Math.abs(ysize)<ymin/yscale)){y2=(ysize>0)?(y1+ymin/yscale):(y1-ymin/yscale);}if(xmin/xscale&&(Math.abs(xsize)<xmin/xscale)){x2=(xsize>0)?(x1+xmin/xscale):(x1-xmin/xscale);}if(x1<0){x2-=x1;x1-=x1;}if(y1<0){y2-=y1;y1-=y1;}if(x2<0){x1-=x2;x2-=x2;}if(y2<0){y1-=y2;y2-=y2;}if(x2>boundx){delta=x2-boundx;x1-=delta;x2-=delta;}if(y2>boundy){delta=y2-boundy;y1-=delta;y2-=delta;}if(x1>boundx){delta=x1-boundy;y2-=delta;y1-=delta;}if(y1>boundy){delta=y1-boundy;y2-=delta;y1-=delta;}return makeObj(flipCoords(x1,y1,x2,y2));}function makeObj(a){return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]};}return{flipCoords:flipCoords,setPressed:setPressed,setCurrent:setCurrent,getOffset:getOffset,moveOffset:moveOffset,getCorner:getCorner,getFixed:getFixed};}());var Shade=(function(){var enabled=false,holder=$('<div />').css({position:'absolute',zIndex:240,opacity:0}),shades={top:createShade(),left:createShade().height(boundy),right:createShade().height(boundy),bottom:createShade()};
|
||||
function resizeShades(w,h){shades.left.css({height:px(h)});shades.right.css({height:px(h)});}function updateAuto(){return updateShade(Coords.getFixed());}function updateShade(c){shades.top.css({left:px(c.x),width:px(c.w),height:px(c.y)});shades.bottom.css({top:px(c.y2),left:px(c.x),width:px(c.w),height:px(boundy-c.y2)});shades.right.css({left:px(c.x2),width:px(boundx-c.x2)});shades.left.css({width:px(c.x)});}function createShade(){return $('<div />').css({position:'absolute',backgroundColor:options.shadeColor||options.bgColor}).appendTo(holder);}function enableShade(){if(!enabled){enabled=true;holder.insertBefore($img);updateAuto();Selection.setBgOpacity(1,0,1);$img2.hide();setBgColor(options.shadeColor||options.bgColor,1);if(Selection.isAwake()){setOpacity(options.bgOpacity,1);}else setOpacity(1,1);}}function setBgColor(color,now){colorChangeMacro(getShades(),color,now);}function disableShade(){if(enabled){holder.remove();$img2.show();enabled=false;if(Selection.isAwake()){Selection.setBgOpacity(options.bgOpacity,1,1);
|
||||
}else{Selection.setBgOpacity(1,1,1);Selection.disableHandles();}colorChangeMacro($div,0,1);}}function setOpacity(opacity,now){if(enabled){if(options.bgFade&&!now){holder.animate({opacity:1-opacity},{queue:false,duration:options.fadeTime});}else holder.css({opacity:1-opacity});}}function refreshAll(){options.shade?enableShade():disableShade();if(Selection.isAwake())setOpacity(options.bgOpacity);}function getShades(){return holder.children();}return{update:updateAuto,updateRaw:updateShade,getShades:getShades,setBgColor:setBgColor,enable:enableShade,disable:disableShade,resize:resizeShades,refresh:refreshAll,opacity:setOpacity};}());var Selection=(function(){var awake,hdep=370,borders={},handle={},dragbar={},seehandles=false;function insertBorder(type){var jq=$('<div />').css({position:'absolute',opacity:options.borderOpacity}).addClass(cssClass(type));$img_holder.append(jq);return jq;}function dragDiv(ord,zi){var jq=$('<div />').mousedown(createDragger(ord)).css({cursor:ord+'-resize',
|
||||
position:'absolute',zIndex:zi}).addClass('ord-'+ord);if(Touch.support){jq.bind('touchstart.jcrop',Touch.createDragger(ord));}$hdl_holder.append(jq);return jq;}function insertHandle(ord){var hs=options.handleSize,div=dragDiv(ord,hdep++).css({opacity:options.handleOpacity}).addClass(cssClass('handle'));if(hs){div.width(hs).height(hs);}return div;}function insertDragbar(ord){return dragDiv(ord,hdep++).addClass('jcrop-dragbar');}function createDragbars(li){var i;for(i=0;i<li.length;i++){dragbar[li[i]]=insertDragbar(li[i]);}}function createBorders(li){var cl,i;for(i=0;i<li.length;i++){switch(li[i]){case'n':cl='hline';break;case's':cl='hline bottom';break;case'e':cl='vline right';break;case'w':cl='vline';break;}borders[li[i]]=insertBorder(cl);}}function createHandles(li){var i;for(i=0;i<li.length;i++){handle[li[i]]=insertHandle(li[i]);}}function moveto(x,y){if(!options.shade){$img2.css({top:px(-y),left:px(-x)});}$sel.css({top:px(y),left:px(x)});}function resize(w,h){$sel.width(Math.round(w)).height(Math.round(h));
|
||||
}function refresh(){var c=Coords.getFixed();Coords.setPressed([c.x,c.y]);Coords.setCurrent([c.x2,c.y2]);updateVisible();}function updateVisible(select){if(awake){return update(select);}}function update(select){var c=Coords.getFixed();resize(c.w,c.h);moveto(c.x,c.y);if(options.shade)Shade.updateRaw(c);awake||show();if(select){options.onSelect.call(api,unscale(c));}else{options.onChange.call(api,unscale(c));}}function setBgOpacity(opacity,force,now){if(!awake&&!force)return;if(options.bgFade&&!now){$img.animate({opacity:opacity},{queue:false,duration:options.fadeTime});}else{$img.css('opacity',opacity);}}function show(){$sel.show();if(options.shade)Shade.opacity(bgopacity);else setBgOpacity(bgopacity,true);awake=true;}function release(){disableHandles();$sel.hide();if(options.shade)Shade.opacity(1);else setBgOpacity(1);awake=false;options.onRelease.call(api);}function showHandles(){if(seehandles){$hdl_holder.show();}}function enableHandles(){seehandles=true;if(options.allowResize){
|
||||
$hdl_holder.show();return true;}}function disableHandles(){seehandles=false;$hdl_holder.hide();}function animMode(v){if(v){animating=true;disableHandles();}else{animating=false;enableHandles();}}function done(){animMode(false);refresh();}if(options.dragEdges&&$.isArray(options.createDragbars))createDragbars(options.createDragbars);if($.isArray(options.createHandles))createHandles(options.createHandles);if(options.drawBorders&&$.isArray(options.createBorders))createBorders(options.createBorders);$(document).bind('touchstart.jcrop-ios',Touch.fixTouchSupport);var $track=newTracker().mousedown(createDragger('move')).css({cursor:'move',position:'absolute',zIndex:360});if(Touch.support){$track.bind('touchstart.jcrop',Touch.createDragger('move'));}$img_holder.append($track);disableHandles();return{updateVisible:updateVisible,update:update,release:release,refresh:refresh,isAwake:function(){return awake;},setCursor:function(cursor){$track.css('cursor',cursor);},enableHandles:enableHandles,
|
||||
enableOnly:function(){seehandles=true;},showHandles:showHandles,disableHandles:disableHandles,animMode:animMode,setBgOpacity:setBgOpacity,done:done};}());var Tracker=(function(){var onMove=function(){},onDone=function(){},trackDoc=options.trackDocument;function toFront(touch){$trk.css({zIndex:450});if(touch)$(document).bind('touchmove.jcrop',trackTouchMove).bind('touchend.jcrop',trackTouchEnd);else if(trackDoc)$(document).bind('mousemove.jcrop',trackMove).bind('mouseup.jcrop',trackUp);}function toBack(){$trk.css({zIndex:290});$(document).unbind('.jcrop');}function trackMove(e){onMove(mouseAbs(e));return false;}function trackUp(e){e.preventDefault();e.stopPropagation();if(btndown){btndown=false;onDone(mouseAbs(e));if(Selection.isAwake()){options.onSelect.call(api,unscale(Coords.getFixed()));}toBack();onMove=function(){};onDone=function(){};}return false;}function activateHandlers(move,done,touch){btndown=true;onMove=move;onDone=done;toFront(touch);return false;}function trackTouchMove(e)
|
||||
{onMove(mouseAbs(Touch.cfilter(e)));return false;}function trackTouchEnd(e){return trackUp(Touch.cfilter(e));}function setCursor(t){$trk.css('cursor',t);}if(!trackDoc){$trk.mousemove(trackMove).mouseup(trackUp).mouseout(trackUp);}$img.before($trk);return{activateHandlers:activateHandlers,setCursor:setCursor};}());var KeyManager=(function(){var $keymgr=$('<input type="radio" />').css({position:'fixed',left:'-120px',width:'12px'}).addClass('jcrop-keymgr'),$keywrap=$('<div />').css({position:'absolute',overflow:'hidden'}).append($keymgr);function watchKeys(){if(options.keySupport){$keymgr.show();$keymgr.focus();}}function onBlur(e){$keymgr.hide();}function doNudge(e,x,y){if(options.allowMove){Coords.moveOffset([x,y]);Selection.updateVisible(true);}e.preventDefault();e.stopPropagation();}function parseKey(e){if(e.ctrlKey||e.metaKey){return true;}shift_down=e.shiftKey?true:false;var nudge=shift_down?10:1;switch(e.keyCode){case 37:doNudge(e,-nudge,0);break;case 39:doNudge(e,nudge,0);break;
|
||||
case 38:doNudge(e,0,-nudge);break;case 40:doNudge(e,0,nudge);break;case 27:if(options.allowSelect)Selection.release();break;case 9:return true;}return false;}if(options.keySupport){$keymgr.keydown(parseKey).blur(onBlur);if(ie6mode||!options.fixedSupport){$keymgr.css({position:'absolute',left:'-20px'});$keywrap.append($keymgr).insertBefore($img);}else{$keymgr.insertBefore($img);}}return{watchKeys:watchKeys};}());function setClass(cname){$div.removeClass().addClass(cssClass('holder')).addClass(cname);}function animateTo(a,callback){var x1=a[0]/xscale,y1=a[1]/yscale,x2=a[2]/xscale,y2=a[3]/yscale;if(animating){return;}var animto=Coords.flipCoords(x1,y1,x2,y2),c=Coords.getFixed(),initcr=[c.x,c.y,c.x2,c.y2],animat=initcr,interv=options.animationDelay,ix1=animto[0]-initcr[0],iy1=animto[1]-initcr[1],ix2=animto[2]-initcr[2],iy2=animto[3]-initcr[3],pcent=0,velocity=options.swingSpeed;x1=animat[0];y1=animat[1];x2=animat[2];y2=animat[3];Selection.animMode(true);var anim_timer;function queueAnimator(){
|
||||
window.setTimeout(animator,interv);}var animator=(function(){return function(){pcent+=(100-pcent)/velocity;animat[0]=Math.round(x1+((pcent/100)*ix1));animat[1]=Math.round(y1+((pcent/100)*iy1));animat[2]=Math.round(x2+((pcent/100)*ix2));animat[3]=Math.round(y2+((pcent/100)*iy2));if(pcent>=99.8){pcent=100;}if(pcent<100){setSelectRaw(animat);queueAnimator();}else{Selection.done();Selection.animMode(false);if(typeof(callback)==='function'){callback.call(api);}}};}());queueAnimator();}function setSelect(rect){setSelectRaw([rect[0]/xscale,rect[1]/yscale,rect[2]/xscale,rect[3]/yscale]);options.onSelect.call(api,unscale(Coords.getFixed()));Selection.enableHandles();}function setSelectRaw(l){Coords.setPressed([l[0],l[1]]);Coords.setCurrent([l[2],l[3]]);Selection.update();}function tellSelect(){return unscale(Coords.getFixed());}function tellScaled(){return Coords.getFixed();}function setOptionsNew(opt){setOptions(opt);interfaceUpdate();}function disableCrop(){options.disabled=true;Selection.disableHandles();
|
||||
Selection.setCursor('default');Tracker.setCursor('default');}function enableCrop(){options.disabled=false;interfaceUpdate();}function cancelCrop(){Selection.done();Tracker.activateHandlers(null,null);}function destroy(){$(document).unbind('touchstart.jcrop-ios',Touch.fixTouchSupport);$div.remove();$origimg.show();$origimg.css('visibility','visible');$(obj).removeData('Jcrop');}function setImage(src,callback){Selection.release();disableCrop();var img=new Image();img.onload=function(){var iw=img.width;var ih=img.height;var bw=options.boxWidth;var bh=options.boxHeight;$img.width(iw).height(ih);$img.attr('src',src);$img2.attr('src',src);presize($img,bw,bh);boundx=$img.width();boundy=$img.height();$img2.width(boundx).height(boundy);$trk.width(boundx+(bound*2)).height(boundy+(bound*2));$div.width(boundx).height(boundy);Shade.resize(boundx,boundy);enableCrop();if(typeof(callback)==='function'){callback.call(api);}};img.src=src;}function colorChangeMacro($obj,color,now){var mycolor=color||options.bgColor;
|
||||
if(options.bgFade&&supportsColorFade()&&options.fadeTime&&!now){$obj.animate({backgroundColor:mycolor},{queue:false,duration:options.fadeTime});}else{$obj.css('backgroundColor',mycolor);}}function interfaceUpdate(alt){if(options.allowResize){if(alt){Selection.enableOnly();}else{Selection.enableHandles();}}else{Selection.disableHandles();}Tracker.setCursor(options.allowSelect?'crosshair':'default');Selection.setCursor(options.allowMove?'move':'default');if(options.hasOwnProperty('trueSize')){xscale=options.trueSize[0]/boundx;yscale=options.trueSize[1]/boundy;}if(options.hasOwnProperty('setSelect')){setSelect(options.setSelect);Selection.done();delete(options.setSelect);}Shade.refresh();if(options.bgColor!=bgcolor){colorChangeMacro(options.shade?Shade.getShades():$div,options.shade?(options.shadeColor||options.bgColor):options.bgColor);bgcolor=options.bgColor;}if(bgopacity!=options.bgOpacity){bgopacity=options.bgOpacity;if(options.shade)Shade.refresh();else Selection.setBgOpacity(bgopacity);
|
||||
}xlimit=options.maxSize[0]||0;ylimit=options.maxSize[1]||0;xmin=options.minSize[0]||0;ymin=options.minSize[1]||0;if(options.hasOwnProperty('outerImage')){$img.attr('src',options.outerImage);delete(options.outerImage);}Selection.refresh();}if(Touch.support)$trk.bind('touchstart.jcrop',Touch.newSelection);$hdl_holder.hide();interfaceUpdate(true);var api={setImage:setImage,animateTo:animateTo,setSelect:setSelect,setOptions:setOptionsNew,tellSelect:tellSelect,tellScaled:tellScaled,setClass:setClass,disable:disableCrop,enable:enableCrop,cancel:cancelCrop,release:Selection.release,destroy:destroy,focus:KeyManager.watchKeys,getBounds:function(){return[boundx*xscale,boundy*yscale];},getWidgetSize:function(){return[boundx,boundy];},getScaleFactor:function(){return[xscale,yscale];},getOptions:function(){return options;},ui:{holder:$div,selection:$sel}};if(is_msie)$div.bind('selectstart',function(){return false;});$origimg.data('Jcrop',api);return api;};$.fn.Jcrop=function(options,callback){var api;
|
||||
this.each(function(){if($(this).data('Jcrop')){if(options==='api')return $(this).data('Jcrop');else $(this).data('Jcrop').setOptions(options);}else{if(this.tagName=='IMG')$.Jcrop.Loader(this,function(){$(this).css({display:'block',visibility:'hidden'});api=$.Jcrop(this,options);if($.isFunction(callback))callback.call(api);});else{$(this).css({display:'block',visibility:'hidden'});api=$.Jcrop(this,options);if($.isFunction(callback))callback.call(api);}}});return this;};$.Jcrop.Loader=function(imgobj,success,error){var $img=$(imgobj),img=$img[0];function completeCheck(){if(img.complete){$img.unbind('.jcloader');if($.isFunction(success))success.call(img);}else window.setTimeout(completeCheck,50);}$img.bind('load.jcloader',completeCheck).bind('error.jcloader',function(e){$img.unbind('.jcloader');if($.isFunction(error))error.call(img);});if(img.complete&&$.isFunction(success)){$img.unbind('.jcloader');success.call(img);}};$.Jcrop.defaults={allowSelect:true,allowMove:true,allowResize:true,
|
||||
trackDocument:true,baseClass:'jcrop',addClass:null,bgColor:'black',bgOpacity:0.6,bgFade:false,borderOpacity:0.4,handleOpacity:0.5,handleSize:null,aspectRatio:0,keySupport:true,createHandles:['n','s','e','w','nw','ne','se','sw'],createDragbars:['n','s','e','w'],createBorders:['n','s','e','w'],drawBorders:true,dragEdges:true,fixedSupport:true,touchSupport:null,shade:null,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}};}(jQuery));!function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;(function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=
|
||||
b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a<f;++a){var h=b[a];if(/\\[bdsw]/i.test(h))c.push(h);else{var h=d(h),l;a+2<f&&"-"===b[a+1]?(l=d(b[a+2]),a+=2):l=h;e.push([h,l]);l<65||h>122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;a<e.length;++a)h=e[a],h[0]<=f[1]+1?f[1]=Math.max(f[1],h[1]):b.push(f=h);for(a=0;a<b.length;++a)h=b[a],c.push(g(h[0])),h[1]>h[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f<c;++f){var l=a[f];l==="("?++h:"\\"===l.charAt(0)&&(l=+l.substring(1))&&(l<=h?d[l]=-1:a[f]=g(l))}for(f=1;f<d.length;++f)-1===d[f]&&(d[f]=++x);for(h=f=0;f<c;++f)l=a[f],l==="("?(++h,d[h]||(a[f]="(?:")):"\\"===l.charAt(0)&&(l=+l.substring(1))&&l<=h&&
|
||||
(a[f]="\\"+d[l]);for(f=0;f<c;++f)"^"===a[f]&&"^"!==a[f+1]&&(a[f]="");if(e.ignoreCase&&m)for(f=0;f<c;++f)l=a[f],e=l.charAt(0),l.length>=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k<c;++k){var i=a[k];if(i.ignoreCase)j=!0;else if(/[a-z]/i.test(i.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){m=!0;j=!1;break}}for(var r={b:8,t:9,n:10,v:11,f:12,r:13},n=[],k=0,c=a.length;k<c;++k){i=a[k];if(i.global||i.multiline)throw Error(""+i);n.push("(?:"+s(i)+")")}return RegExp(n.join("|"),j?"gi":"g")}function T(a,d){function g(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)g(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)s[j]="\n",m[j<<1]=x++,m[j++<<1|1]=a}}else if(c==3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),s[j]=c,m[j<<1]=x,x+=c.length,m[j++<<1|1]=
|
||||
a)}var b=/(?:^|\s)nocode(?:\s|$)/,s=[],x=0,m=[],j=0;g(a);return{a:s.join("").replace(/\n$/,""),d:m}}function H(a,d,g,b){d&&(a={a:d,e:a},g(a),b.push.apply(b,a.g))}function U(a){for(var d=void 0,g=a.firstChild;g;g=g.nextSibling)var b=g.nodeType,d=b===1?d?a:g:b===3?V.test(g.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function g(a){for(var j=a.e,k=[j,"pln"],c=0,i=a.a.match(s)||[],r={},n=0,e=i.length;n<e;++n){var z=i[n],w=r[z],t=void 0,f;if(typeof w==="string")f=!1;else{var h=b[z.charAt(0)];if(h)t=z.match(h[1]),w=h[0];else{for(f=0;f<x;++f)if(h=d[f],t=z.match(h[1])){w=h[0];break}t||(w="pln")}if((f=w.length>=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c<i;++c){var r=
|
||||
g[c],n=r[3];if(n)for(var e=n.length;--e>=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com",
|
||||
/^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,
|
||||
q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d=c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i<c.length;++i)b(c[i]);d===(d|0)&&c[0].setAttribute("value",d);var r=j.createElement("ol");
|
||||
r.className="linenums";for(var d=Math.max(0,d-1|0)||0,i=0,n=c.length;i<n;++i)k=c[i],k.className="L"+(i+d)%10,k.firstChild||k.appendChild(j.createTextNode("\u00a0")),r.appendChild(k);a.appendChild(r)}function p(a,d){for(var g=d.length;--g>=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return F[a]}function K(a){var d=a.h;try{var g=T(a.c,a.i),b=g.a;a.a=b;a.d=g.d;a.e=0;I(d,b)(a);var s=/\bMSIE\s(\d+)/.exec(navigator.userAgent),s=s&&+s[1]<=8,d=/\n/g,x=a.a,m=x.length,g=0,j=a.d,k=j.length,b=0,c=a.g,i=c.length,r=0;c[i]=m;var n,e;for(e=n=0;e<i;)c[e]!==c[e+2]?(c[n++]=c[e++],c[n++]=c[e++]):e+=2;i=n;for(e=n=0;e<i;){for(var p=c[e],w=c[e+1],t=e+2;t+2<=i&&c[t+1]===w;)t+=2;c[n++]=p;c[n++]=w;e=t}c.length=n;var f=a.c,h;if(f)h=f.style.display,f.style.display="none";try{for(;b<k;){var l=j[b+2]||m,B=c[r+2]||m,t=Math.min(l,B),A=j[b+1],G;if(A.nodeType!==1&&(G=x.substring(g,
|
||||
t))){s&&(G=G.replace(d,"\r"));A.nodeValue=G;var L=A.ownerDocument,o=L.createElement("span");o.className=c[r+1];var v=A.parentNode;v.replaceChild(o,A);o.appendChild(A);g<l&&(j[b+1]=A=L.createTextNode(x.substring(t,l)),v.insertBefore(A,o.nextSibling))}g=t;g>=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
|
||||
V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);p(C([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],
|
||||
["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);p(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);p(v({keywords:M,hashComments:!0,cStyleComments:!0,types:R}),["c","cc","cpp","cxx","cyc","m"]);p(v({keywords:"null,true,false"}),["json"]);p(v({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:R}),["cs"]);p(v({keywords:N,cStyleComments:!0}),["java"]);p(v({keywords:y,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);p(v({keywords:P,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);p(v({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);p(v({keywords:Q,
|
||||
hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);p(v({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);p(v({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);p(v({keywords:W,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]);p(C([],[["str",/^[\S\s]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:C,registerLangHandler:p,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,g){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;g&&J(b,g,!0);K({h:d,j:g,c:b,i:1});
|
||||
return b.innerHTML},prettyPrint:D.prettyPrint=function(a,d){function g(){for(var b=D.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;i<p.length&&c.now()<b;i++){for(var d=p[i],j=h,k=d;k=k.previousSibling;){var m=k.nodeType,o=(m===7||m===8)&&k.nodeValue;if(o?!/^\??prettify\b/.test(o):m!==3||/\S/.test(k.nodeValue))break;if(o){j={};o.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){j[b]=c});break}}k=d.className;if((j!==h||e.test(k))&&!v.test(k)){m=!1;for(o=d.parentNode;o;o=o.parentNode)if(f.test(o.tagName)&&o.className&&e.test(o.className)){m=!0;break}if(!m){d.className+=" prettyprinted";m=j.lang;if(!m){var m=k.match(n),y;if(!m&&(y=U(d))&&t.test(y.tagName))m=y.className.match(n);m&&(m=m[1])}if(w.test(d.tagName))o=1;else var o=d.currentStyle,u=s.defaultView,o=(o=o?o.whiteSpace:u&&u.getComputedStyle?u.getComputedStyle(d,q).getPropertyValue("white-space"):0)&&"pre"===o.substring(0,3);u=j.linenums;if(!(u=u==="true"||+u))u=(u=k.match(/\blinenums\b(?::(\d+))?/))?u[1]&&u[1].length?+u[1]:!0:!1;u&&J(d,u,o);r=
|
||||
{h:m,c:d,j:u,i:o};K(r)}}}i<p.length?setTimeout(g,250):"function"===typeof a&&a()}for(var b=d||document.body,s=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],p=[],m=0;m<b.length;++m)for(var j=0,k=b[m].length;j<k;++j)p.push(b[m][j]);var b=q,c=Date;c.now||(c={now:function(){return+new Date}});var i=0,r,n=/\blang(?:uage)?-([\w.]+)(?!\S)/,e=/\bprettyprint\b/,v=/\bprettyprinted\b/,w=/pre|xmp/i,t=/^code$/i,f=/^(?:pre|code|xmp)$/i,h={};g()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return Y})})();}()+function($){"use strict";if($.wn.mediaManager===undefined)$.wn.mediaManager={}
|
||||
var Base=$.wn.foundation.base,BaseProto=Base.prototype
|
||||
var MediaManagerPopup=function(options){this.$popupRootElement=null
|
||||
this.options=$.extend({},MediaManagerPopup.DEFAULTS,options)
|
||||
Base.call(this)
|
||||
this.init()
|
||||
this.show()}
|
||||
MediaManagerPopup.prototype=Object.create(BaseProto)
|
||||
MediaManagerPopup.prototype.constructor=MediaManagerPopup
|
||||
MediaManagerPopup.prototype.dispose=function(){this.unregisterHandlers()
|
||||
this.$popupRootElement.remove()
|
||||
this.$popupRootElement=null
|
||||
this.$popupElement=null
|
||||
BaseProto.dispose.call(this)}
|
||||
MediaManagerPopup.prototype.init=function(){if(this.options.alias===undefined)throw new Error('Media Manager popup option "alias" is not set.')
|
||||
this.$popupRootElement=$('<div/>')
|
||||
this.registerHandlers()}
|
||||
MediaManagerPopup.prototype.registerHandlers=function(){this.$popupRootElement.one('hide.oc.popup',this.proxy(this.onPopupHidden))
|
||||
this.$popupRootElement.one('shown.oc.popup',this.proxy(this.onPopupShown))}
|
||||
MediaManagerPopup.prototype.unregisterHandlers=function(){this.$popupElement.off('popupcommand',this.proxy(this.onPopupCommand))
|
||||
this.$popupRootElement.off('popupcommand',this.proxy(this.onPopupCommand))}
|
||||
MediaManagerPopup.prototype.show=function(){var data={bottomToolbar:this.options.bottomToolbar?1:0,cropAndInsertButton:this.options.cropAndInsertButton?1:0,mode:this.options.mode||'all',}
|
||||
this.$popupRootElement.popup({extraData:data,size:'adaptive',adaptiveHeight:true,handler:this.options.alias+'::onLoadPopup'})}
|
||||
MediaManagerPopup.prototype.hide=function(){if(this.$popupElement)this.$popupElement.trigger('close.oc.popup')}
|
||||
MediaManagerPopup.prototype.getMediaManagerElement=function(){return this.$popupElement.find('[data-control="media-manager"]')}
|
||||
MediaManagerPopup.prototype.insertMedia=function(){var items=this.getMediaManagerElement().mediaManager('getSelectedItems')
|
||||
if(this.options.onInsert!==undefined)this.options.onInsert.call(this,items)}
|
||||
MediaManagerPopup.prototype.insertCroppedImage=function(imageItem){if(this.options.onInsert!==undefined)this.options.onInsert.call(this,[imageItem])}
|
||||
MediaManagerPopup.prototype.onPopupHidden=function(event,element,popup){var mediaManager=this.getMediaManagerElement()
|
||||
mediaManager.mediaManager('dispose')
|
||||
mediaManager.remove()
|
||||
$(document).trigger('mousedown')
|
||||
this.dispose()
|
||||
if(this.options.onClose!==undefined)this.options.onClose.call(this)}
|
||||
MediaManagerPopup.prototype.onPopupShown=function(event,element,popup){this.$popupElement=popup
|
||||
this.$popupElement.on('popupcommand',this.proxy(this.onPopupCommand))
|
||||
this.getMediaManagerElement().mediaManager('selectFirstItem')}
|
||||
MediaManagerPopup.prototype.onPopupCommand=function(ev,command,param){switch(command){case'insert':this.insertMedia()
|
||||
break;case'insert-cropped':this.insertCroppedImage(param)
|
||||
break;}return false}
|
||||
MediaManagerPopup.DEFAULTS={alias:undefined,bottomToolbar:true,cropAndInsertButton:false,onInsert:undefined,onClose:undefined}
|
||||
$.wn.mediaManager.popup=MediaManagerPopup}(window.jQuery);if($.wn===undefined)$.wn={}
|
||||
if($.oc===undefined)$.oc=$.wn
|
||||
if($.wn.langMessages===undefined)$.wn.langMessages={}
|
||||
$.wn.lang=(function(lang,messages){lang.load=function(locale){if(messages[locale]===undefined){messages[locale]={}}lang.loadedMessages=messages[locale]}
|
||||
lang.get=function(name,defaultValue){if(!name)return
|
||||
var result=lang.loadedMessages
|
||||
if(!defaultValue)defaultValue=name
|
||||
$.each(name.split('.'),function(index,value){if(result[value]===undefined){result=defaultValue
|
||||
return false}result=result[value]})
|
||||
return result}
|
||||
if(lang.locale===undefined){lang.locale=$('html').attr('lang')||'en'}if(lang.loadedMessages===undefined){lang.load(lang.locale)}return lang})($.wn.lang||{},$.wn.langMessages);(function($){if($.wn===undefined)$.wn={}
|
||||
if($.oc===undefined)$.oc=$.wn
|
||||
$.wn.alert=function alert(message){swal({title:message,confirmButtonClass:'btn-primary'})}
|
||||
$.wn.confirm=function confirm(message,callback){swal({title:message,showCancelButton:true,confirmButtonClass:'btn-primary'},callback)}})(jQuery);$(window).on('ajaxErrorMessage',function(event,message){if(!message)return
|
||||
$.wn.alert(message)
|
||||
event.preventDefault()})
|
||||
$(window).on('ajaxConfirmMessage',function(event,message){if(!message)return
|
||||
$.wn.confirm(message,function(isConfirm){isConfirm?event.promise.resolve():event.promise.reject()})
|
||||
event.preventDefault()
|
||||
return true})
|
||||
$(document).ready(function(){if(!window.swal)return
|
||||
var swal=window.swal
|
||||
window.sweetAlert=window.swal=function(message,callback){if(typeof message==='object'){message.confirmButtonText=message.confirmButtonText||$.wn.lang.get('alert.confirm_button_text')
|
||||
message.cancelButtonText=message.cancelButtonText||$.wn.lang.get('alert.cancel_button_text')}else{message={title:message,confirmButtonText:$.wn.lang.get('alert.confirm_button_text'),cancelButtonText:$.wn.lang.get('alert.cancel_button_text')}}swal(message,callback)}})+function($){"use strict";var Base=$.wn.foundation.base,BaseProto=Base.prototype
|
||||
var Scrollpad=function(element,options){this.$el=$(element)
|
||||
this.scrollbarElement=null
|
||||
this.dragHandleElement=null
|
||||
this.scrollContentElement=null
|
||||
this.contentElement=null
|
||||
this.options=options
|
||||
this.scrollbarSize=null
|
||||
this.updateScrollbarTimer=null
|
||||
this.dragOffset=null
|
||||
Base.call(this)
|
||||
this.init()
|
||||
$.wn.foundation.controlUtils.markDisposable(element)}
|
||||
Scrollpad.prototype=Object.create(BaseProto)
|
||||
Scrollpad.prototype.constructor=Scrollpad
|
||||
Scrollpad.prototype.dispose=function(){this.unregisterHandlers()
|
||||
this.$el.get(0).removeChild(this.scrollbarElement)
|
||||
this.$el.removeData('oc.scrollpad')
|
||||
this.$el=null
|
||||
this.scrollbarElement=null
|
||||
this.dragHandleElement=null
|
||||
this.scrollContentElement=null
|
||||
this.contentElement=null
|
||||
BaseProto.dispose.call(this)}
|
||||
Scrollpad.prototype.scrollToStart=function(){var scrollAttr=this.options.direction=='vertical'?'scrollTop':'scrollLeft'
|
||||
this.scrollContentElement[scrollAttr]=0}
|
||||
Scrollpad.prototype.update=function(){this.updateScrollbarSize()}
|
||||
Scrollpad.prototype.init=function(){this.build()
|
||||
this.setScrollContentSize()
|
||||
this.registerHandlers()}
|
||||
Scrollpad.prototype.build=function(){var el=this.$el.get(0)
|
||||
this.scrollContentElement=el.children[0]
|
||||
this.contentElement=this.scrollContentElement.children[0]
|
||||
this.$el.prepend('<div class="scrollpad-scrollbar"><div class="drag-handle"></div></div>')
|
||||
this.scrollbarElement=el.querySelector('.scrollpad-scrollbar')
|
||||
this.dragHandleElement=el.querySelector('.scrollpad-scrollbar > .drag-handle')}
|
||||
Scrollpad.prototype.registerHandlers=function(){this.$el.on('mouseenter',this.proxy(this.onMouseEnter))
|
||||
this.$el.on('mouseleave',this.proxy(this.onMouseLeave))
|
||||
this.$el.one('dispose-control',this.proxy(this.dispose))
|
||||
this.scrollContentElement.addEventListener('scroll',this.proxy(this.onScroll))
|
||||
this.dragHandleElement.addEventListener('mousedown',this.proxy(this.onStartDrag))}
|
||||
Scrollpad.prototype.unregisterHandlers=function(){this.$el.off('mouseenter',this.proxy(this.onMouseEnter))
|
||||
this.$el.off('mouseleave',this.proxy(this.onMouseLeave))
|
||||
this.$el.off('dispose-control',this.proxy(this.dispose))
|
||||
this.scrollContentElement.removeEventListener('scroll',this.proxy(this.onScroll))
|
||||
this.dragHandleElement.removeEventListener('mousedown',this.proxy(this.onStartDrag))
|
||||
document.removeEventListener('mousemove',this.proxy(this.onMouseMove))
|
||||
document.removeEventListener('mouseup',this.proxy(this.onEndDrag))}
|
||||
Scrollpad.prototype.setScrollContentSize=function(){var scrollbarSize=this.getScrollbarSize()
|
||||
if(this.options.direction=='vertical')this.scrollContentElement.setAttribute('style','margin-right: -'+scrollbarSize+'px')
|
||||
else this.scrollContentElement.setAttribute('style','margin-bottom: -'+scrollbarSize+'px')}
|
||||
Scrollpad.prototype.getScrollbarSize=function(){if(this.scrollbarSize!==null)return this.scrollbarSize
|
||||
var testerElement=document.createElement('div')
|
||||
testerElement.setAttribute('class','scrollpad-scrollbar-size-tester')
|
||||
testerElement.appendChild(document.createElement('div'))
|
||||
document.body.appendChild(testerElement)
|
||||
var width=testerElement.offsetWidth,innerWidth=testerElement.querySelector('div').offsetWidth
|
||||
document.body.removeChild(testerElement)
|
||||
if(width===innerWidth&&navigator.userAgent.toLowerCase().indexOf('firefox')>-1)return this.scrollbarSize=17
|
||||
return this.scrollbarSize=width-innerWidth}
|
||||
Scrollpad.prototype.updateScrollbarSize=function(){this.scrollbarElement.removeAttribute('data-hidden')
|
||||
var contentSize=this.options.direction=='vertical'?this.contentElement.scrollHeight:this.contentElement.scrollWidth,scrollOffset=this.options.direction=='vertical'?this.scrollContentElement.scrollTop:this.scrollContentElement.scrollLeft,scrollbarSize=this.options.direction=='vertical'?this.scrollbarElement.offsetHeight:this.scrollbarElement.offsetWidth,scrollbarRatio=scrollbarSize/contentSize,handleOffset=Math.round(scrollbarRatio*scrollOffset)+2,handleSize=Math.floor(scrollbarRatio*(scrollbarSize-2))-2;if(scrollbarSize<contentSize){if(this.options.direction=='vertical')this.dragHandleElement.setAttribute('style','top: '+handleOffset+'px; height: '+handleSize+'px')
|
||||
else this.dragHandleElement.setAttribute('style','left: '+handleOffset+'px; width: '+handleSize+'px')
|
||||
this.scrollbarElement.removeAttribute('data-hidden')}else this.scrollbarElement.setAttribute('data-hidden',true)}
|
||||
Scrollpad.prototype.displayScrollbar=function(){this.clearUpdateScrollbarTimer()
|
||||
this.updateScrollbarSize()
|
||||
this.scrollbarElement.setAttribute('data-visible','true')}
|
||||
Scrollpad.prototype.hideScrollbar=function(){this.scrollbarElement.removeAttribute('data-visible')}
|
||||
Scrollpad.prototype.clearUpdateScrollbarTimer=function(){if(this.updateScrollbarTimer===null)return
|
||||
clearTimeout(this.updateScrollbarTimer)
|
||||
this.updateScrollbarTimer=null}
|
||||
Scrollpad.prototype.onMouseEnter=function(){this.displayScrollbar()}
|
||||
Scrollpad.prototype.onMouseLeave=function(){this.hideScrollbar()}
|
||||
Scrollpad.prototype.onScroll=function(){if(this.updateScrollbarTimer!==null)return
|
||||
this.updateScrollbarTimer=setTimeout(this.proxy(this.displayScrollbar),10)}
|
||||
Scrollpad.prototype.onStartDrag=function(ev){$.wn.foundation.event.stop(ev)
|
||||
var pageCoords=$.wn.foundation.event.pageCoordinates(ev),eventOffset=this.options.direction=='vertical'?pageCoords.y:pageCoords.x,handleCoords=$.wn.foundation.element.absolutePosition(this.dragHandleElement),handleOffset=this.options.direction=='vertical'?handleCoords.top:handleCoords.left
|
||||
this.dragOffset=eventOffset-handleOffset
|
||||
document.addEventListener('mousemove',this.proxy(this.onMouseMove))
|
||||
document.addEventListener('mouseup',this.proxy(this.onEndDrag))}
|
||||
Scrollpad.prototype.onMouseMove=function(ev){$.wn.foundation.event.stop(ev)
|
||||
var eventCoordsAttr=this.options.direction=='vertical'?'y':'x',elementCoordsAttr=this.options.direction=='vertical'?'top':'left',offsetAttr=this.options.direction=='vertical'?'offsetHeight':'offsetWidth',scrollAttr=this.options.direction=='vertical'?'scrollTop':'scrollLeft'
|
||||
var eventOffset=$.wn.foundation.event.pageCoordinates(ev)[eventCoordsAttr],scrollbarOffset=$.wn.foundation.element.absolutePosition(this.scrollbarElement)[elementCoordsAttr],dragPos=eventOffset-scrollbarOffset-this.dragOffset,scrollbarSize=this.scrollbarElement[offsetAttr],contentSize=this.contentElement[offsetAttr],dragPerc=dragPos/scrollbarSize
|
||||
if(dragPerc>1)dragPerc=1
|
||||
var scrollPos=dragPerc*contentSize;this.scrollContentElement[scrollAttr]=scrollPos}
|
||||
Scrollpad.prototype.onEndDrag=function(ev){document.removeEventListener('mousemove',this.proxy(this.onMouseMove))
|
||||
document.removeEventListener('mouseup',this.proxy(this.onEndDrag))}
|
||||
Scrollpad.DEFAULTS={direction:'vertical'}
|
||||
var old=$.fn.scrollpad
|
||||
$.fn.scrollpad=function(option){var args=Array.prototype.slice.call(arguments,1),result=undefined
|
||||
this.each(function(){var $this=$(this)
|
||||
var data=$this.data('oc.scrollpad')
|
||||
var options=$.extend({},Scrollpad.DEFAULTS,$this.data(),typeof option=='object'&&option)
|
||||
if(!data)$this.data('oc.scrollpad',(data=new Scrollpad(this,options)))
|
||||
if(typeof option=='string')result=data[option].apply(data,args)
|
||||
if(typeof result!='undefined')return false})
|
||||
return result?result:this}
|
||||
$.fn.scrollpad.Constructor=Scrollpad
|
||||
$.fn.scrollpad.noConflict=function(){$.fn.scrollpad=old
|
||||
return this}
|
||||
$(document).on('render',function(){$('div[data-control=scrollpad]').scrollpad()})}(window.jQuery);+function($){"use strict";var VerticalMenu=function(element,toggle,options){this.$el=$(element)
|
||||
this.body=$('body')
|
||||
this.toggle=$(toggle)
|
||||
this.options=options||{}
|
||||
this.options=$.extend({},VerticalMenu.DEFAULTS,this.options)
|
||||
this.wrapper=$(this.options.contentWrapper)
|
||||
this.breakpoint=options.breakpoint
|
||||
this.menuPanel=$('<div></div>').appendTo('body').addClass(this.options.collapsedMenuClass).css('width',0)
|
||||
this.menuContainer=$('<div></div>').appendTo(this.menuPanel).css('display','none')
|
||||
this.menuElement=this.$el.clone().appendTo(this.menuContainer).css('width','auto')
|
||||
var self=this
|
||||
this.toggle.click(function(){if(!self.body.hasClass(self.options.bodyMenuOpenClass)){var wrapperWidth=self.wrapper.outerWidth()
|
||||
self.menuElement.dragScroll('goToStart')
|
||||
self.wrapper.css({'position':'absolute','min-width':self.wrapper.width(),'height':'100%'})
|
||||
self.body.addClass(self.options.bodyMenuOpenClass)
|
||||
self.menuContainer.css('display','block')
|
||||
self.wrapper.animate({'left':self.options.menuWidth},{duration:200,queue:false})
|
||||
self.menuPanel.animate({'width':self.options.menuWidth},{duration:200,queue:false,complete:function(){self.menuElement.css('width',self.options.menuWidth)}})}else{closeMenu()}return false})
|
||||
this.wrapper.click(function(){if(self.body.hasClass(self.options.bodyMenuOpenClass)){closeMenu()
|
||||
return false}})
|
||||
$(window).resize(function(){if(self.body.hasClass(self.options.bodyMenuOpenClass)){if($(window).width()>self.breakpoint){hideMenu()}}})
|
||||
this.menuElement.dragScroll({vertical:true,useNative:true,start:function(){self.menuElement.addClass('drag')},stop:function(){self.menuElement.removeClass('drag')},scrollClassContainer:self.menuPanel,scrollMarkerContainer:self.menuContainer})
|
||||
this.menuElement.on('click',function(){if(self.menuElement.hasClass('drag'))return false})
|
||||
function hideMenu(){self.body.removeClass(self.options.bodyMenuOpenClass)
|
||||
self.wrapper.css({'position':'static','min-width':0,'right':0,'height':'100%'})
|
||||
self.menuPanel.css('width',0)
|
||||
self.menuElement.css('width','auto')
|
||||
self.menuContainer.css('display','none')}function closeMenu(){self.wrapper.animate({'left':0},{duration:200,queue:false})
|
||||
self.menuPanel.animate({'width':0},{duration:200,queue:false,complete:hideMenu})
|
||||
self.menuElement.animate({'width':0},{duration:200,queue:false})}}
|
||||
VerticalMenu.DEFAULTS={menuWidth:230,breakpoint:769,bodyMenuOpenClass:'mainmenu-open',collapsedMenuClass:'mainmenu-collapsed',contentWrapper:'#layout-canvas'}
|
||||
var old=$.fn.verticalMenu
|
||||
$.fn.verticalMenu=function(toggleSelector,option){return this.each(function(){var $this=$(this)
|
||||
var data=$this.data('oc.verticalMenu')
|
||||
var options=typeof option=='object'&&option
|
||||
if(!data)$this.data('oc.verticalMenu',(data=new VerticalMenu(this,toggleSelector,options)))
|
||||
if(typeof option=='string')data[option].call($this)})}
|
||||
$.fn.verticalMenu.Constructor=VerticalMenu
|
||||
$.fn.verticalMenu.noConflict=function(){$.fn.verticalMenu=old
|
||||
return this}}(window.jQuery);(function($){$(document).ready(function(){$('nav.navbar').each(function(){var navbar=$(this),nav=$('ul.nav',navbar),collapseMode=navbar.hasClass('navbar-mode-collapse'),isMobile=$('html').hasClass('mobile')
|
||||
nav.verticalMenu($('a.menu-toggle',navbar),{breakpoint:collapseMode?Infinity:769})
|
||||
$('li.with-tooltip:not(.active) > a',navbar).tooltip({container:'body',placement:'bottom',template:'<div class="tooltip mainmenu-tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'}).on('show.bs.tooltip',function(e){if(isMobile)e.preventDefault()})
|
||||
var dragScroll=$('[data-control=toolbar]',navbar).data('oc.dragScroll')
|
||||
if(dragScroll){dragScroll.goToElement($('ul.nav > li.active',navbar),undefined,{'duration':0})}})})})(jQuery);+function($){"use strict";if($.wn===undefined)$.wn={}
|
||||
if($.oc===undefined)$.oc=$.wn
|
||||
var SideNav=function(element,options){this.options=options
|
||||
this.$el=$(element)
|
||||
this.$list=$('ul',this.$el)
|
||||
this.$items=$('li',this.$list)
|
||||
this.init();}
|
||||
SideNav.DEFAULTS={activeClass:'active'}
|
||||
SideNav.prototype.init=function(){var self=this
|
||||
this.$list.dragScroll({vertical:true,useNative:true,start:function(){self.$list.addClass('drag')},stop:function(){self.$list.removeClass('drag')},scrollClassContainer:self.$el,scrollMarkerContainer:self.$el})
|
||||
this.$list.on('click',function(){if(self.$list.hasClass('drag')){return false}})}
|
||||
SideNav.prototype.unsetActiveItem=function(itemId){this.$items.removeClass(this.options.activeClass)}
|
||||
SideNav.prototype.setActiveItem=function(itemId){if(!itemId){return}this.$items.removeClass(this.options.activeClass).filter('[data-menu-item='+itemId+']').addClass(this.options.activeClass)}
|
||||
SideNav.prototype.setCounter=function(itemId,value){var $counter=$('span.counter[data-menu-id="'+itemId+'"]',this.$el)
|
||||
$counter.removeClass('empty')
|
||||
$counter.toggleClass('empty',value==0)
|
||||
$counter.text(value)
|
||||
return this}
|
||||
SideNav.prototype.increaseCounter=function(itemId,value){var $counter=$('span.counter[data-menu-id="'+itemId+'"]',this.$el)
|
||||
var originalValue=parseInt($counter.text())
|
||||
if(isNaN(originalValue))originalValue=0
|
||||
var newValue=value+originalValue
|
||||
$counter.toggleClass('empty',newValue==0)
|
||||
$counter.text(newValue)
|
||||
return this}
|
||||
SideNav.prototype.dropCounter=function(itemId){this.setCounter(itemId,0)
|
||||
return this}
|
||||
var old=$.fn.sideNav
|
||||
$.fn.sideNav=function(option){var args=Array.prototype.slice.call(arguments,1),result
|
||||
this.each(function(){var $this=$(this)
|
||||
var data=$this.data('oc.sideNav')
|
||||
var options=$.extend({},SideNav.DEFAULTS,$this.data(),typeof option=='object'&&option)
|
||||
if(!data)$this.data('oc.sideNav',(data=new SideNav(this,options)))
|
||||
if(typeof option=='string')result=data[option].apply(data,args)
|
||||
if(typeof result!='undefined')return false
|
||||
if($.wn.sideNav===undefined)$.wn.sideNav=data})
|
||||
return result?result:this}
|
||||
$.fn.sideNav.Constructor=SideNav
|
||||
$.fn.sideNav.noConflict=function(){$.fn.sideNav=old
|
||||
return this}
|
||||
$(document).ready(function(){$('[data-control="sidenav"]').sideNav()})}(window.jQuery);+function($){"use strict";var Base=$.wn.foundation.base,BaseProto=Base.prototype
|
||||
var Scrollbar=function(element,options){var $el=this.$el=$(element),el=$el.get(0),self=this,options=this.options=options||{},sizeName=this.sizeName=options.vertical?'height':'width',isNative=$('html').hasClass('mobile'),isTouch=this.isTouch=Modernizr.touchevents,isScrollable=this.isScrollable=false,isLocked=this.isLocked=false,eventElementName=options.vertical?'pageY':'pageX',dragStart=0,startOffset=0;$.wn.foundation.controlUtils.markDisposable(element)
|
||||
Base.call(this)
|
||||
this.$el.one('dispose-control',this.proxy(this.dispose))
|
||||
if(isNative){return}this.$scrollbar=$('<div />').addClass('scrollbar-scrollbar')
|
||||
this.$track=$('<div />').addClass('scrollbar-track').appendTo(this.$scrollbar)
|
||||
this.$thumb=$('<div />').addClass('scrollbar-thumb').appendTo(this.$track)
|
||||
$el.addClass('drag-scrollbar').addClass(options.vertical?'vertical':'horizontal').prepend(this.$scrollbar)
|
||||
if(isTouch){this.$el.on('touchstart',function(event){var touchEvent=event.originalEvent;if(touchEvent.touches.length==1){startDrag(touchEvent.touches[0])
|
||||
event.stopPropagation()}})}else{this.$thumb.on('mousedown',function(event){startDrag(event)})
|
||||
this.$track.on('mouseup',function(event){moveDrag(event)})}$el.mousewheel(function(event){var offset=self.options.vertical?((event.deltaFactor*event.deltaY)*-1):(event.deltaFactor*event.deltaX)
|
||||
return!scrollWheel(offset*self.options.scrollSpeed)})
|
||||
$el.on('oc.scrollbar.gotoStart',function(event){self.options.vertical?$el.scrollTop(0):$el.scrollLeft(0)
|
||||
self.update()
|
||||
event.stopPropagation()})
|
||||
$(window).on('resize',$.proxy(this.update,this))
|
||||
$(window).on('oc.updateUi',$.proxy(this.update,this))
|
||||
function startDrag(event){$('body').addClass('drag-noselect')
|
||||
$el.trigger('oc.scrollStart')
|
||||
dragStart=event[eventElementName]
|
||||
startOffset=self.options.vertical?$el.scrollTop():$el.scrollLeft()
|
||||
if(isTouch){$(window).on('touchmove.scrollbar',function(event){var touchEvent=event.originalEvent
|
||||
if(moveDrag(touchEvent.touches[0]))event.preventDefault();});$el.on('touchend.scrollbar',stopDrag)}else{$(window).on('mousemove.scrollbar',function(event){moveDrag(event)
|
||||
return false})
|
||||
$(window).on('mouseup.scrollbar',function(){stopDrag()
|
||||
return false})}}function moveDrag(event){self.isLocked=true;var offset,dragTo=event[eventElementName]
|
||||
if(self.isTouch){offset=dragStart-dragTo}else{var ratio=self.getCanvasSize()/self.getViewportSize()
|
||||
offset=(dragTo-dragStart)*ratio}self.options.vertical?$el.scrollTop(startOffset+offset):$el.scrollLeft(startOffset+offset)
|
||||
self.setThumbPosition()
|
||||
return self.options.vertical?el.scrollTop!=startOffset:el.scrollLeft!=startOffset}function stopDrag(){$('body').removeClass('drag-noselect')
|
||||
$el.trigger('oc.scrollEnd')
|
||||
$(window).off('.scrollbar')}var isWebkit=$(document.documentElement).hasClass('webkit')
|
||||
function scrollWheel(offset){startOffset=self.options.vertical?el.scrollTop:el.scrollLeft
|
||||
$el.trigger('oc.scrollStart')
|
||||
self.options.vertical?$el.scrollTop(startOffset+offset):$el.scrollLeft(startOffset+offset)
|
||||
var scrolled=self.options.vertical?el.scrollTop!=startOffset:el.scrollLeft!=startOffset
|
||||
self.setThumbPosition()
|
||||
if(!isWebkit){if(self.endScrollTimeout!==undefined){clearTimeout(self.endScrollTimeout)
|
||||
self.endScrollTimeout=undefined}self.endScrollTimeout=setTimeout(function(){$el.trigger('oc.scrollEnd')
|
||||
self.endScrollTimeout=undefined},50)}else{$el.trigger('oc.scrollEnd')}return scrolled}setTimeout(function(){self.update()},1);}
|
||||
Scrollbar.prototype=Object.create(BaseProto)
|
||||
Scrollbar.prototype.constructor=Scrollbar
|
||||
Scrollbar.prototype.dispose=function(){this.unregisterHandlers()
|
||||
BaseProto.dispose.call(this)}
|
||||
Scrollbar.prototype.unregisterHandlers=function(){}
|
||||
Scrollbar.DEFAULTS={vertical:true,scrollSpeed:2,animation:true,start:function(){},drag:function(){},stop:function(){}}
|
||||
Scrollbar.prototype.update=function(){if(!this.$scrollbar)return
|
||||
this.$scrollbar.hide()
|
||||
this.setThumbSize()
|
||||
this.setThumbPosition()
|
||||
this.$scrollbar.show()}
|
||||
Scrollbar.prototype.setThumbSize=function(){var properties=this.calculateProperties()
|
||||
this.isScrollable=!(properties.thumbSizeRatio>=1);this.$scrollbar.toggleClass('disabled',!this.isScrollable)
|
||||
if(this.options.vertical){this.$track.height(properties.canvasSize)
|
||||
this.$thumb.height(properties.thumbSize)}else{this.$track.width(properties.canvasSize)
|
||||
this.$thumb.width(properties.thumbSize)}}
|
||||
Scrollbar.prototype.setThumbPosition=function(){var properties=this.calculateProperties()
|
||||
if(this.options.vertical)this.$thumb.css({top:properties.thumbPosition})
|
||||
else this.$thumb.css({left:properties.thumbPosition})}
|
||||
Scrollbar.prototype.calculateProperties=function(){var $el=this.$el,properties={};properties.viewportSize=this.getViewportSize()
|
||||
properties.canvasSize=this.getCanvasSize()
|
||||
properties.scrollAmount=(this.options.vertical)?$el.scrollTop():$el.scrollLeft()
|
||||
properties.thumbSizeRatio=properties.viewportSize/properties.canvasSize
|
||||
properties.thumbSize=properties.viewportSize*properties.thumbSizeRatio
|
||||
properties.thumbPositionRatio=properties.scrollAmount/(properties.canvasSize-properties.viewportSize)
|
||||
properties.thumbPosition=((properties.viewportSize-properties.thumbSize)*properties.thumbPositionRatio)+properties.scrollAmount
|
||||
if(isNaN(properties.thumbPosition))properties.thumbPosition=0
|
||||
return properties;}
|
||||
Scrollbar.prototype.getViewportSize=function(){return(this.options.vertical)?this.$el.height():this.$el.width();}
|
||||
Scrollbar.prototype.getCanvasSize=function(){return(this.options.vertical)?this.$el.get(0).scrollHeight:this.$el.get(0).scrollWidth;}
|
||||
Scrollbar.prototype.gotoElement=function(element,callback){var $el=$(element)
|
||||
if(!$el.length)return;var self=this,offset=0,animated=false,params={duration:300,queue:false,complete:function(){if(callback!==undefined)callback()}}
|
||||
if(!this.options.vertical){offset=$el.get(0).offsetLeft-this.$el.scrollLeft()
|
||||
if(offset<0){this.$el.animate({'scrollLeft':$el.get(0).offsetLeft},params)
|
||||
animated=true}else{offset=$el.get(0).offsetLeft+$el.outerWidth()-(this.$el.scrollLeft()+this.$el.outerWidth())
|
||||
if(offset>0){this.$el.animate({'scrollLeft':$el.get(0).offsetLeft+$el.outerWidth()-this.$el.outerWidth()},params)
|
||||
animated=true}}}else{offset=$el.get(0).offsetTop-this.$el.scrollTop()
|
||||
if(this.options.animation){if(offset<0){this.$el.animate({'scrollTop':$el.get(0).offsetTop},params)
|
||||
animated=true}else{offset=$el.get(0).offsetTop-(this.$el.scrollTop()+this.$el.outerHeight())
|
||||
if(offset>0){this.$el.animate({'scrollTop':$el.get(0).offsetTop+$el.outerHeight()-this.$el.outerHeight()},params)
|
||||
animated=true}}}else{if(offset<0){this.$el.scrollTop($el.get(0).offsetTop)}else{offset=$el.get(0).offsetTop-(this.$el.scrollTop()+this.$el.outerHeight())
|
||||
if(offset>0)this.$el.scrollTop($el.get(0).offsetTop+$el.outerHeight()-this.$el.outerHeight())}}}if(!animated&&callback!==undefined)callback()
|
||||
return this}
|
||||
Scrollbar.prototype.dispose=function(){this.$el=null
|
||||
this.$scrollbar=null
|
||||
this.$track=null
|
||||
this.$thumb=null}
|
||||
var old=$.fn.scrollbar
|
||||
$.fn.scrollbar=function(option){return this.each(function(){var $this=$(this)
|
||||
var data=$this.data('oc.scrollbar')
|
||||
var options=$.extend({},Scrollbar.DEFAULTS,$this.data(),typeof option=='object'&&option)
|
||||
if(!data)$this.data('oc.scrollbar',(data=new Scrollbar(this,options)))
|
||||
if(typeof option=='string')data[option].call($this)})}
|
||||
$.fn.scrollbar.Constructor=Scrollbar
|
||||
$.fn.scrollbar.noConflict=function(){$.fn.scrollbar=old
|
||||
return this}
|
||||
$(document).render(function(){$('[data-control=scrollbar]').scrollbar()})}(window.jQuery);+function($){"use strict";var FileList=function(element,options){this.options=options
|
||||
this.$el=$(element)
|
||||
this.init();}
|
||||
FileList.DEFAULTS={ignoreItemClick:false}
|
||||
FileList.prototype.init=function(){var self=this
|
||||
this.$el.on('click','li.group > h4 > a, li.group > div.group',function(){self.toggleGroup($(this).closest('li'))
|
||||
return false;});if(!this.options.ignoreItemClick){this.$el.on('click','li.item > a',function(event){var e=$.Event('open.oc.list',{relatedTarget:$(this).parent().get(0),clickEvent:event})
|
||||
self.$el.trigger(e,this)
|
||||
return false})}this.$el.on('ajaxUpdate',$.proxy(this.update,this))}
|
||||
FileList.prototype.toggleGroup=function(group){var $group=$(group);$group.attr('data-status')=='expanded'?this.collapseGroup($group):this.expandGroup($group)}
|
||||
FileList.prototype.collapseGroup=function(group){var $list=$('> ul, > div.subitems',group),self=this;$list.css('overflow','hidden')
|
||||
$list.animate({'height':0},{duration:100,queue:false,complete:function(){$list.css({'overflow':'visible','display':'none'})
|
||||
$(group).attr('data-status','collapsed')
|
||||
$(window).trigger('resize')}})
|
||||
this.sendGroupStatusRequest(group,0);}
|
||||
FileList.prototype.expandGroup=function(group){var $list=$('> ul, > div.subitems',group),self=this;$list.css({'overflow':'hidden','display':'block','height':0})
|
||||
$list.animate({'height':$list[0].scrollHeight},{duration:100,queue:false,complete:function(){$list.css({'overflow':'visible','height':'auto'})
|
||||
$(group).attr('data-status','expanded')
|
||||
$(window).trigger('resize')}})
|
||||
this.sendGroupStatusRequest(group,1);}
|
||||
FileList.prototype.sendGroupStatusRequest=function(group,status){if(this.options.groupStatusHandler!==undefined){var groupId=$(group).data('group-id')
|
||||
if(groupId===undefined)groupId=$('> h4 a',group).text();$(group).request(this.options.groupStatusHandler,{data:{group:groupId,status:status}})}}
|
||||
FileList.prototype.markActive=function(dataId){$('li.item',this.$el).removeClass('active')
|
||||
if(dataId)$('li.item[data-id="'+dataId+'"]',this.$el).addClass('active')
|
||||
this.dataId=dataId}
|
||||
FileList.prototype.update=function(){if(this.dataId!==undefined)this.markActive(this.dataId)}
|
||||
var old=$.fn.fileList
|
||||
$.fn.fileList=function(option){var args=arguments;return this.each(function(){var $this=$(this)
|
||||
var data=$this.data('oc.fileList')
|
||||
var options=$.extend({},FileList.DEFAULTS,$this.data(),typeof option=='object'&&option)
|
||||
if(!data)$this.data('oc.fileList',(data=new FileList(this,options)))
|
||||
if(typeof option=='string'){var methodArgs=[];for(var i=1;i<args.length;i++)methodArgs.push(args[i])
|
||||
data[option].apply(data,methodArgs)}})}
|
||||
$.fn.fileList.Constructor=FileList
|
||||
$.fn.fileList.noConflict=function(){$.fn.fileList=old
|
||||
return this}
|
||||
$(document).ready(function(){$('[data-control=filelist]').fileList()})}(window.jQuery);(function($){var WinterLayout=function(){this.$accountMenuOverlay=null}
|
||||
WinterLayout.prototype.setPageTitle=function(title){var $title=$('title')
|
||||
if(this.pageTitleTemplate===undefined)this.pageTitleTemplate=$title.data('titleTemplate')
|
||||
$title.text(this.pageTitleTemplate.replace('%s',title))}
|
||||
WinterLayout.prototype.updateLayout=function(title){var $children,$el,fixedWidth,margin
|
||||
$('[data-calculate-width]').each(function(){$children=$(this).children()
|
||||
if($children.length>0){fixedWidth=0
|
||||
$children.each(function(){$el=$(this)
|
||||
margin=$el.data('oc.layoutMargin')
|
||||
if(margin===undefined){margin=parseInt($el.css('marginRight'))+parseInt($el.css('marginLeft'))
|
||||
$el.data('oc.layoutMargin',margin)}fixedWidth+=$el.get(0).offsetWidth+margin})
|
||||
$(this).width(fixedWidth)
|
||||
$(this).trigger('oc.widthFixed')}})}
|
||||
WinterLayout.prototype.toggleAccountMenu=function(el){var self=this,$el=$(el),$parent=$(el).parent(),$menu=$el.next()
|
||||
$el.tooltip('hide')
|
||||
if($menu.hasClass('active')){self.$accountMenuOverlay.remove()
|
||||
$parent.removeClass('highlight')
|
||||
$menu.removeClass('active')}else{self.$accountMenuOverlay=$('<div />').addClass('popover-overlay')
|
||||
$(document.body).append(self.$accountMenuOverlay)
|
||||
$parent.addClass('highlight')
|
||||
$menu.addClass('active')
|
||||
self.$accountMenuOverlay.one('click',function(){self.$accountMenuOverlay.remove()
|
||||
$menu.removeClass('active')
|
||||
$parent.removeClass('highlight')})}}
|
||||
if($.wn===undefined)$.wn={}
|
||||
if($.oc===undefined)$.oc=$.wn
|
||||
$.wn.layout=new WinterLayout()
|
||||
$(document).ready(function(){$.wn.layout.updateLayout()
|
||||
window.setTimeout($.wn.layout.updateLayout,100)})
|
||||
$(window).on('resize',function(){$.wn.layout.updateLayout()})
|
||||
$(window).on('oc.updateUi',function(){$.wn.layout.updateLayout()})})(jQuery);+function($){"use strict";var SidePanelTab=function(element,options){this.options=options
|
||||
this.$el=$(element)
|
||||
this.init()}
|
||||
SidePanelTab.prototype.init=function(){var self=this
|
||||
this.tabOpenDelay=200
|
||||
this.tabOpenTimeout=undefined
|
||||
this.panelOpenTimeout=undefined
|
||||
this.$sideNav=$('#layout-sidenav')
|
||||
this.$sideNavItems=$('ul li',this.$sideNav)
|
||||
this.$sidePanelItems=$('[data-content-id]',this.$el)
|
||||
this.sideNavWidth=this.$sideNavItems.outerWidth()
|
||||
this.mainNavHeight=$('#layout-mainmenu').outerHeight()
|
||||
this.panelVisible=false
|
||||
this.visibleItemId=false
|
||||
this.$fixButton=$('<a href="#" class="fix-button"><i class="icon-thumb-tack"></i></a>')
|
||||
this.$fixButton.click(function(){self.fixPanel()
|
||||
return false})
|
||||
$('.fix-button-container',this.$el).append(this.$fixButton)
|
||||
this.$sideNavItems.click(function(){if($(this).data('no-side-panel')){return}if(Modernizr.touchevents&&$(window).width()<self.options.breakpoint){if($(this).data('menu-item')==self.visibleItemId&&self.panelVisible){self.hideSidePanel()
|
||||
return}else{self.displaySidePanel()}}self.displayTab(this)
|
||||
return false})
|
||||
if(!Modernizr.touchevents){self.$sideNav.mouseleave(function(){clearTimeout(self.panelOpenTimeout)})
|
||||
self.$el.mouseleave(function(){self.hideSidePanel()})
|
||||
self.$sideNavItems.mouseenter(function(){if($(window).width()<self.options.breakpoint||!self.panelFixed()){if($(this).data('no-side-panel')){self.hideSidePanel()
|
||||
return}var _this=this
|
||||
self.tabOpenTimeout=setTimeout(function(){self.displaySidePanel()
|
||||
self.displayTab(_this)},self.tabOpenDelay)}})
|
||||
self.$sideNavItems.mouseleave(function(){clearTimeout(self.tabOpenTimeout)})
|
||||
$(window).resize(function(){self.updatePanelPosition()
|
||||
self.updateActiveTab()})}else{$('#layout-body').click(function(){if(self.panelVisible){self.hideSidePanel()
|
||||
return false}})
|
||||
self.$el.on('close.oc.sidePanel',function(){self.hideSidePanel()})}this.updateActiveTab()}
|
||||
SidePanelTab.prototype.displayTab=function(menuItem){var menuItemId=$(menuItem).data('menu-item')
|
||||
this.visibleItemId=menuItemId
|
||||
if($.wn.sideNav!==undefined){$.wn.sideNav.setActiveItem(menuItemId)}this.$sidePanelItems.each(function(){var $el=$(this)
|
||||
$el.toggleClass('hide',$el.data('content-id')!=menuItemId)})
|
||||
$(window).trigger('resize')}
|
||||
SidePanelTab.prototype.displaySidePanel=function(){$(document.body).addClass('display-side-panel')
|
||||
this.$el.appendTo('#layout-canvas')
|
||||
this.panelVisible=true
|
||||
this.$el.css({left:this.sideNavWidth,top:this.mainNavHeight})
|
||||
this.updatePanelPosition()
|
||||
$(window).trigger('resize')}
|
||||
SidePanelTab.prototype.hideSidePanel=function(){$(document.body).removeClass('display-side-panel')
|
||||
if(this.$el.next('#layout-body').length==0){$('#layout-body').before(this.$el)}this.panelVisible=false
|
||||
this.updateActiveTab()}
|
||||
SidePanelTab.prototype.updatePanelPosition=function(){if(!this.panelFixed()||Modernizr.touchevents){this.$el.height($(document).height()-this.mainNavHeight)}else{this.$el.css('height','')}if(this.panelVisible&&$(window).width()>this.options.breakpoint&&this.panelFixed()){this.hideSidePanel()}}
|
||||
SidePanelTab.prototype.updateActiveTab=function(){if($.wn.sideNav===undefined){return}if(!this.panelVisible&&($(window).width()<this.options.breakpoint||!this.panelFixed())){$.wn.sideNav.unsetActiveItem()}else{$.wn.sideNav.setActiveItem(this.visibleItemId)}}
|
||||
SidePanelTab.prototype.panelFixed=function(){return!($(window).width()<this.options.breakpoint)&&!$(document.body).hasClass('side-panel-not-fixed')}
|
||||
SidePanelTab.prototype.fixPanel=function(){$(document.body).toggleClass('side-panel-not-fixed')
|
||||
var self=this
|
||||
window.setTimeout(function(){var fixed=self.panelFixed()
|
||||
if(fixed){self.updateActiveTab()
|
||||
$(document.body).addClass('side-panel-fix-shadow')}else{$(document.body).removeClass('side-panel-fix-shadow')
|
||||
self.hideSidePanel()}if(typeof(localStorage)!=='undefined')localStorage.ocSidePanelFixed=fixed?1:0},0)}
|
||||
SidePanelTab.DEFAULTS={breakpoint:769}
|
||||
var old=$.fn.sidePanelTab
|
||||
$.fn.sidePanelTab=function(option){return this.each(function(){var $this=$(this)
|
||||
var data=$this.data('oc.sidePanelTab')
|
||||
var options=$.extend({},SidePanelTab.DEFAULTS,$this.data(),typeof option=='object'&&option)
|
||||
if(!data)$this.data('oc.sidePanelTab',(data=new SidePanelTab(this,options)))
|
||||
if(typeof option=='string')data[option].call(data)})}
|
||||
$.fn.sidePanelTab.Constructor=SidePanelTab
|
||||
$.fn.sidePanelTab.noConflict=function(){$.fn.sidePanelTab=old
|
||||
return this}
|
||||
$(document).ready(function(){$('[data-control=layout-sidepanel]').sidePanelTab()})
|
||||
$(document).ready(function(){if(Modernizr.touchevents||(typeof(localStorage)!=='undefined')){if(localStorage.ocSidePanelFixed==0){$(document.body).addClass('side-panel-not-fixed')
|
||||
$(window).trigger('resize')}else if(localStorage.ocSidePanelFixed==1){$(document.body).removeClass('side-panel-not-fixed')
|
||||
$(window).trigger('resize')}}})}(window.jQuery);+function($){"use strict";var SimpleList=function(element,options){var $el=this.$el=$(element)
|
||||
this.options=options||{}
|
||||
if($el.hasClass('is-sortable')){var sortableOptions={distance:10}
|
||||
if(this.options.sortableHandle)sortableOptions[handle]=this.options.sortableHandle
|
||||
$el.find('> ul, > ol').sortable(sortableOptions)}if($el.hasClass('is-scrollable')){$el.wrapInner($('<div />').addClass('control-scrollbar'))
|
||||
var $scrollbar=$el.find('>.control-scrollbar:first')
|
||||
$scrollbar.scrollbar()}}
|
||||
SimpleList.DEFAULTS={sortableHandle:null}
|
||||
var old=$.fn.simplelist
|
||||
$.fn.simplelist=function(option){return this.each(function(){var $this=$(this)
|
||||
var data=$this.data('oc.simplelist')
|
||||
var options=$.extend({},SimpleList.DEFAULTS,$this.data(),typeof option=='object'&&option)
|
||||
if(!data)$this.data('oc.simplelist',(data=new SimpleList(this,options)))})}
|
||||
$.fn.simplelist.Constructor=SimpleList
|
||||
$.fn.simplelist.noConflict=function(){$.fn.simplelist=old
|
||||
return this}
|
||||
$(document).render(function(){$('[data-control="simplelist"]').simplelist()})}(window.jQuery);+function($){"use strict";var Base=$.wn.foundation.base,BaseProto=Base.prototype
|
||||
var TreeListWidget=function(element,options){this.$el=$(element)
|
||||
this.options=options||{};Base.call(this)
|
||||
$.wn.foundation.controlUtils.markDisposable(element)
|
||||
this.init()}
|
||||
TreeListWidget.prototype=Object.create(BaseProto)
|
||||
TreeListWidget.prototype.constructor=TreeListWidget
|
||||
TreeListWidget.prototype.init=function(){var sortableOptions={handle:this.options.handle,nested:this.options.nested,onDrop:this.proxy(this.onDrop),afterMove:this.proxy(this.onAfterMove)}
|
||||
this.$el.find('> ol').sortable($.extend(sortableOptions,this.options))
|
||||
if(!this.options.nested)this.$el.find('> ol ol').sortable($.extend(sortableOptions,this.options))
|
||||
this.$el.one('dispose-control',this.proxy(this.dispose))}
|
||||
TreeListWidget.prototype.dispose=function(){this.unbind()
|
||||
BaseProto.dispose.call(this)}
|
||||
TreeListWidget.prototype.unbind=function(){this.$el.off('dispose-control',this.proxy(this.dispose))
|
||||
this.$el.find('> ol').sortable('destroy')
|
||||
if(!this.options.nested){this.$el.find('> ol ol').sortable('destroy')}this.$el.removeData('oc.treelist')
|
||||
this.$el=null
|
||||
this.options=null}
|
||||
TreeListWidget.DEFAULTS={handle:null,nested:true}
|
||||
TreeListWidget.prototype.onDrop=function($item,container,_super){if(!this.$el){return}this.$el.trigger('move.oc.treelist',{item:$item,container:container})
|
||||
_super($item,container)}
|
||||
TreeListWidget.prototype.onAfterMove=function($placeholder,container,$closestEl){if(!this.$el){return}this.$el.trigger('aftermove.oc.treelist',{placeholder:$placeholder,container:container,closestEl:$closestEl})}
|
||||
var old=$.fn.treeListWidget
|
||||
$.fn.treeListWidget=function(option){var args=arguments,result
|
||||
this.each(function(){var $this=$(this)
|
||||
var data=$this.data('oc.treelist')
|
||||
var options=$.extend({},TreeListWidget.DEFAULTS,$this.data(),typeof option=='object'&&option)
|
||||
if(!data)$this.data('oc.treelist',(data=new TreeListWidget(this,options)))
|
||||
if(typeof option=='string')result=data[option].call(data)
|
||||
if(typeof result!='undefined')return false})
|
||||
return result?result:this}
|
||||
$.fn.treeListWidget.Constructor=TreeListWidget
|
||||
$.fn.treeListWidget.noConflict=function(){$.fn.treeListWidget=old
|
||||
return this}
|
||||
$(document).render(function(){$('[data-control="treelist"]').treeListWidget();})}(window.jQuery);+function($){"use strict";var SidenavTree=function(element,options){this.options=options
|
||||
this.$el=$(element)
|
||||
this.init()}
|
||||
SidenavTree.DEFAULTS={treeName:'sidenav_tree'}
|
||||
SidenavTree.prototype.init=function(){var self=this
|
||||
$(document.body).addClass('has-sidenav-tree')
|
||||
this.statusCookieName=this.options.treeName+'groupStatus'
|
||||
this.searchCookieName=this.options.treeName+'search'
|
||||
this.$searchInput=$(this.options.searchInput)
|
||||
this.$el.on('click','li > div.group',function(){self.toggleGroup($(this).closest('li'))
|
||||
return false})
|
||||
this.$searchInput.on('input',function(){self.handleSearchChange()})
|
||||
var searchTerm=$.cookie(this.searchCookieName)
|
||||
if(searchTerm!==undefined&&searchTerm.length>0){this.$searchInput.val(searchTerm)
|
||||
this.applySearch()}var scrollbar=$('[data-control=scrollbar]',this.$el).data('oc.scrollbar'),active=$('li.active',this.$el)
|
||||
if(active.length>0){scrollbar.gotoElement(active)}}
|
||||
SidenavTree.prototype.toggleGroup=function(group){var $group=$(group),status=$group.attr('data-status')
|
||||
status===undefined||status=='expanded'?this.collapseGroup($group):this.expandGroup($group)}
|
||||
SidenavTree.prototype.collapseGroup=function(group){var $list=$('> ul',group),self=this
|
||||
$list.css('overflow','hidden')
|
||||
$list.animate({'height':0},{duration:100,queue:false,complete:function(){$list.css({'overflow':'visible','display':'none'})
|
||||
$(group).attr('data-status','collapsed')
|
||||
$(window).trigger('oc.updateUi')
|
||||
self.saveGroupStatus($(group).data('group-code'),true)}})}
|
||||
SidenavTree.prototype.expandGroup=function(group,duration){var $list=$('> ul',group),self=this
|
||||
duration=duration===undefined?100:duration
|
||||
$list.css({'overflow':'hidden','height':0})
|
||||
$list.animate({'height':$list[0].scrollHeight},{duration:duration,queue:false,complete:function(){$list.css({'overflow':'visible','height':'auto','display':''})
|
||||
$(group).attr('data-status','expanded')
|
||||
$(window).trigger('oc.updateUi')
|
||||
self.saveGroupStatus($(group).data('group-code'),false)}})}
|
||||
SidenavTree.prototype.saveGroupStatus=function(groupCode,collapsed){var collapsedGroups=$.cookie(this.statusCookieName),updatedGroups=[]
|
||||
if(collapsedGroups===undefined){collapsedGroups=''}collapsedGroups=collapsedGroups.split('|')
|
||||
$.each(collapsedGroups,function(){if(groupCode!=this)updatedGroups.push(this)})
|
||||
if(collapsed){updatedGroups.push(groupCode)}$.cookie(this.statusCookieName,updatedGroups.join('|'),{expires:30,path:'/'})}
|
||||
SidenavTree.prototype.handleSearchChange=function(){var lastValue=this.$searchInput.data('oc.lastvalue');if(lastValue!==undefined&&lastValue==this.$searchInput.val()){return}this.$searchInput.data('oc.lastvalue',this.$searchInput.val())
|
||||
if(this.dataTrackInputTimer!==undefined){window.clearTimeout(this.dataTrackInputTimer)}var self=this
|
||||
this.dataTrackInputTimer=window.setTimeout(function(){self.applySearch()},300);$.cookie(this.searchCookieName,$.trim(this.$searchInput.val()),{expires:30,path:'/'})}
|
||||
SidenavTree.prototype.applySearch=function(){var query=$.trim(this.$searchInput.val()),words=query.toLowerCase().split(' '),visibleGroups=[],visibleItems=[],self=this
|
||||
if(query.length==0){$('li',this.$el).removeClass('hidden')
|
||||
return}$('ul.top-level > li',this.$el).each(function(){var $li=$(this)
|
||||
if(self.textContainsWords($('div.group h3',$li).text(),words)){visibleGroups.push($li.get(0))
|
||||
$('ul li',$li).each(function(){visibleItems.push(this)})}else{$('ul li',$li).each(function(){if(self.textContainsWords($(this).text(),words)||self.textContainsWords($(this).data('keywords'),words)){visibleGroups.push($li.get(0))
|
||||
visibleItems.push(this)}})}})
|
||||
$('ul.top-level > li',this.$el).each(function(){var $li=$(this),groupIsVisible=$.inArray(this,visibleGroups)!==-1
|
||||
$li.toggleClass('hidden',!groupIsVisible)
|
||||
if(groupIsVisible)self.expandGroup($li,0)
|
||||
$('ul li',$li).each(function(){var $itemLi=$(this)
|
||||
$itemLi.toggleClass('hidden',$.inArray(this,visibleItems)==-1)})})
|
||||
return false}
|
||||
SidenavTree.prototype.textContainsWords=function(text,words){text=text.toLowerCase()
|
||||
for(var i=0;i<words.length;i++){if(text.indexOf(words[i])===-1)return false}return true}
|
||||
var old=$.fn.sidenavTree
|
||||
$.fn.sidenavTree=function(option){var args=arguments;return this.each(function(){var $this=$(this)
|
||||
var data=$this.data('oc.sidenavTree')
|
||||
var options=$.extend({},SidenavTree.DEFAULTS,$this.data(),typeof option=='object'&&option)
|
||||
if(!data)$this.data('oc.sidenavTree',(data=new SidenavTree(this,options)))
|
||||
if(typeof option=='string'){var methodArgs=[];for(var i=1;i<args.length;i++)methodArgs.push(args[i])
|
||||
data[option].apply(data,methodArgs)}})}
|
||||
$.fn.sidenavTree.Constructor=SidenavTree
|
||||
$.fn.sidenavTree.noConflict=function(){$.fn.sidenavTree=old
|
||||
return this}
|
||||
$(document).ready(function(){$('[data-control=sidenav-tree]').sidenavTree()})}(window.jQuery);+function($){"use strict";var Base=$.wn.foundation.base,BaseProto=Base.prototype
|
||||
var DateTimeConverter=function(element,options){this.$el=$(element)
|
||||
this.options=options||{}
|
||||
$.wn.foundation.controlUtils.markDisposable(element)
|
||||
Base.call(this)
|
||||
this.init()}
|
||||
DateTimeConverter.prototype=Object.create(BaseProto)
|
||||
DateTimeConverter.prototype.constructor=DateTimeConverter
|
||||
DateTimeConverter.prototype.init=function(){this.initDefaults()
|
||||
this.$el.text(this.getDateTimeValue())
|
||||
this.$el.one('dispose-control',this.proxy(this.dispose))}
|
||||
DateTimeConverter.prototype.initDefaults=function(){if(!this.options.timezone){this.options.timezone=$('meta[name="backend-timezone"]').attr('content')}if(!this.options.locale){this.options.locale=$('meta[name="backend-locale"]').attr('content')}if(!this.options.format){this.options.format='llll'}if(this.options.formatAlias){this.options.format=this.getFormatFromAlias(this.options.formatAlias)}this.appTimezone=$('meta[name="app-timezone"]').attr('content')
|
||||
if(!this.appTimezone){this.appTimezone='UTC'}}
|
||||
DateTimeConverter.prototype.getDateTimeValue=function(){this.datetime=this.$el.attr('datetime')
|
||||
if(this.$el.get(0).hasAttribute('data-ignore-timezone')){this.appTimezone='UTC'
|
||||
this.options.timezone='UTC'}var momentObj=moment.tz(this.datetime,this.appTimezone),result
|
||||
if(this.options.locale){momentObj=momentObj.locale(this.options.locale)}if(this.options.timezone){momentObj=momentObj.tz(this.options.timezone)}if(this.options.timeSince){result=momentObj.fromNow()}else if(this.options.timeTense){result=momentObj.calendar()}else{result=momentObj.format(this.options.format)}return result}
|
||||
DateTimeConverter.prototype.getFormatFromAlias=function(alias){var map={time:'LT',timeLong:'LTS',date:'L',dateMin:'l',dateLong:'LL',dateLongMin:'ll',dateTime:'LLL',dateTimeMin:'lll',dateTimeLong:'LLLL',dateTimeLongMin:'llll'}
|
||||
return map[alias]?map[alias]:'llll'}
|
||||
DateTimeConverter.prototype.dispose=function(){this.$el.off('dispose-control',this.proxy(this.dispose))
|
||||
this.$el.removeData('oc.dateTimeConverter')
|
||||
this.$el=null
|
||||
this.options=null
|
||||
BaseProto.dispose.call(this)}
|
||||
DateTimeConverter.DEFAULTS={format:null,formatAlias:null,timezone:null,locale:null,timeTense:false,timeSince:false}
|
||||
var old=$.fn.dateTimeConverter
|
||||
$.fn.dateTimeConverter=function(option){var args=Array.prototype.slice.call(arguments,1),items,result
|
||||
items=this.each(function(){var $this=$(this)
|
||||
var data=$this.data('oc.dateTimeConverter')
|
||||
var options=$.extend({},DateTimeConverter.DEFAULTS,$this.data(),typeof option=='object'&&option)
|
||||
if(!data)$this.data('oc.dateTimeConverter',(data=new DateTimeConverter(this,options)))
|
||||
if(typeof option=='string')result=data[option].apply(data,args)
|
||||
if(typeof result!='undefined')return false})
|
||||
return result?result:items}
|
||||
$.fn.dateTimeConverter.Constructor=DateTimeConverter
|
||||
$.fn.dateTimeConverter.noConflict=function(){$.fn.dateTimeConverter=old
|
||||
return this}
|
||||
$(document).render(function(){$('time[data-datetime-control]').dateTimeConverter()})}(window.jQuery);if($.wn===undefined)$.wn={}
|
||||
if($.oc===undefined)$.oc=$.wn
|
||||
$.wn.backendUrl=function(url){var backendBasePath=$('meta[name="backend-base-path"]').attr('content')
|
||||
if(!backendBasePath)return url
|
||||
if(url.substr(0,1)=='/')url=url.substr(1)
|
||||
return backendBasePath+'/'+url}
|
||||
if($.wn===undefined)$.wn={}
|
||||
if($.oc===undefined)$.oc=$.wn
|
||||
$.wn.escapeHtmlString=function(string){var htmlEscapes={'&':'&','<':'<','>':'>','"':'"',"'":''','/':'/'},htmlEscaper=/[&<>"'\/]/g
|
||||
return(''+string).replace(htmlEscaper,function(match){return htmlEscapes[match];})}
|
||||
if(!!window.MSInputMethodContext&&!!document.documentMode){$(window).on('resize',function(){fixMediaManager()
|
||||
fixSidebar()})
|
||||
function fixMediaManager(){var $el=$('div[data-control="media-manager"] .control-scrollpad')
|
||||
$el.height($el.parent().height())}function fixSidebar(){$('#layout-sidenav').height(Math.max($('#layout-body').innerHeight(),$(window).height()-$('#layout-mainmenu').height()))}}
|
||||
92
modules/backend/assets/js/winter.alert.js
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Alerts
|
||||
*
|
||||
* Displays alert and confirmation dialogs
|
||||
*
|
||||
* JavaScript API:
|
||||
* $.wn.alert()
|
||||
* $.wn.confirm()
|
||||
*
|
||||
* Dependences:
|
||||
* - Sweet Alert
|
||||
* - Translations (winter.lang.js)
|
||||
*/
|
||||
(function($){
|
||||
|
||||
if ($.wn === undefined)
|
||||
$.wn = {}
|
||||
if ($.oc === undefined)
|
||||
$.oc = $.wn
|
||||
|
||||
$.wn.alert = function alert(message) {
|
||||
swal({
|
||||
title: message,
|
||||
confirmButtonClass: 'btn-primary'
|
||||
})
|
||||
}
|
||||
|
||||
$.wn.confirm = function confirm(message, callback) {
|
||||
|
||||
swal({
|
||||
title: message,
|
||||
showCancelButton: true,
|
||||
confirmButtonClass: 'btn-primary'
|
||||
}, callback)
|
||||
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
|
||||
/*
|
||||
* Implement alerts with AJAX framework
|
||||
*/
|
||||
|
||||
$(window).on('ajaxErrorMessage', function(event, message){
|
||||
if (!message) return
|
||||
|
||||
$.wn.alert(message)
|
||||
|
||||
// Prevent the default alert() message
|
||||
event.preventDefault()
|
||||
})
|
||||
|
||||
$(window).on('ajaxConfirmMessage', function(event, message){
|
||||
if (!message) return
|
||||
|
||||
$.wn.confirm(message, function(isConfirm){
|
||||
isConfirm
|
||||
? event.promise.resolve()
|
||||
: event.promise.reject()
|
||||
})
|
||||
|
||||
// Prevent the default confirm() message
|
||||
event.preventDefault()
|
||||
return true
|
||||
})
|
||||
|
||||
/*
|
||||
* Override "Sweet Alert" functions to translate default buttons
|
||||
*/
|
||||
|
||||
$(document).ready(function(){
|
||||
if (!window.swal) return
|
||||
|
||||
var swal = window.swal
|
||||
|
||||
window.sweetAlert = window.swal = function(message, callback) {
|
||||
if (typeof message === 'object') {
|
||||
// Do not override if texts are provided
|
||||
message.confirmButtonText = message.confirmButtonText || $.wn.lang.get('alert.confirm_button_text')
|
||||
message.cancelButtonText = message.cancelButtonText || $.wn.lang.get('alert.cancel_button_text')
|
||||
}
|
||||
else {
|
||||
message = {
|
||||
title: message,
|
||||
confirmButtonText: $.wn.lang.get('alert.confirm_button_text'),
|
||||
cancelButtonText: $.wn.lang.get('alert.cancel_button_text')
|
||||
}
|
||||
}
|
||||
|
||||
swal(message, callback)
|
||||
}
|
||||
})
|
||||
175
modules/backend/assets/js/winter.datetime.js
Normal file
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Date time converter.
|
||||
* See moment.js for format options.
|
||||
* http://momentjs.com/docs/#/displaying/format/
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* <time
|
||||
* data-datetime-control
|
||||
* datetime="2014-11-19 01:21:57"
|
||||
* data-format="dddd Do [o]f MMMM YYYY hh:mm:ss A"
|
||||
* data-timezone="Australia/Sydney"
|
||||
* data-locale="en-au">This text will be replaced</time>
|
||||
*
|
||||
* Alias options:
|
||||
*
|
||||
* time -> 6:28 AM
|
||||
* timeLong -> 6:28:01 AM
|
||||
* date -> 04/23/2016
|
||||
* dateMin -> 4/23/2016
|
||||
* dateLong -> April 23, 2016
|
||||
* dateLongMin -> Apr 23, 2016
|
||||
* dateTime -> April 23, 2016 6:28 AM
|
||||
* dateTimeMin -> Apr 23, 2016 6:28 AM
|
||||
* dateTimeLong -> Saturday, April 23, 2016 6:28 AM
|
||||
* dateTimeLongMin -> Sat, Apr 23, 2016 6:29 AM
|
||||
*
|
||||
*/
|
||||
+function ($) { "use strict";
|
||||
var Base = $.wn.foundation.base,
|
||||
BaseProto = Base.prototype
|
||||
|
||||
var DateTimeConverter = function (element, options) {
|
||||
this.$el = $(element)
|
||||
this.options = options || {}
|
||||
|
||||
$.wn.foundation.controlUtils.markDisposable(element)
|
||||
Base.call(this)
|
||||
this.init()
|
||||
}
|
||||
|
||||
DateTimeConverter.prototype = Object.create(BaseProto)
|
||||
DateTimeConverter.prototype.constructor = DateTimeConverter
|
||||
|
||||
DateTimeConverter.prototype.init = function() {
|
||||
this.initDefaults()
|
||||
|
||||
this.$el.text(this.getDateTimeValue())
|
||||
|
||||
this.$el.one('dispose-control', this.proxy(this.dispose))
|
||||
}
|
||||
|
||||
DateTimeConverter.prototype.initDefaults = function() {
|
||||
if (!this.options.timezone) {
|
||||
this.options.timezone = $('meta[name="backend-timezone"]').attr('content')
|
||||
}
|
||||
|
||||
if (!this.options.locale) {
|
||||
this.options.locale = $('meta[name="backend-locale"]').attr('content')
|
||||
}
|
||||
|
||||
if (!this.options.format) {
|
||||
this.options.format = 'llll'
|
||||
}
|
||||
|
||||
if (this.options.formatAlias) {
|
||||
this.options.format = this.getFormatFromAlias(this.options.formatAlias)
|
||||
}
|
||||
|
||||
this.appTimezone = $('meta[name="app-timezone"]').attr('content')
|
||||
if (!this.appTimezone) {
|
||||
this.appTimezone = 'UTC'
|
||||
}
|
||||
}
|
||||
|
||||
DateTimeConverter.prototype.getDateTimeValue = function() {
|
||||
this.datetime = this.$el.attr('datetime')
|
||||
|
||||
if (this.$el.get(0).hasAttribute('data-ignore-timezone')) {
|
||||
this.appTimezone = 'UTC'
|
||||
this.options.timezone = 'UTC'
|
||||
}
|
||||
|
||||
var momentObj = moment.tz(this.datetime, this.appTimezone),
|
||||
result
|
||||
|
||||
if (this.options.locale) {
|
||||
momentObj = momentObj.locale(this.options.locale)
|
||||
}
|
||||
|
||||
if (this.options.timezone) {
|
||||
momentObj = momentObj.tz(this.options.timezone)
|
||||
}
|
||||
|
||||
if (this.options.timeSince) {
|
||||
result = momentObj.fromNow()
|
||||
}
|
||||
else if (this.options.timeTense) {
|
||||
result = momentObj.calendar()
|
||||
}
|
||||
else {
|
||||
result = momentObj.format(this.options.format)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
DateTimeConverter.prototype.getFormatFromAlias = function(alias) {
|
||||
var map = {
|
||||
time: 'LT',
|
||||
timeLong: 'LTS',
|
||||
date: 'L',
|
||||
dateMin: 'l',
|
||||
dateLong: 'LL',
|
||||
dateLongMin: 'll',
|
||||
dateTime: 'LLL',
|
||||
dateTimeMin: 'lll',
|
||||
dateTimeLong: 'LLLL',
|
||||
dateTimeLongMin: 'llll'
|
||||
}
|
||||
|
||||
return map[alias] ? map[alias] : 'llll'
|
||||
}
|
||||
|
||||
DateTimeConverter.prototype.dispose = function() {
|
||||
this.$el.off('dispose-control', this.proxy(this.dispose))
|
||||
this.$el.removeData('oc.dateTimeConverter')
|
||||
|
||||
this.$el = null
|
||||
this.options = null
|
||||
|
||||
BaseProto.dispose.call(this)
|
||||
}
|
||||
|
||||
DateTimeConverter.DEFAULTS = {
|
||||
format: null,
|
||||
formatAlias: null,
|
||||
timezone: null,
|
||||
locale: null,
|
||||
timeTense: false,
|
||||
timeSince: false
|
||||
}
|
||||
|
||||
// PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.dateTimeConverter
|
||||
|
||||
$.fn.dateTimeConverter = function (option) {
|
||||
var args = Array.prototype.slice.call(arguments, 1), items, result
|
||||
|
||||
items = this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.dateTimeConverter')
|
||||
var options = $.extend({}, DateTimeConverter.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('oc.dateTimeConverter', (data = new DateTimeConverter(this, options)))
|
||||
if (typeof option == 'string') result = data[option].apply(data, args)
|
||||
if (typeof result != 'undefined') return false
|
||||
})
|
||||
|
||||
return result ? result : items
|
||||
}
|
||||
|
||||
$.fn.dateTimeConverter.Constructor = DateTimeConverter
|
||||
|
||||
$.fn.dateTimeConverter.noConflict = function () {
|
||||
$.fn.dateTimeConverter = old
|
||||
return this
|
||||
}
|
||||
|
||||
$(document).render(function (){
|
||||
$('time[data-datetime-control]').dateTimeConverter()
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
169
modules/backend/assets/js/winter.filelist.js
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* File List
|
||||
*
|
||||
* Creates a tree list of clickable folders and files.
|
||||
*
|
||||
* Data attributes:
|
||||
* - data-control="filelist" - enables the file list plugin
|
||||
* - data-group-status-handler - AJAX handler to execute when a group is collapsed or expanded by a user
|
||||
*
|
||||
* JavaScript API:
|
||||
* $('#list').fileList()
|
||||
*
|
||||
* Events
|
||||
* - open.oc.list - this event is triggered on the list element when an item is clicked.
|
||||
*
|
||||
* Dependences:
|
||||
* - Null
|
||||
*/
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// FILELIST CLASS DEFINITION
|
||||
// ============================
|
||||
|
||||
var FileList = function(element, options) {
|
||||
this.options = options
|
||||
this.$el = $(element)
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
FileList.DEFAULTS = {
|
||||
ignoreItemClick: false
|
||||
}
|
||||
|
||||
FileList.prototype.init = function (){
|
||||
var self = this
|
||||
|
||||
this.$el.on('click', 'li.group > h4 > a, li.group > div.group', function() {
|
||||
self.toggleGroup($(this).closest('li'))
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
if (!this.options.ignoreItemClick) {
|
||||
this.$el.on('click', 'li.item > a', function(event) {
|
||||
var e = $.Event('open.oc.list', {relatedTarget: $(this).parent().get(0), clickEvent: event})
|
||||
self.$el.trigger(e, this)
|
||||
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
this.$el.on('ajaxUpdate', $.proxy(this.update, this))
|
||||
}
|
||||
|
||||
FileList.prototype.toggleGroup = function(group) {
|
||||
var $group = $(group);
|
||||
|
||||
$group.attr('data-status') == 'expanded' ?
|
||||
this.collapseGroup($group) :
|
||||
this.expandGroup($group)
|
||||
}
|
||||
|
||||
FileList.prototype.collapseGroup = function(group) {
|
||||
var
|
||||
$list = $('> ul, > div.subitems', group),
|
||||
self = this;
|
||||
|
||||
$list.css('overflow', 'hidden')
|
||||
$list.animate({'height': 0}, { duration: 100, queue: false, complete: function() {
|
||||
$list.css({
|
||||
'overflow': 'visible',
|
||||
'display': 'none'
|
||||
})
|
||||
$(group).attr('data-status', 'collapsed')
|
||||
$(window).trigger('resize')
|
||||
} })
|
||||
|
||||
this.sendGroupStatusRequest(group, 0);
|
||||
}
|
||||
|
||||
FileList.prototype.expandGroup = function(group) {
|
||||
var
|
||||
$list = $('> ul, > div.subitems', group),
|
||||
self = this;
|
||||
|
||||
$list.css({
|
||||
'overflow': 'hidden',
|
||||
'display': 'block',
|
||||
'height': 0
|
||||
})
|
||||
$list.animate({'height': $list[0].scrollHeight}, { duration: 100, queue: false, complete: function() {
|
||||
$list.css({
|
||||
'overflow': 'visible',
|
||||
'height': 'auto'
|
||||
})
|
||||
$(group).attr('data-status', 'expanded')
|
||||
$(window).trigger('resize')
|
||||
} })
|
||||
|
||||
this.sendGroupStatusRequest(group, 1);
|
||||
}
|
||||
|
||||
FileList.prototype.sendGroupStatusRequest = function(group, status) {
|
||||
if (this.options.groupStatusHandler !== undefined) {
|
||||
var groupId = $(group).data('group-id')
|
||||
if (groupId === undefined)
|
||||
groupId = $('> h4 a', group).text();
|
||||
|
||||
$(group).request(this.options.groupStatusHandler, {data: {group: groupId, status: status}})
|
||||
}
|
||||
}
|
||||
|
||||
FileList.prototype.markActive = function(dataId) {
|
||||
$('li.item', this.$el).removeClass('active')
|
||||
if (dataId)
|
||||
$('li.item[data-id="'+dataId+'"]', this.$el).addClass('active')
|
||||
|
||||
this.dataId = dataId
|
||||
}
|
||||
|
||||
FileList.prototype.update = function() {
|
||||
if (this.dataId !== undefined)
|
||||
this.markActive(this.dataId)
|
||||
}
|
||||
|
||||
// FILELIST PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.fileList
|
||||
|
||||
$.fn.fileList = function (option) {
|
||||
var args = arguments;
|
||||
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.fileList')
|
||||
var options = $.extend({}, FileList.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
|
||||
if (!data) $this.data('oc.fileList', (data = new FileList(this, options)))
|
||||
if (typeof option == 'string') {
|
||||
var methodArgs = [];
|
||||
for (var i=1; i<args.length; i++)
|
||||
methodArgs.push(args[i])
|
||||
|
||||
data[option].apply(data, methodArgs)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.fileList.Constructor = FileList
|
||||
|
||||
// FILELIST NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.fileList.noConflict = function () {
|
||||
$.fn.fileList = old
|
||||
return this
|
||||
}
|
||||
|
||||
// FILELIST DATA-API
|
||||
// ===============
|
||||
|
||||
$(document).ready(function () {
|
||||
$('[data-control=filelist]').fileList()
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
224
modules/backend/assets/js/winter.flyout.js
Normal file
@@ -0,0 +1,224 @@
|
||||
/*
|
||||
* Flyout plugin.
|
||||
*/
|
||||
+function ($) { "use strict";
|
||||
|
||||
var Base = $.wn.foundation.base,
|
||||
BaseProto = Base.prototype
|
||||
|
||||
// SCROLLPAD CLASS DEFINITION
|
||||
// ============================
|
||||
|
||||
var Flyout = function(element, options) {
|
||||
this.$el = $(element)
|
||||
this.$overlay = null
|
||||
this.options = options
|
||||
|
||||
Base.call(this)
|
||||
|
||||
this.init()
|
||||
}
|
||||
|
||||
Flyout.prototype = Object.create(BaseProto)
|
||||
Flyout.prototype.constructor = Flyout
|
||||
|
||||
Flyout.prototype.dispose = function() {
|
||||
this.removeOverlay()
|
||||
this.$el.removeData('oc.flyout')
|
||||
this.$el = null
|
||||
|
||||
if (this.options.flyoutToggle) {
|
||||
this.removeToggle()
|
||||
}
|
||||
|
||||
BaseProto.dispose.call(this)
|
||||
}
|
||||
|
||||
Flyout.prototype.show = function() {
|
||||
var $cells = this.$el.find('> .layout-cell'),
|
||||
$flyout = this.$el.find('> .flyout')
|
||||
|
||||
$('[data-control=layout-sidepanel]').sidePanelTab('hideSidePanel')
|
||||
|
||||
this.removeOverlay()
|
||||
|
||||
for (var i = 0; i < $cells.length; i++) {
|
||||
var $cell = $($cells[i]),
|
||||
width = $cell.width()
|
||||
|
||||
$cell.css('width', width)
|
||||
}
|
||||
|
||||
this.createOverlay()
|
||||
|
||||
window.setTimeout(this.proxy(this.setBodyClass), 1)
|
||||
$flyout.css('width', this.options.flyoutWidth)
|
||||
|
||||
this.hideToggle()
|
||||
}
|
||||
|
||||
Flyout.prototype.hide = function() {
|
||||
var $cells = this.$el.find('> .layout-cell'),
|
||||
$flyout = this.$el.find('> .flyout')
|
||||
|
||||
for (var i = 0; i < $cells.length; i++) {
|
||||
var $cell = $($cells[i])
|
||||
|
||||
$cell.css('width', '')
|
||||
}
|
||||
|
||||
$flyout.css('width', 0)
|
||||
|
||||
window.setTimeout(this.proxy(this.removeBodyClass), 1)
|
||||
window.setTimeout(this.proxy(this.removeOverlayAndShowToggle), 300)
|
||||
}
|
||||
|
||||
// FLYOUT INTERNAL METHODS
|
||||
// ============================
|
||||
|
||||
Flyout.prototype.init = function() {
|
||||
this.build()
|
||||
}
|
||||
|
||||
Flyout.prototype.build = function() {
|
||||
if (this.options.flyoutToggle) {
|
||||
this.buildToggle()
|
||||
}
|
||||
}
|
||||
|
||||
Flyout.prototype.buildToggle = function() {
|
||||
var $toggleContainer = $(this.options.flyoutToggle),
|
||||
$toggle = $('<div class="flyout-toggle"><i class="icon-chevron-right"></i></div>')
|
||||
|
||||
$toggle.on('click', this.proxy(this.show))
|
||||
$toggleContainer.append($toggle)
|
||||
}
|
||||
|
||||
Flyout.prototype.removeToggle = function() {
|
||||
var $toggle = this.getToggle()
|
||||
|
||||
$toggle.off('click', this.proxy(this.show))
|
||||
$toggle.remove()
|
||||
}
|
||||
|
||||
Flyout.prototype.hideToggle = function() {
|
||||
if (!this.options.flyoutToggle) {
|
||||
return
|
||||
}
|
||||
|
||||
this.getToggle().hide()
|
||||
}
|
||||
|
||||
Flyout.prototype.showToggle = function() {
|
||||
if (!this.options.flyoutToggle) {
|
||||
return
|
||||
}
|
||||
|
||||
this.getToggle().show()
|
||||
}
|
||||
|
||||
Flyout.prototype.getToggle = function() {
|
||||
var $toggleContainer = $(this.options.flyoutToggle)
|
||||
|
||||
return $toggleContainer.find('.flyout-toggle')
|
||||
}
|
||||
|
||||
Flyout.prototype.setBodyClass = function() {
|
||||
$(document.body).addClass('flyout-visible')
|
||||
}
|
||||
|
||||
Flyout.prototype.removeBodyClass = function() {
|
||||
$(document.body).removeClass('flyout-visible')
|
||||
}
|
||||
|
||||
Flyout.prototype.createOverlay = function() {
|
||||
this.$overlay = $('<div class="flyout-overlay"/>')
|
||||
|
||||
var position = this.$el.offset()
|
||||
|
||||
this.$overlay.css({
|
||||
top: position.top,
|
||||
left: this.options.flyoutWidth
|
||||
})
|
||||
|
||||
this.$overlay.on('click', this.proxy(this.onOverlayClick))
|
||||
$(document.body).on('keydown', this.proxy(this.onDocumentKeydown))
|
||||
|
||||
$(document.body).append(this.$overlay)
|
||||
}
|
||||
|
||||
Flyout.prototype.removeOverlay = function() {
|
||||
if (!this.$overlay) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$overlay.off('click', this.proxy(this.onOverlayClick))
|
||||
$(document.body).off('keydown', this.proxy(this.onDocumentKeydown))
|
||||
|
||||
this.$overlay.remove()
|
||||
this.$overlay = null
|
||||
}
|
||||
|
||||
Flyout.prototype.removeOverlayAndShowToggle = function() {
|
||||
this.removeOverlay()
|
||||
this.showToggle()
|
||||
}
|
||||
|
||||
// EVENT HANDLERS
|
||||
// ============================
|
||||
|
||||
Flyout.prototype.onOverlayClick = function() {
|
||||
this.hide()
|
||||
}
|
||||
|
||||
Flyout.prototype.onDocumentKeydown = function(ev) {
|
||||
if (ev.key === 'Escape') {
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// FLYOUT PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
Flyout.DEFAULTS = {
|
||||
flyoutWidth: 400,
|
||||
flyoutToggle: null
|
||||
}
|
||||
|
||||
var old = $.fn.flyout
|
||||
|
||||
$.fn.flyout = function (option) {
|
||||
var args = Array.prototype.slice.call(arguments, 1),
|
||||
result = undefined
|
||||
|
||||
this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.flyout')
|
||||
var options = $.extend({}, Flyout.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('oc.flyout', (data = new Flyout(this, options)))
|
||||
if (typeof option == 'string') result = data[option].apply(data, args)
|
||||
if (typeof result != 'undefined') return false
|
||||
})
|
||||
|
||||
return result ? result : this
|
||||
}
|
||||
|
||||
$.fn.flyout.Constructor = Flyout
|
||||
|
||||
// FLYOUT NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.flyout.noConflict = function () {
|
||||
$.fn.flyout = old
|
||||
return this
|
||||
}
|
||||
|
||||
// FLYOUT DATA-API
|
||||
// ===============
|
||||
|
||||
// Currently flyouts don't use the document render event
|
||||
// and can't be created dynamically (performance considerations).
|
||||
$(document).ready(function(){
|
||||
$('div[data-control=flyout]').flyout()
|
||||
})
|
||||
}(window.jQuery);
|
||||
35
modules/backend/assets/js/winter.js
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This is a bundle file, you can compile this by running
|
||||
*
|
||||
* php artisan winter:util compile assets
|
||||
*
|
||||
* @see winter-min.js
|
||||
*
|
||||
|
||||
=require vendor/jquery.touchwipe.js
|
||||
=require vendor/jquery.autoellipsis.js
|
||||
=require vendor/jquery.waterfall.js
|
||||
=require vendor/jquery.cookie.js
|
||||
=require ../vendor/dropzone/dropzone.js
|
||||
=require ../vendor/sweet-alert/sweet-alert.js
|
||||
=require ../vendor/jcrop/js/jquery.Jcrop.js
|
||||
=require ../../../system/assets/vendor/prettify/prettify.js
|
||||
=require ../../widgets/mediamanager/assets/js/mediamanager-global.js
|
||||
|
||||
=require winter.lang.js
|
||||
=require winter.alert.js
|
||||
=require winter.scrollpad.js
|
||||
=require winter.verticalmenu.js
|
||||
=require winter.navbar.js
|
||||
=require winter.sidenav.js
|
||||
=require winter.scrollbar.js
|
||||
=require winter.filelist.js
|
||||
=require winter.layout.js
|
||||
=require winter.sidepaneltab.js
|
||||
=require winter.simplelist.js
|
||||
=require winter.treelist.js
|
||||
=require winter.sidenav-tree.js
|
||||
=require winter.datetime.js
|
||||
|
||||
=require backend.js
|
||||
*/
|
||||
52
modules/backend/assets/js/winter.lang.js
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Client side translations
|
||||
*/
|
||||
|
||||
if ($.wn === undefined)
|
||||
$.wn = {}
|
||||
if ($.oc === undefined)
|
||||
$.oc = $.wn
|
||||
|
||||
if ($.wn.langMessages === undefined)
|
||||
$.wn.langMessages = {}
|
||||
|
||||
$.wn.lang = (function(lang, messages) {
|
||||
|
||||
lang.load = function(locale) {
|
||||
if (messages[locale] === undefined) {
|
||||
messages[locale] = {}
|
||||
}
|
||||
|
||||
lang.loadedMessages = messages[locale]
|
||||
}
|
||||
|
||||
lang.get = function(name, defaultValue) {
|
||||
if (!name) return
|
||||
|
||||
var result = lang.loadedMessages
|
||||
|
||||
if (!defaultValue) defaultValue = name
|
||||
|
||||
$.each(name.split('.'), function(index, value) {
|
||||
if (result[value] === undefined) {
|
||||
result = defaultValue
|
||||
return false
|
||||
}
|
||||
|
||||
result = result[value]
|
||||
})
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if (lang.locale === undefined) {
|
||||
lang.locale = $('html').attr('lang') || 'en'
|
||||
}
|
||||
|
||||
if (lang.loadedMessages === undefined) {
|
||||
lang.load(lang.locale)
|
||||
}
|
||||
|
||||
return lang
|
||||
|
||||
})($.wn.lang || {}, $.wn.langMessages);
|
||||
86
modules/backend/assets/js/winter.layout.js
Normal file
@@ -0,0 +1,86 @@
|
||||
(function($){
|
||||
var WinterLayout = function() {
|
||||
this.$accountMenuOverlay = null
|
||||
}
|
||||
|
||||
WinterLayout.prototype.setPageTitle = function(title) {
|
||||
var $title = $('title')
|
||||
|
||||
if (this.pageTitleTemplate === undefined)
|
||||
this.pageTitleTemplate = $title.data('titleTemplate')
|
||||
|
||||
$title.text(this.pageTitleTemplate.replace('%s', title))
|
||||
}
|
||||
|
||||
WinterLayout.prototype.updateLayout = function(title) {
|
||||
var $children, $el, fixedWidth, margin
|
||||
|
||||
$('[data-calculate-width]').each(function(){
|
||||
$children = $(this).children()
|
||||
|
||||
if ($children.length > 0) {
|
||||
fixedWidth = 0
|
||||
|
||||
$children.each(function() {
|
||||
$el = $(this)
|
||||
margin = $el.data('oc.layoutMargin')
|
||||
|
||||
if (margin === undefined) {
|
||||
margin = parseInt($el.css('marginRight')) + parseInt($el.css('marginLeft'))
|
||||
$el.data('oc.layoutMargin', margin)
|
||||
}
|
||||
fixedWidth += $el.get(0).offsetWidth + margin
|
||||
})
|
||||
|
||||
$(this).width(fixedWidth)
|
||||
$(this).trigger('oc.widthFixed')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
WinterLayout.prototype.toggleAccountMenu = function(el) {
|
||||
var self = this,
|
||||
$el = $(el),
|
||||
$parent = $(el).parent(),
|
||||
$menu = $el.next()
|
||||
|
||||
$el.tooltip('hide')
|
||||
|
||||
if ($menu.hasClass('active')) {
|
||||
self.$accountMenuOverlay.remove()
|
||||
$parent.removeClass('highlight')
|
||||
$menu.removeClass('active')
|
||||
}
|
||||
else {
|
||||
self.$accountMenuOverlay = $('<div />').addClass('popover-overlay')
|
||||
$(document.body).append(self.$accountMenuOverlay)
|
||||
$parent.addClass('highlight')
|
||||
$menu.addClass('active')
|
||||
|
||||
self.$accountMenuOverlay.one('click', function(){
|
||||
self.$accountMenuOverlay.remove()
|
||||
$menu.removeClass('active')
|
||||
$parent.removeClass('highlight')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if ($.wn === undefined)
|
||||
$.wn = {}
|
||||
if ($.oc === undefined)
|
||||
$.oc = $.wn
|
||||
|
||||
$.wn.layout = new WinterLayout()
|
||||
|
||||
$(document).ready(function(){
|
||||
$.wn.layout.updateLayout()
|
||||
|
||||
window.setTimeout($.wn.layout.updateLayout, 100)
|
||||
})
|
||||
$(window).on('resize', function() {
|
||||
$.wn.layout.updateLayout()
|
||||
})
|
||||
$(window).on('oc.updateUi', function() {
|
||||
$.wn.layout.updateLayout()
|
||||
})
|
||||
})(jQuery);
|
||||
41
modules/backend/assets/js/winter.navbar.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Top navigation bar. Features of the bar:
|
||||
* - Hide content if the display width is less than 768px. In this case the menu icon is displayed.
|
||||
* When the icon is clicked, the menu content is displayed on the left side of the page.
|
||||
* - If the content doesn't fit the navbar, it can be dragged left and right.
|
||||
*
|
||||
* Dependences:
|
||||
* - DragScroll (winter.dragscroll.js)
|
||||
* - VerticalMenu (winter.verticalmenu.js)
|
||||
*/
|
||||
|
||||
(function($){
|
||||
$(document).ready(function(){
|
||||
$('nav.navbar').each(function(){
|
||||
var
|
||||
navbar = $(this),
|
||||
nav = $('ul.nav', navbar),
|
||||
collapseMode = navbar.hasClass('navbar-mode-collapse'),
|
||||
isMobile = $('html').hasClass('mobile')
|
||||
|
||||
nav.verticalMenu($('a.menu-toggle', navbar), {
|
||||
breakpoint: collapseMode ? Infinity : 769
|
||||
})
|
||||
|
||||
$('li.with-tooltip:not(.active) > a', navbar).tooltip({
|
||||
container: 'body',
|
||||
placement: 'bottom',
|
||||
template: '<div class="tooltip mainmenu-tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
|
||||
})
|
||||
.on('show.bs.tooltip', function (e) {
|
||||
if (isMobile) e.preventDefault()
|
||||
})
|
||||
|
||||
// Scroll to the currently active nav item.
|
||||
var dragScroll = $('[data-control=toolbar]', navbar).data('oc.dragScroll')
|
||||
if (dragScroll) {
|
||||
dragScroll.goToElement($('ul.nav > li.active', navbar), undefined, {'duration': 0})
|
||||
}
|
||||
})
|
||||
})
|
||||
})(jQuery);
|
||||
409
modules/backend/assets/js/winter.scrollbar.js
Normal file
@@ -0,0 +1,409 @@
|
||||
/*
|
||||
* Creates a scrollbar in a container.
|
||||
*
|
||||
* Note the element must have a height set for vertical,
|
||||
* and a width set for horizontal.
|
||||
*
|
||||
* Data attributes:
|
||||
* - data-control="scrollbar" - enables the scrollbar plugin
|
||||
*
|
||||
* JavaScript API:
|
||||
* $('#area').scrollbar()
|
||||
*
|
||||
* Dependences:
|
||||
* - Mouse Wheel plugin (mousewheel.js)
|
||||
*/
|
||||
+function ($) { "use strict";
|
||||
var Base = $.wn.foundation.base,
|
||||
BaseProto = Base.prototype
|
||||
|
||||
var Scrollbar = function (element, options) {
|
||||
|
||||
var
|
||||
$el = this.$el = $(element),
|
||||
el = $el.get(0),
|
||||
self = this,
|
||||
options = this.options = options || {},
|
||||
sizeName = this.sizeName = options.vertical ? 'height' : 'width',
|
||||
isNative = $('html').hasClass('mobile'),
|
||||
isTouch = this.isTouch = Modernizr.touchevents,
|
||||
isScrollable = this.isScrollable = false,
|
||||
isLocked = this.isLocked = false,
|
||||
eventElementName = options.vertical ? 'pageY' : 'pageX',
|
||||
dragStart = 0,
|
||||
startOffset = 0;
|
||||
|
||||
$.wn.foundation.controlUtils.markDisposable(element)
|
||||
|
||||
Base.call(this)
|
||||
|
||||
this.$el.one('dispose-control', this.proxy(this.dispose))
|
||||
|
||||
/*
|
||||
* Native (mobile) environments use overflow auto in CSS
|
||||
*/
|
||||
if (isNative) {
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
* Create Scrollbar
|
||||
*/
|
||||
this.$scrollbar = $('<div />').addClass('scrollbar-scrollbar')
|
||||
this.$track = $('<div />').addClass('scrollbar-track').appendTo(this.$scrollbar)
|
||||
this.$thumb = $('<div />').addClass('scrollbar-thumb').appendTo(this.$track)
|
||||
|
||||
$el
|
||||
.addClass('drag-scrollbar')
|
||||
.addClass(options.vertical ? 'vertical' : 'horizontal')
|
||||
.prepend(this.$scrollbar)
|
||||
|
||||
/*
|
||||
* Bind events
|
||||
*/
|
||||
if (isTouch) {
|
||||
this.$el.on('touchstart', function (event){
|
||||
var touchEvent = event.originalEvent;
|
||||
if (touchEvent.touches.length == 1) {
|
||||
startDrag(touchEvent.touches[0])
|
||||
event.stopPropagation()
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
this.$thumb.on('mousedown', function (event){
|
||||
startDrag(event)
|
||||
})
|
||||
this.$track.on('mouseup', function (event){
|
||||
moveDrag(event)
|
||||
})
|
||||
}
|
||||
|
||||
$el.mousewheel(function (event){
|
||||
var offset = self.options.vertical
|
||||
? ((event.deltaFactor * event.deltaY) * -1)
|
||||
: (event.deltaFactor * event.deltaX)
|
||||
|
||||
return !scrollWheel(offset * self.options.scrollSpeed)
|
||||
})
|
||||
|
||||
$el.on('oc.scrollbar.gotoStart', function(event){
|
||||
self.options.vertical
|
||||
? $el.scrollTop(0)
|
||||
: $el.scrollLeft(0)
|
||||
|
||||
self.update()
|
||||
event.stopPropagation()
|
||||
})
|
||||
|
||||
$(window).on('resize', $.proxy(this.update, this))
|
||||
$(window).on('oc.updateUi', $.proxy(this.update, this))
|
||||
|
||||
/*
|
||||
* Internal event, drag has started
|
||||
*/
|
||||
function startDrag(event) {
|
||||
$('body').addClass('drag-noselect')
|
||||
$el.trigger('oc.scrollStart')
|
||||
|
||||
dragStart = event[eventElementName]
|
||||
startOffset = self.options.vertical ? $el.scrollTop() : $el.scrollLeft()
|
||||
|
||||
if (isTouch) {
|
||||
$(window).on('touchmove.scrollbar', function(event) {
|
||||
var touchEvent = event.originalEvent
|
||||
if (moveDrag(touchEvent.touches[0]))
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
$el.on('touchend.scrollbar', stopDrag)
|
||||
}
|
||||
else {
|
||||
$(window).on('mousemove.scrollbar', function(event){
|
||||
moveDrag(event)
|
||||
return false
|
||||
})
|
||||
|
||||
$(window).on('mouseup.scrollbar', function(){
|
||||
stopDrag()
|
||||
return false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal event, drag is active
|
||||
*/
|
||||
function moveDrag(event) {
|
||||
self.isLocked = true;
|
||||
|
||||
var
|
||||
offset,
|
||||
dragTo = event[eventElementName]
|
||||
|
||||
// Touch devices use an inverse scrolling interface
|
||||
// with a 1:1 ratio
|
||||
if (self.isTouch) {
|
||||
offset = dragStart - dragTo
|
||||
}
|
||||
// Mouse devices use a natural scrolling interface
|
||||
// with a track:canvas ratio
|
||||
else {
|
||||
var ratio = self.getCanvasSize() / self.getViewportSize()
|
||||
offset = (dragTo - dragStart) * ratio
|
||||
}
|
||||
|
||||
self.options.vertical
|
||||
? $el.scrollTop(startOffset + offset)
|
||||
: $el.scrollLeft(startOffset + offset)
|
||||
|
||||
self.setThumbPosition()
|
||||
|
||||
return self.options.vertical
|
||||
? el.scrollTop != startOffset
|
||||
: el.scrollLeft != startOffset
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal event, drag has ended
|
||||
*/
|
||||
function stopDrag() {
|
||||
$('body').removeClass('drag-noselect')
|
||||
$el.trigger('oc.scrollEnd')
|
||||
|
||||
$(window).off('.scrollbar')
|
||||
}
|
||||
|
||||
/*
|
||||
* Scroll wheel has moved by supplied offset
|
||||
*/
|
||||
|
||||
var isWebkit = $(document.documentElement).hasClass('webkit')
|
||||
|
||||
function scrollWheel(offset) {
|
||||
startOffset = self.options.vertical ? el.scrollTop : el.scrollLeft
|
||||
$el.trigger('oc.scrollStart')
|
||||
|
||||
self.options.vertical
|
||||
? $el.scrollTop(startOffset + offset)
|
||||
: $el.scrollLeft(startOffset + offset)
|
||||
|
||||
var scrolled = self.options.vertical
|
||||
? el.scrollTop != startOffset
|
||||
: el.scrollLeft != startOffset
|
||||
|
||||
self.setThumbPosition()
|
||||
if (!isWebkit) {
|
||||
if (self.endScrollTimeout !== undefined) {
|
||||
clearTimeout(self.endScrollTimeout)
|
||||
self.endScrollTimeout = undefined
|
||||
}
|
||||
|
||||
self.endScrollTimeout = setTimeout(function() {
|
||||
$el.trigger('oc.scrollEnd')
|
||||
self.endScrollTimeout = undefined
|
||||
}, 50)
|
||||
} else {
|
||||
$el.trigger('oc.scrollEnd')
|
||||
}
|
||||
|
||||
return scrolled
|
||||
}
|
||||
|
||||
/*
|
||||
* Give the DOM a second, then set the track and thumb size
|
||||
*/
|
||||
setTimeout(function() { self.update() }, 1);
|
||||
}
|
||||
|
||||
Scrollbar.prototype = Object.create(BaseProto)
|
||||
Scrollbar.prototype.constructor = Scrollbar
|
||||
|
||||
Scrollbar.prototype.dispose = function() {
|
||||
this.unregisterHandlers()
|
||||
|
||||
BaseProto.dispose.call(this)
|
||||
}
|
||||
|
||||
Scrollbar.prototype.unregisterHandlers = function() {
|
||||
|
||||
}
|
||||
|
||||
Scrollbar.DEFAULTS = {
|
||||
vertical: true,
|
||||
scrollSpeed: 2,
|
||||
animation: true,
|
||||
start: function() {},
|
||||
drag: function() {},
|
||||
stop: function() {}
|
||||
}
|
||||
|
||||
Scrollbar.prototype.update = function() {
|
||||
if (!this.$scrollbar)
|
||||
return
|
||||
|
||||
this.$scrollbar.hide()
|
||||
this.setThumbSize()
|
||||
this.setThumbPosition()
|
||||
this.$scrollbar.show()
|
||||
}
|
||||
|
||||
Scrollbar.prototype.setThumbSize = function() {
|
||||
var properties = this.calculateProperties()
|
||||
|
||||
this.isScrollable = !(properties.thumbSizeRatio >= 1);
|
||||
this.$scrollbar.toggleClass('disabled', !this.isScrollable)
|
||||
|
||||
if (this.options.vertical) {
|
||||
this.$track.height(properties.canvasSize)
|
||||
this.$thumb.height(properties.thumbSize)
|
||||
}
|
||||
else {
|
||||
this.$track.width(properties.canvasSize)
|
||||
this.$thumb.width(properties.thumbSize)
|
||||
}
|
||||
}
|
||||
|
||||
Scrollbar.prototype.setThumbPosition = function() {
|
||||
var properties = this.calculateProperties()
|
||||
|
||||
if (this.options.vertical)
|
||||
this.$thumb.css({top: properties.thumbPosition})
|
||||
else
|
||||
this.$thumb.css({left: properties.thumbPosition})
|
||||
}
|
||||
|
||||
Scrollbar.prototype.calculateProperties = function() {
|
||||
|
||||
var $el = this.$el,
|
||||
properties = {};
|
||||
|
||||
properties.viewportSize = this.getViewportSize()
|
||||
properties.canvasSize = this.getCanvasSize()
|
||||
properties.scrollAmount = (this.options.vertical) ? $el.scrollTop() : $el.scrollLeft()
|
||||
|
||||
properties.thumbSizeRatio = properties.viewportSize / properties.canvasSize
|
||||
properties.thumbSize = properties.viewportSize * properties.thumbSizeRatio
|
||||
|
||||
properties.thumbPositionRatio = properties.scrollAmount / (properties.canvasSize - properties.viewportSize)
|
||||
properties.thumbPosition = ((properties.viewportSize - properties.thumbSize) * properties.thumbPositionRatio) + properties.scrollAmount
|
||||
|
||||
if (isNaN(properties.thumbPosition))
|
||||
properties.thumbPosition = 0
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
Scrollbar.prototype.getViewportSize = function() {
|
||||
return (this.options.vertical)
|
||||
? this.$el.height()
|
||||
: this.$el.width();
|
||||
}
|
||||
|
||||
Scrollbar.prototype.getCanvasSize = function() {
|
||||
return (this.options.vertical)
|
||||
? this.$el.get(0).scrollHeight
|
||||
: this.$el.get(0).scrollWidth;
|
||||
}
|
||||
|
||||
Scrollbar.prototype.gotoElement = function(element, callback) {
|
||||
var $el = $(element)
|
||||
if (!$el.length)
|
||||
return;
|
||||
|
||||
var self = this,
|
||||
offset = 0,
|
||||
animated = false,
|
||||
params = {
|
||||
duration: 300,
|
||||
queue: false,
|
||||
complete: function(){
|
||||
if (callback !== undefined)
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.options.vertical) {
|
||||
offset = $el.get(0).offsetLeft - this.$el.scrollLeft()
|
||||
|
||||
if (offset < 0) {
|
||||
this.$el.animate({'scrollLeft': $el.get(0).offsetLeft}, params)
|
||||
animated = true
|
||||
} else {
|
||||
offset = $el.get(0).offsetLeft + $el.outerWidth() - (this.$el.scrollLeft() + this.$el.outerWidth())
|
||||
if (offset > 0) {
|
||||
this.$el.animate({'scrollLeft': $el.get(0).offsetLeft + $el.outerWidth() - this.$el.outerWidth()}, params)
|
||||
animated = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
offset = $el.get(0).offsetTop - this.$el.scrollTop()
|
||||
|
||||
if (this.options.animation) {
|
||||
if (offset < 0) {
|
||||
this.$el.animate({'scrollTop': $el.get(0).offsetTop}, params)
|
||||
animated = true
|
||||
} else {
|
||||
offset = $el.get(0).offsetTop - (this.$el.scrollTop() + this.$el.outerHeight())
|
||||
if (offset > 0) {
|
||||
this.$el.animate({'scrollTop': $el.get(0).offsetTop + $el.outerHeight() - this.$el.outerHeight()}, params)
|
||||
animated = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (offset < 0) {
|
||||
this.$el.scrollTop($el.get(0).offsetTop)
|
||||
} else {
|
||||
offset = $el.get(0).offsetTop - (this.$el.scrollTop() + this.$el.outerHeight())
|
||||
if (offset > 0)
|
||||
this.$el.scrollTop($el.get(0).offsetTop + $el.outerHeight() - this.$el.outerHeight())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!animated && callback !== undefined)
|
||||
callback()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
Scrollbar.prototype.dispose = function() {
|
||||
this.$el = null
|
||||
this.$scrollbar = null
|
||||
this.$track = null
|
||||
this.$thumb = null
|
||||
}
|
||||
|
||||
// SCROLLBAR PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.scrollbar
|
||||
|
||||
$.fn.scrollbar = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.scrollbar')
|
||||
var options = $.extend({}, Scrollbar.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
|
||||
if (!data) $this.data('oc.scrollbar', (data = new Scrollbar(this, options)))
|
||||
if (typeof option == 'string') data[option].call($this)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.scrollbar.Constructor = Scrollbar
|
||||
|
||||
// SCROLLBAR NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.scrollbar.noConflict = function () {
|
||||
$.fn.scrollbar = old
|
||||
return this
|
||||
}
|
||||
|
||||
// SCROLLBAR DATA-API
|
||||
// ===============
|
||||
$(document).render(function(){
|
||||
$('[data-control=scrollbar]').scrollbar()
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
310
modules/backend/assets/js/winter.scrollpad.js
Normal file
@@ -0,0 +1,310 @@
|
||||
/*
|
||||
* ScrollPad plugin.
|
||||
*
|
||||
* This plugin creates a scrollable area with features similar (but more limited)
|
||||
* to winter.scrollbar.js, with virtual scroll bars. This plugin is more lightweight
|
||||
* in terms of calculations and more responsive. It doesn't use scripting for scrolling,
|
||||
* instead it uses the native scrolling and listens for the onscroll event to update
|
||||
* the virtual scroll bars.
|
||||
*
|
||||
* The plugin is partially based on Trackpad Scroll Emulator
|
||||
* https://github.com/jnicol/trackpad-scroll-emulator, cleaned up for the better CPU and
|
||||
* memory (DOM references) management.
|
||||
*
|
||||
* Expected markup:
|
||||
* <div class="control-scrollpad" data-control="scrollpad" data-direction="vertical">
|
||||
* <div>
|
||||
* <div>
|
||||
* The content goes here. The two wrapping
|
||||
* DIV elements are required.
|
||||
* </div>
|
||||
* </div>
|
||||
* </div>
|
||||
*
|
||||
* Data attributes:
|
||||
* - data-control="scrollpad" - enables the plugin.
|
||||
* - data-direction="vertical|horizontal" - sets the scrolling direction.
|
||||
*
|
||||
* JavaScript API:
|
||||
* $('#area').scrollpad({direction: 'vertical'})
|
||||
* $('#area').scrollpad('dispose')
|
||||
* $('#area').scrollpad('scrollToStart')
|
||||
*
|
||||
* TODO: In FireFox the control in the horizontal mode displays the native scrollbars,
|
||||
* because negative margin-bottom in the scrollable element doesn't work for some reason.
|
||||
* Try to align the scrollable element with absolute positioning (negative right and bottom)
|
||||
* instead of negative margins.
|
||||
*
|
||||
*/
|
||||
+function ($) { "use strict";
|
||||
|
||||
var Base = $.wn.foundation.base,
|
||||
BaseProto = Base.prototype
|
||||
|
||||
// SCROLLPAD CLASS DEFINITION
|
||||
// ============================
|
||||
|
||||
var Scrollpad = function(element, options) {
|
||||
this.$el = $(element)
|
||||
this.scrollbarElement = null
|
||||
this.dragHandleElement = null
|
||||
this.scrollContentElement = null
|
||||
this.contentElement = null
|
||||
this.options = options
|
||||
this.scrollbarSize = null
|
||||
this.updateScrollbarTimer = null
|
||||
this.dragOffset = null
|
||||
|
||||
Base.call(this)
|
||||
|
||||
//
|
||||
// Initialization
|
||||
//
|
||||
|
||||
this.init()
|
||||
|
||||
$.wn.foundation.controlUtils.markDisposable(element)
|
||||
}
|
||||
|
||||
Scrollpad.prototype = Object.create(BaseProto)
|
||||
Scrollpad.prototype.constructor = Scrollpad
|
||||
|
||||
Scrollpad.prototype.dispose = function() {
|
||||
this.unregisterHandlers()
|
||||
|
||||
this.$el.get(0).removeChild(this.scrollbarElement)
|
||||
this.$el.removeData('oc.scrollpad')
|
||||
this.$el = null
|
||||
|
||||
this.scrollbarElement = null
|
||||
this.dragHandleElement = null
|
||||
this.scrollContentElement = null
|
||||
this.contentElement = null
|
||||
|
||||
BaseProto.dispose.call(this)
|
||||
}
|
||||
|
||||
Scrollpad.prototype.scrollToStart = function() {
|
||||
var scrollAttr = this.options.direction == 'vertical' ? 'scrollTop' : 'scrollLeft'
|
||||
this.scrollContentElement[scrollAttr] = 0
|
||||
}
|
||||
|
||||
Scrollpad.prototype.update = function() {
|
||||
this.updateScrollbarSize()
|
||||
}
|
||||
|
||||
// SCROLLPAD INTERNAL METHODS
|
||||
// ============================
|
||||
|
||||
Scrollpad.prototype.init = function() {
|
||||
this.build()
|
||||
this.setScrollContentSize()
|
||||
this.registerHandlers()
|
||||
}
|
||||
|
||||
Scrollpad.prototype.build = function() {
|
||||
var el = this.$el.get(0)
|
||||
|
||||
this.scrollContentElement = el.children[0]
|
||||
this.contentElement = this.scrollContentElement.children[0]
|
||||
this.$el.prepend('<div class="scrollpad-scrollbar"><div class="drag-handle"></div></div>')
|
||||
this.scrollbarElement = el.querySelector('.scrollpad-scrollbar')
|
||||
this.dragHandleElement = el.querySelector('.scrollpad-scrollbar > .drag-handle')
|
||||
}
|
||||
|
||||
Scrollpad.prototype.registerHandlers = function() {
|
||||
this.$el.on('mouseenter', this.proxy(this.onMouseEnter))
|
||||
this.$el.on('mouseleave', this.proxy(this.onMouseLeave))
|
||||
|
||||
this.$el.one('dispose-control', this.proxy(this.dispose))
|
||||
|
||||
this.scrollContentElement.addEventListener('scroll', this.proxy(this.onScroll))
|
||||
this.dragHandleElement.addEventListener('mousedown', this.proxy(this.onStartDrag))
|
||||
}
|
||||
|
||||
Scrollpad.prototype.unregisterHandlers = function() {
|
||||
this.$el.off('mouseenter', this.proxy(this.onMouseEnter))
|
||||
this.$el.off('mouseleave', this.proxy(this.onMouseLeave))
|
||||
this.$el.off('dispose-control', this.proxy(this.dispose))
|
||||
this.scrollContentElement.removeEventListener('scroll', this.proxy(this.onScroll))
|
||||
this.dragHandleElement.removeEventListener('mousedown', this.proxy(this.onStartDrag))
|
||||
|
||||
document.removeEventListener('mousemove', this.proxy(this.onMouseMove))
|
||||
document.removeEventListener('mouseup', this.proxy(this.onEndDrag))
|
||||
}
|
||||
|
||||
Scrollpad.prototype.setScrollContentSize = function() {
|
||||
var scrollbarSize = this.getScrollbarSize()
|
||||
|
||||
if (this.options.direction == 'vertical')
|
||||
this.scrollContentElement.setAttribute('style', 'margin-right: -' + scrollbarSize + 'px')
|
||||
else
|
||||
this.scrollContentElement.setAttribute('style', 'margin-bottom: -' + scrollbarSize + 'px')
|
||||
}
|
||||
|
||||
Scrollpad.prototype.getScrollbarSize = function() {
|
||||
if (this.scrollbarSize !== null)
|
||||
return this.scrollbarSize
|
||||
|
||||
var testerElement = document.createElement('div')
|
||||
testerElement.setAttribute('class', 'scrollpad-scrollbar-size-tester')
|
||||
testerElement.appendChild(document.createElement('div'))
|
||||
|
||||
document.body.appendChild(testerElement)
|
||||
|
||||
var width = testerElement.offsetWidth,
|
||||
innerWidth = testerElement.querySelector('div').offsetWidth
|
||||
|
||||
document.body.removeChild(testerElement)
|
||||
|
||||
// Some magic for FireFox, see
|
||||
// https://github.com/jnicol/trackpad-scroll-emulator/blob/master/jquery.trackpad-scroll-emulator.js
|
||||
if (width === innerWidth && navigator.userAgent.toLowerCase().indexOf('firefox') > -1)
|
||||
return this.scrollbarSize = 17
|
||||
|
||||
return this.scrollbarSize = width - innerWidth
|
||||
}
|
||||
|
||||
Scrollpad.prototype.updateScrollbarSize = function() {
|
||||
this.scrollbarElement.removeAttribute('data-hidden')
|
||||
|
||||
var contentSize = this.options.direction == 'vertical' ? this.contentElement.scrollHeight : this.contentElement.scrollWidth,
|
||||
scrollOffset = this.options.direction == 'vertical' ? this.scrollContentElement.scrollTop : this.scrollContentElement.scrollLeft,
|
||||
scrollbarSize = this.options.direction == 'vertical' ? this.scrollbarElement.offsetHeight : this.scrollbarElement.offsetWidth,
|
||||
scrollbarRatio = scrollbarSize / contentSize,
|
||||
handleOffset = Math.round(scrollbarRatio * scrollOffset) + 2,
|
||||
handleSize = Math.floor(scrollbarRatio * (scrollbarSize - 2)) - 2;
|
||||
|
||||
if (scrollbarSize < contentSize) {
|
||||
if (this.options.direction == 'vertical')
|
||||
this.dragHandleElement.setAttribute('style', 'top: ' + handleOffset + 'px; height: ' + handleSize + 'px')
|
||||
else
|
||||
this.dragHandleElement.setAttribute('style', 'left: ' + handleOffset + 'px; width: ' + handleSize + 'px')
|
||||
|
||||
this.scrollbarElement.removeAttribute('data-hidden')
|
||||
}
|
||||
else
|
||||
this.scrollbarElement.setAttribute('data-hidden', true)
|
||||
}
|
||||
|
||||
Scrollpad.prototype.displayScrollbar = function() {
|
||||
this.clearUpdateScrollbarTimer()
|
||||
|
||||
this.updateScrollbarSize()
|
||||
this.scrollbarElement.setAttribute('data-visible', 'true')
|
||||
}
|
||||
|
||||
Scrollpad.prototype.hideScrollbar = function() {
|
||||
this.scrollbarElement.removeAttribute('data-visible')
|
||||
}
|
||||
|
||||
Scrollpad.prototype.clearUpdateScrollbarTimer = function() {
|
||||
if (this.updateScrollbarTimer === null)
|
||||
return
|
||||
|
||||
clearTimeout(this.updateScrollbarTimer)
|
||||
this.updateScrollbarTimer = null
|
||||
}
|
||||
|
||||
// EVENT HANDLERS
|
||||
// ============================
|
||||
|
||||
Scrollpad.prototype.onMouseEnter = function() {
|
||||
this.displayScrollbar()
|
||||
}
|
||||
|
||||
Scrollpad.prototype.onMouseLeave = function() {
|
||||
this.hideScrollbar()
|
||||
}
|
||||
|
||||
Scrollpad.prototype.onScroll = function() {
|
||||
if (this.updateScrollbarTimer !== null)
|
||||
return
|
||||
|
||||
this.updateScrollbarTimer = setTimeout(this.proxy(this.displayScrollbar), 10)
|
||||
}
|
||||
|
||||
Scrollpad.prototype.onStartDrag = function(ev) {
|
||||
$.wn.foundation.event.stop(ev)
|
||||
|
||||
var pageCoords = $.wn.foundation.event.pageCoordinates(ev),
|
||||
eventOffset = this.options.direction == 'vertical' ? pageCoords.y : pageCoords.x,
|
||||
handleCoords = $.wn.foundation.element.absolutePosition(this.dragHandleElement),
|
||||
handleOffset = this.options.direction == 'vertical' ? handleCoords.top : handleCoords.left
|
||||
|
||||
this.dragOffset = eventOffset - handleOffset
|
||||
|
||||
document.addEventListener('mousemove', this.proxy(this.onMouseMove))
|
||||
document.addEventListener('mouseup', this.proxy(this.onEndDrag))
|
||||
}
|
||||
|
||||
Scrollpad.prototype.onMouseMove = function(ev) {
|
||||
$.wn.foundation.event.stop(ev)
|
||||
|
||||
var eventCoordsAttr = this.options.direction == 'vertical' ? 'y' : 'x',
|
||||
elementCoordsAttr = this.options.direction == 'vertical' ? 'top' : 'left',
|
||||
offsetAttr = this.options.direction == 'vertical' ? 'offsetHeight' : 'offsetWidth',
|
||||
scrollAttr = this.options.direction == 'vertical' ? 'scrollTop' : 'scrollLeft'
|
||||
|
||||
var eventOffset = $.wn.foundation.event.pageCoordinates(ev)[eventCoordsAttr],
|
||||
scrollbarOffset = $.wn.foundation.element.absolutePosition(this.scrollbarElement)[elementCoordsAttr],
|
||||
dragPos = eventOffset - scrollbarOffset - this.dragOffset,
|
||||
scrollbarSize = this.scrollbarElement[offsetAttr],
|
||||
contentSize = this.contentElement[offsetAttr],
|
||||
dragPerc = dragPos / scrollbarSize
|
||||
|
||||
if (dragPerc > 1)
|
||||
dragPerc = 1
|
||||
|
||||
var scrollPos = dragPerc * contentSize;
|
||||
|
||||
this.scrollContentElement[scrollAttr] = scrollPos
|
||||
}
|
||||
|
||||
Scrollpad.prototype.onEndDrag = function(ev) {
|
||||
document.removeEventListener('mousemove', this.proxy(this.onMouseMove))
|
||||
document.removeEventListener('mouseup', this.proxy(this.onEndDrag))
|
||||
}
|
||||
|
||||
// SCROLLPAD PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
Scrollpad.DEFAULTS = {
|
||||
direction: 'vertical'
|
||||
}
|
||||
|
||||
var old = $.fn.scrollpad
|
||||
|
||||
$.fn.scrollpad = function (option) {
|
||||
var args = Array.prototype.slice.call(arguments, 1),
|
||||
result = undefined
|
||||
|
||||
this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.scrollpad')
|
||||
var options = $.extend({}, Scrollpad.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('oc.scrollpad', (data = new Scrollpad(this, options)))
|
||||
if (typeof option == 'string') result = data[option].apply(data, args)
|
||||
if (typeof result != 'undefined') return false
|
||||
})
|
||||
|
||||
return result ? result : this
|
||||
}
|
||||
|
||||
$.fn.scrollpad.Constructor = Scrollpad
|
||||
|
||||
// SCROLLPAD NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.scrollpad.noConflict = function () {
|
||||
$.fn.scrollpad = old
|
||||
return this
|
||||
}
|
||||
|
||||
// SCROLLPAD DATA-API
|
||||
// ===============
|
||||
|
||||
$(document).on('render', function(){
|
||||
$('div[data-control=scrollpad]').scrollpad()
|
||||
})
|
||||
}(window.jQuery);
|
||||
268
modules/backend/assets/js/winter.sidenav-tree.js
Normal file
@@ -0,0 +1,268 @@
|
||||
/*
|
||||
* Side navigation tree
|
||||
*
|
||||
* Data attributes:
|
||||
* - data-control="sidenav-tree" - enables the plugin
|
||||
* - data-tree-name - unique name of the tree control. The name is used for storing user configuration in the browser cookies.
|
||||
*
|
||||
* JavaScript API:
|
||||
* $('#tree').sidenavTree()
|
||||
*
|
||||
* Dependences:
|
||||
* - Null
|
||||
*/
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
// SIDENAVTREE CLASS DEFINITION
|
||||
// ============================
|
||||
|
||||
var SidenavTree = function(element, options) {
|
||||
this.options = options
|
||||
this.$el = $(element)
|
||||
|
||||
this.init()
|
||||
}
|
||||
|
||||
SidenavTree.DEFAULTS = {
|
||||
treeName: 'sidenav_tree'
|
||||
}
|
||||
|
||||
SidenavTree.prototype.init = function (){
|
||||
var self = this
|
||||
|
||||
$(document.body).addClass('has-sidenav-tree')
|
||||
|
||||
this.statusCookieName = this.options.treeName + 'groupStatus'
|
||||
this.searchCookieName = this.options.treeName + 'search'
|
||||
this.$searchInput = $(this.options.searchInput)
|
||||
|
||||
this.$el.on('click', 'li > div.group', function() {
|
||||
self.toggleGroup($(this).closest('li'))
|
||||
return false
|
||||
})
|
||||
|
||||
this.$searchInput.on('input', function(){
|
||||
self.handleSearchChange()
|
||||
})
|
||||
|
||||
var searchTerm = $.cookie(this.searchCookieName)
|
||||
if (searchTerm !== undefined && searchTerm.length > 0) {
|
||||
this.$searchInput.val(searchTerm)
|
||||
this.applySearch()
|
||||
}
|
||||
|
||||
var scrollbar = $('[data-control=scrollbar]', this.$el).data('oc.scrollbar'),
|
||||
active = $('li.active', this.$el)
|
||||
|
||||
if (active.length > 0) {
|
||||
scrollbar.gotoElement(active)
|
||||
}
|
||||
}
|
||||
|
||||
SidenavTree.prototype.toggleGroup = function(group) {
|
||||
var $group = $(group),
|
||||
status = $group.attr('data-status')
|
||||
|
||||
status === undefined || status == 'expanded'
|
||||
? this.collapseGroup($group)
|
||||
: this.expandGroup($group)
|
||||
}
|
||||
|
||||
SidenavTree.prototype.collapseGroup = function(group) {
|
||||
var
|
||||
$list = $('> ul', group),
|
||||
self = this
|
||||
|
||||
$list.css('overflow', 'hidden')
|
||||
$list.animate({ 'height': 0 }, {
|
||||
duration: 100,
|
||||
queue: false,
|
||||
complete: function() {
|
||||
$list.css({
|
||||
'overflow': 'visible',
|
||||
'display': 'none'
|
||||
})
|
||||
|
||||
$(group).attr('data-status', 'collapsed')
|
||||
$(window).trigger('oc.updateUi')
|
||||
self.saveGroupStatus($(group).data('group-code'), true)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
SidenavTree.prototype.expandGroup = function(group, duration) {
|
||||
var
|
||||
$list = $('> ul', group),
|
||||
self = this
|
||||
|
||||
duration = duration === undefined ? 100 : duration
|
||||
|
||||
$list.css({
|
||||
'overflow': 'hidden',
|
||||
'height': 0
|
||||
})
|
||||
$list.animate({'height': $list[0].scrollHeight}, { duration: duration, queue: false, complete: function() {
|
||||
$list.css({
|
||||
'overflow': 'visible',
|
||||
'height': 'auto',
|
||||
'display': ''
|
||||
})
|
||||
$(group).attr('data-status', 'expanded')
|
||||
$(window).trigger('oc.updateUi')
|
||||
self.saveGroupStatus($(group).data('group-code'), false)
|
||||
} })
|
||||
}
|
||||
|
||||
SidenavTree.prototype.saveGroupStatus = function(groupCode, collapsed) {
|
||||
var collapsedGroups = $.cookie(this.statusCookieName),
|
||||
updatedGroups = []
|
||||
|
||||
if (collapsedGroups === undefined) {
|
||||
collapsedGroups = ''
|
||||
}
|
||||
|
||||
collapsedGroups = collapsedGroups.split('|')
|
||||
$.each(collapsedGroups, function() {
|
||||
if (groupCode != this)
|
||||
updatedGroups.push(this)
|
||||
})
|
||||
|
||||
if (collapsed) {
|
||||
updatedGroups.push(groupCode)
|
||||
}
|
||||
|
||||
$.cookie(this.statusCookieName, updatedGroups.join('|'), { expires: 30, path: '/' })
|
||||
}
|
||||
|
||||
SidenavTree.prototype.handleSearchChange = function() {
|
||||
var lastValue = this.$searchInput.data('oc.lastvalue');
|
||||
|
||||
if (lastValue !== undefined && lastValue == this.$searchInput.val()) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$searchInput.data('oc.lastvalue', this.$searchInput.val())
|
||||
|
||||
if (this.dataTrackInputTimer !== undefined) {
|
||||
window.clearTimeout(this.dataTrackInputTimer)
|
||||
}
|
||||
|
||||
var self = this
|
||||
this.dataTrackInputTimer = window.setTimeout(function(){
|
||||
self.applySearch()
|
||||
}, 300);
|
||||
|
||||
$.cookie(this.searchCookieName, $.trim(this.$searchInput.val()), { expires: 30, path: '/' })
|
||||
}
|
||||
|
||||
SidenavTree.prototype.applySearch = function() {
|
||||
var query = $.trim(this.$searchInput.val()),
|
||||
words = query.toLowerCase().split(' '),
|
||||
visibleGroups = [],
|
||||
visibleItems = [],
|
||||
self = this
|
||||
|
||||
if (query.length == 0) {
|
||||
$('li', this.$el).removeClass('hidden')
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
* Find visible groups and items
|
||||
*/
|
||||
$('ul.top-level > li', this.$el).each(function() {
|
||||
var $li = $(this)
|
||||
|
||||
if (self.textContainsWords($('div.group h3', $li).text(), words)) {
|
||||
visibleGroups.push($li.get(0))
|
||||
|
||||
$('ul li', $li).each(function(){
|
||||
visibleItems.push(this)
|
||||
})
|
||||
}
|
||||
else {
|
||||
$('ul li', $li).each(function(){
|
||||
if (self.textContainsWords($(this).text(), words) || self.textContainsWords($(this).data('keywords'), words)) {
|
||||
visibleGroups.push($li.get(0))
|
||||
visibleItems.push(this)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
/*
|
||||
* Hide invisible groups and items
|
||||
*/
|
||||
$('ul.top-level > li', this.$el).each(function() {
|
||||
var $li = $(this),
|
||||
groupIsVisible = $.inArray(this, visibleGroups) !== -1
|
||||
|
||||
$li.toggleClass('hidden', !groupIsVisible)
|
||||
if (groupIsVisible)
|
||||
self.expandGroup($li, 0)
|
||||
|
||||
$('ul li', $li).each(function(){
|
||||
var $itemLi = $(this)
|
||||
|
||||
$itemLi.toggleClass('hidden', $.inArray(this, visibleItems) == -1)
|
||||
})
|
||||
})
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
SidenavTree.prototype.textContainsWords = function(text, words) {
|
||||
text = text.toLowerCase()
|
||||
|
||||
for (var i = 0; i < words.length; i++) {
|
||||
if (text.indexOf(words[i]) === -1)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// SIDENAVTREE PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.sidenavTree
|
||||
|
||||
$.fn.sidenavTree = function (option) {
|
||||
var args = arguments;
|
||||
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.sidenavTree')
|
||||
var options = $.extend({}, SidenavTree.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
|
||||
if (!data) $this.data('oc.sidenavTree', (data = new SidenavTree(this, options)))
|
||||
if (typeof option == 'string') {
|
||||
var methodArgs = [];
|
||||
for (var i=1; i<args.length; i++)
|
||||
methodArgs.push(args[i])
|
||||
|
||||
data[option].apply(data, methodArgs)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.sidenavTree.Constructor = SidenavTree
|
||||
|
||||
// SIDENAVREE NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.sidenavTree.noConflict = function () {
|
||||
$.fn.sidenavTree = old
|
||||
return this
|
||||
}
|
||||
|
||||
// SIDENAVTREE DATA-API
|
||||
// ===============
|
||||
|
||||
$(document).ready(function () {
|
||||
$('[data-control=sidenav-tree]').sidenavTree()
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
142
modules/backend/assets/js/winter.sidenav.js
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Side Navigation
|
||||
*
|
||||
* Data attributes:
|
||||
* - data-control="sidenav" - enables the side navigation plugin
|
||||
*
|
||||
* JavaScript API:
|
||||
* $('#nav').sideNav()
|
||||
* $.wn.sideNav.setCounter('cms/partials', 5); - sets the counter value for a particular menu item
|
||||
* $.wn.sideNav.increaseCounter('cms/partials', 5); - increases the counter value for a particular menu item
|
||||
* $.wn.sideNav.dropCounter('cms/partials'); - drops the counter value for a particular menu item
|
||||
*
|
||||
* Dependences:
|
||||
* - Drag Scroll (winter.dragscroll.js)
|
||||
*/
|
||||
|
||||
+function ($) { "use strict";
|
||||
if ($.wn === undefined)
|
||||
$.wn = {}
|
||||
if ($.oc === undefined)
|
||||
$.oc = $.wn
|
||||
|
||||
// SIDENAV CLASS DEFINITION
|
||||
// ============================
|
||||
|
||||
var SideNav = function(element, options) {
|
||||
this.options = options
|
||||
this.$el = $(element)
|
||||
this.$list = $('ul', this.$el)
|
||||
this.$items = $('li', this.$list)
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
SideNav.DEFAULTS = {
|
||||
activeClass: 'active'
|
||||
}
|
||||
|
||||
SideNav.prototype.init = function (){
|
||||
var self = this
|
||||
|
||||
this.$list.dragScroll({
|
||||
vertical: true,
|
||||
useNative: true,
|
||||
start: function() { self.$list.addClass('drag') },
|
||||
stop: function() { self.$list.removeClass('drag') },
|
||||
scrollClassContainer: self.$el,
|
||||
scrollMarkerContainer: self.$el
|
||||
})
|
||||
|
||||
this.$list.on('click', function() {
|
||||
/* Do not handle menu item clicks while dragging */
|
||||
if (self.$list.hasClass('drag')) {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
SideNav.prototype.unsetActiveItem = function (itemId){
|
||||
this.$items.removeClass(this.options.activeClass)
|
||||
}
|
||||
|
||||
SideNav.prototype.setActiveItem = function (itemId){
|
||||
if (!itemId) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$items
|
||||
.removeClass(this.options.activeClass)
|
||||
.filter('[data-menu-item='+itemId+']')
|
||||
.addClass(this.options.activeClass)
|
||||
}
|
||||
|
||||
SideNav.prototype.setCounter = function (itemId, value){
|
||||
var $counter = $('span.counter[data-menu-id="'+itemId+'"]', this.$el)
|
||||
|
||||
$counter.removeClass('empty')
|
||||
$counter.toggleClass('empty', value == 0)
|
||||
$counter.text(value)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
SideNav.prototype.increaseCounter = function (itemId, value){
|
||||
var $counter = $('span.counter[data-menu-id="'+itemId+'"]', this.$el)
|
||||
|
||||
var originalValue = parseInt($counter.text())
|
||||
if (isNaN(originalValue))
|
||||
originalValue = 0
|
||||
|
||||
var newValue = value + originalValue
|
||||
$counter.toggleClass('empty', newValue == 0)
|
||||
$counter.text(newValue)
|
||||
return this
|
||||
}
|
||||
|
||||
SideNav.prototype.dropCounter = function (itemId){
|
||||
this.setCounter(itemId, 0)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
// SIDENAV PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.sideNav
|
||||
|
||||
$.fn.sideNav = function (option) {
|
||||
var args = Array.prototype.slice.call(arguments, 1), result
|
||||
this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.sideNav')
|
||||
var options = $.extend({}, SideNav.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('oc.sideNav', (data = new SideNav(this, options)))
|
||||
if (typeof option == 'string') result = data[option].apply(data, args)
|
||||
if (typeof result != 'undefined') return false
|
||||
|
||||
if ($.wn.sideNav === undefined)
|
||||
$.wn.sideNav = data
|
||||
})
|
||||
|
||||
return result ? result : this
|
||||
}
|
||||
|
||||
$.fn.sideNav.Constructor = SideNav
|
||||
|
||||
// SIDENAV NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.sideNav.noConflict = function () {
|
||||
$.fn.sideNav = old
|
||||
return this
|
||||
}
|
||||
|
||||
// SIDENAV DATA-API
|
||||
// ===============
|
||||
|
||||
$(document).ready(function(){
|
||||
$('[data-control="sidenav"]').sideNav()
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
258
modules/backend/assets/js/winter.sidepaneltab.js
Normal file
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* Side Panel Tabs
|
||||
*/
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
var SidePanelTab = function(element, options) {
|
||||
this.options = options
|
||||
this.$el = $(element)
|
||||
this.init()
|
||||
}
|
||||
|
||||
SidePanelTab.prototype.init = function() {
|
||||
var self = this
|
||||
this.tabOpenDelay = 200
|
||||
this.tabOpenTimeout = undefined
|
||||
this.panelOpenTimeout = undefined
|
||||
this.$sideNav = $('#layout-sidenav')
|
||||
this.$sideNavItems = $('ul li', this.$sideNav)
|
||||
this.$sidePanelItems = $('[data-content-id]', this.$el)
|
||||
this.sideNavWidth = this.$sideNavItems.outerWidth()
|
||||
this.mainNavHeight = $('#layout-mainmenu').outerHeight()
|
||||
this.panelVisible = false
|
||||
this.visibleItemId = false
|
||||
this.$fixButton = $('<a href="#" class="fix-button"><i class="icon-thumb-tack"></i></a>')
|
||||
|
||||
this.$fixButton.click(function() {
|
||||
self.fixPanel()
|
||||
return false
|
||||
})
|
||||
$('.fix-button-container', this.$el).append(this.$fixButton)
|
||||
|
||||
this.$sideNavItems.click(function() {
|
||||
if ($(this).data('no-side-panel')) {
|
||||
return
|
||||
}
|
||||
|
||||
if (Modernizr.touchevents && $(window).width() < self.options.breakpoint) {
|
||||
if ($(this).data('menu-item') == self.visibleItemId && self.panelVisible) {
|
||||
self.hideSidePanel()
|
||||
return
|
||||
}
|
||||
else {
|
||||
self.displaySidePanel()
|
||||
}
|
||||
}
|
||||
|
||||
self.displayTab(this)
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
if (!Modernizr.touchevents) {
|
||||
// The side panel now opens only when a menu item is hovered and
|
||||
// when the item doesn't have the "data-no-side-panel" attribute.
|
||||
// TODO: remove the comment and the code below if no issues noticed.
|
||||
// self.$sideNav.mouseenter(function() {
|
||||
// if ($(window).width() < self.options.breakpoint || !self.panelFixed()) {
|
||||
// self.panelOpenTimeout = setTimeout(function() {
|
||||
// self.displaySidePanel()
|
||||
// }, self.tabOpenDelay)
|
||||
// }
|
||||
// })
|
||||
|
||||
self.$sideNav.mouseleave(function() {
|
||||
clearTimeout(self.panelOpenTimeout)
|
||||
})
|
||||
|
||||
self.$el.mouseleave(function() {
|
||||
self.hideSidePanel()
|
||||
})
|
||||
|
||||
self.$sideNavItems.mouseenter(function() {
|
||||
if ($(window).width() < self.options.breakpoint || !self.panelFixed()) {
|
||||
if ($(this).data('no-side-panel')) {
|
||||
self.hideSidePanel()
|
||||
return
|
||||
}
|
||||
|
||||
var _this = this
|
||||
self.tabOpenTimeout = setTimeout(function() {
|
||||
self.displaySidePanel()
|
||||
self.displayTab(_this)
|
||||
}, self.tabOpenDelay)
|
||||
}
|
||||
})
|
||||
|
||||
self.$sideNavItems.mouseleave(function() {
|
||||
clearTimeout(self.tabOpenTimeout)
|
||||
})
|
||||
|
||||
$(window).resize(function() {
|
||||
self.updatePanelPosition()
|
||||
self.updateActiveTab()
|
||||
})
|
||||
}
|
||||
else {
|
||||
$('#layout-body').click(function() {
|
||||
if (self.panelVisible) {
|
||||
self.hideSidePanel()
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
self.$el.on('close.oc.sidePanel', function() {
|
||||
self.hideSidePanel()
|
||||
})
|
||||
}
|
||||
|
||||
this.updateActiveTab()
|
||||
}
|
||||
|
||||
SidePanelTab.prototype.displayTab = function(menuItem) {
|
||||
var menuItemId = $(menuItem).data('menu-item')
|
||||
|
||||
this.visibleItemId = menuItemId
|
||||
|
||||
if ($.wn.sideNav !== undefined) {
|
||||
$.wn.sideNav.setActiveItem(menuItemId)
|
||||
}
|
||||
|
||||
this.$sidePanelItems.each(function() {
|
||||
var $el = $(this)
|
||||
$el.toggleClass('hide', $el.data('content-id') != menuItemId)
|
||||
})
|
||||
|
||||
$(window).trigger('resize')
|
||||
}
|
||||
|
||||
SidePanelTab.prototype.displaySidePanel = function() {
|
||||
$(document.body).addClass('display-side-panel')
|
||||
|
||||
this.$el.appendTo('#layout-canvas')
|
||||
this.panelVisible = true
|
||||
this.$el.css({
|
||||
left: this.sideNavWidth,
|
||||
top: this.mainNavHeight
|
||||
})
|
||||
|
||||
this.updatePanelPosition()
|
||||
$(window).trigger('resize')
|
||||
}
|
||||
|
||||
SidePanelTab.prototype.hideSidePanel = function() {
|
||||
$(document.body).removeClass('display-side-panel')
|
||||
if (this.$el.next('#layout-body').length == 0) {
|
||||
$('#layout-body').before(this.$el)
|
||||
}
|
||||
|
||||
this.panelVisible = false
|
||||
|
||||
this.updateActiveTab()
|
||||
}
|
||||
|
||||
SidePanelTab.prototype.updatePanelPosition = function() {
|
||||
if (!this.panelFixed() || Modernizr.touchevents) {
|
||||
this.$el.height($(document).height() - this.mainNavHeight)
|
||||
}
|
||||
else {
|
||||
this.$el.css('height', '')
|
||||
}
|
||||
|
||||
if (this.panelVisible && $(window).width() > this.options.breakpoint && this.panelFixed()) {
|
||||
this.hideSidePanel()
|
||||
}
|
||||
}
|
||||
|
||||
SidePanelTab.prototype.updateActiveTab = function() {
|
||||
if ($.wn.sideNav === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.panelVisible && ($(window).width() < this.options.breakpoint || !this.panelFixed())) {
|
||||
$.wn.sideNav.unsetActiveItem()
|
||||
}
|
||||
else {
|
||||
$.wn.sideNav.setActiveItem(this.visibleItemId)
|
||||
}
|
||||
}
|
||||
|
||||
SidePanelTab.prototype.panelFixed = function() {
|
||||
return !($(window).width() < this.options.breakpoint) &&
|
||||
!$(document.body).hasClass('side-panel-not-fixed')
|
||||
}
|
||||
|
||||
SidePanelTab.prototype.fixPanel = function() {
|
||||
$(document.body).toggleClass('side-panel-not-fixed')
|
||||
|
||||
var self = this
|
||||
|
||||
window.setTimeout(function() {
|
||||
var fixed = self.panelFixed()
|
||||
|
||||
if (fixed) {
|
||||
self.updateActiveTab()
|
||||
$(document.body).addClass('side-panel-fix-shadow')
|
||||
} else {
|
||||
$(document.body).removeClass('side-panel-fix-shadow')
|
||||
self.hideSidePanel()
|
||||
}
|
||||
|
||||
if (typeof(localStorage) !== 'undefined')
|
||||
localStorage.ocSidePanelFixed = fixed ? 1 : 0
|
||||
}, 0)
|
||||
}
|
||||
|
||||
SidePanelTab.DEFAULTS = {
|
||||
breakpoint: 769
|
||||
}
|
||||
|
||||
// PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.sidePanelTab
|
||||
|
||||
$.fn.sidePanelTab = function (option) {
|
||||
return this.each(function() {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.sidePanelTab')
|
||||
var options = $.extend({}, SidePanelTab.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('oc.sidePanelTab', (data = new SidePanelTab(this, options)))
|
||||
if (typeof option == 'string') data[option].call(data)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.sidePanelTab.Constructor = SidePanelTab
|
||||
|
||||
// NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.sidePanelTab.noConflict = function() {
|
||||
$.fn.sidePanelTab = old
|
||||
return this
|
||||
}
|
||||
|
||||
// DATA-API
|
||||
// ============
|
||||
|
||||
$(document).ready(function(){
|
||||
$('[data-control=layout-sidepanel]').sidePanelTab()
|
||||
})
|
||||
|
||||
// STORED PREFERENCES
|
||||
// ====================
|
||||
|
||||
$(document).ready(function() {
|
||||
if (Modernizr.touchevents || (typeof(localStorage) !== 'undefined')) {
|
||||
if (localStorage.ocSidePanelFixed == 0) {
|
||||
$(document.body).addClass('side-panel-not-fixed')
|
||||
$(window).trigger('resize')
|
||||
}
|
||||
else if (localStorage.ocSidePanelFixed == 1) {
|
||||
$(document.body).removeClass('side-panel-not-fixed')
|
||||
$(window).trigger('resize')
|
||||
}
|
||||
}
|
||||
})
|
||||
}(window.jQuery);
|
||||
81
modules/backend/assets/js/winter.simplelist.js
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* SimpleList control.
|
||||
*
|
||||
* Data attributes:
|
||||
* - data-control="simplelist" - enables the simplelist plugin
|
||||
*
|
||||
* JavaScript API:
|
||||
* $('#simplelist').simplelist()
|
||||
*
|
||||
* Dependences:
|
||||
* - Sortable (jquery-sortable.js)
|
||||
*/
|
||||
+function ($) { "use strict";
|
||||
|
||||
var SimpleList = function (element, options) {
|
||||
|
||||
var $el = this.$el = $(element)
|
||||
|
||||
this.options = options || {}
|
||||
|
||||
if ($el.hasClass('is-sortable')) {
|
||||
|
||||
/*
|
||||
* Make each list inside sortable
|
||||
*/
|
||||
var sortableOptions = {
|
||||
distance: 10
|
||||
}
|
||||
if (this.options.sortableHandle)
|
||||
sortableOptions[handle] = this.options.sortableHandle
|
||||
|
||||
$el.find('> ul, > ol').sortable(sortableOptions)
|
||||
}
|
||||
|
||||
if ($el.hasClass('is-scrollable')) {
|
||||
|
||||
/*
|
||||
* Inject a scrollbar container
|
||||
*/
|
||||
$el.wrapInner($('<div />').addClass('control-scrollbar'))
|
||||
var $scrollbar = $el.find('>.control-scrollbar:first')
|
||||
$scrollbar.scrollbar()
|
||||
}
|
||||
}
|
||||
|
||||
SimpleList.DEFAULTS = {
|
||||
sortableHandle: null
|
||||
}
|
||||
|
||||
// SIMPLE LIST PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.simplelist
|
||||
|
||||
$.fn.simplelist = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.simplelist')
|
||||
var options = $.extend({}, SimpleList.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('oc.simplelist', (data = new SimpleList(this, options)))
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.simplelist.Constructor = SimpleList
|
||||
|
||||
// SIMPLE LIST NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.simplelist.noConflict = function () {
|
||||
$.fn.simplelist = old
|
||||
return this
|
||||
}
|
||||
|
||||
// SIMPLE LIST DATA-API
|
||||
// ===============
|
||||
|
||||
$(document).render(function(){
|
||||
$('[data-control="simplelist"]').simplelist()
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
163
modules/backend/assets/js/winter.tabformexpandcontrols.js
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Extends the fancy tabs layout with expand controls in the tab
|
||||
* form sections. See main Builder page for example.
|
||||
* TODO: A similar layout is used in the CMS, Pages and Builder areas,
|
||||
* but only Builder uses this class.
|
||||
*/
|
||||
+function ($) { "use strict";
|
||||
var Base = $.wn.foundation.base,
|
||||
BaseProto = Base.prototype
|
||||
|
||||
var TabFormExpandControls = function ($tabsControlElement, options) {
|
||||
this.$tabsControlElement = $tabsControlElement
|
||||
this.options = $.extend(TabFormExpandControls.DEFAULTS, typeof options == 'object' && options)
|
||||
this.tabsControlId = null
|
||||
|
||||
Base.call(this)
|
||||
this.init()
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype = Object.create(BaseProto)
|
||||
TabFormExpandControls.prototype.constructor = TabFormExpandControls
|
||||
|
||||
TabFormExpandControls.prototype.init = function() {
|
||||
this.tabsControlId = this.$tabsControlElement.attr('id')
|
||||
|
||||
if (!this.tabsControlId) {
|
||||
throw new Error('The tab controls element should have the id attribute value.')
|
||||
}
|
||||
|
||||
this.registerHandlers()
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.dispose = function() {
|
||||
this.unregisterHandlers()
|
||||
|
||||
this.$tabsControlElement = null
|
||||
|
||||
BaseProto.dispose.call(this)
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.registerHandlers = function() {
|
||||
this.$tabsControlElement.on('initTab.oc.tab', this.proxy(this.initTab))
|
||||
this.$tabsControlElement.on('click', '[data-control="tabless-collapse-icon"]', this.proxy(this.tablessCollapseClicked))
|
||||
this.$tabsControlElement.on('click', '[data-control="primary-collapse-icon"]', this.proxy(this.primaryCollapseClicked))
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.unregisterHandlers = function() {
|
||||
this.$tabsControlElement.off('initTab.oc.tab', this.proxy(this.initTab))
|
||||
this.$tabsControlElement.off('click', '[data-control="tabless-collapse-icon"]', this.proxy(this.tablessCollapseClicked))
|
||||
this.$tabsControlElement.off('click', '[data-control="primary-collapse-icon"]', this.proxy(this.primaryCollapseClicked))
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.initTab = function(ev, data) {
|
||||
if ($(ev.target).attr('id') != this.tabsControlId)
|
||||
return
|
||||
|
||||
var $primaryPanel = this.findPrimaryPanel(data.pane),
|
||||
$panel = $('.form-tabless-fields', data.pane),
|
||||
$secondaryPanel = this.findSecondaryPanel(data.pane),
|
||||
hasSecondaryTabs = $secondaryPanel.length > 0
|
||||
|
||||
$secondaryPanel.addClass('secondary-content-tabs')
|
||||
$panel.append(this.createTablessCollapseIcon())
|
||||
|
||||
if (!hasSecondaryTabs) {
|
||||
$('.tab-pane', $primaryPanel).addClass('pane-compact')
|
||||
}
|
||||
|
||||
$('.nav-tabs', $primaryPanel).addClass('master-area')
|
||||
|
||||
if ($primaryPanel.length > 0) {
|
||||
$secondaryPanel.append(this.createPrimaryCollapseIcon())
|
||||
} else {
|
||||
$secondaryPanel.addClass('primary-collapsed')
|
||||
}
|
||||
|
||||
if (!$('a', data.tab).hasClass('new-template') && this.getLocalStorageValue('tabless', 0) == 1) {
|
||||
$panel.addClass('collapsed')
|
||||
}
|
||||
|
||||
if (this.getLocalStorageValue('primary', 0) == 1 && hasSecondaryTabs) {
|
||||
$primaryPanel.addClass('collapsed')
|
||||
$secondaryPanel.addClass('primary-collapsed')
|
||||
}
|
||||
|
||||
if (this.options.onInitTab) {
|
||||
this.options.onInitTab($('form', data.pane))
|
||||
}
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.tablessCollapseClicked = function(ev) {
|
||||
var $panel = $(ev.target).closest('.form-tabless-fields')
|
||||
|
||||
$panel.toggleClass('collapsed')
|
||||
this.setLocalStorageValue('tabless', $panel.hasClass('collapsed') ? 1 : 0)
|
||||
window.setTimeout(this.proxy(this.updateUi), 500)
|
||||
|
||||
ev.stopPropagation()
|
||||
return false
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.primaryCollapseClicked = function(ev) {
|
||||
var $pane = $(ev.target).closest('.tab-pane'),
|
||||
$primaryPanel = this.findPrimaryPanel($pane),
|
||||
$secondaryPanel = this.findSecondaryPanel($pane)
|
||||
|
||||
$primaryPanel.toggleClass('collapsed')
|
||||
$secondaryPanel.toggleClass('primary-collapsed')
|
||||
|
||||
this.updateUi()
|
||||
this.setLocalStorageValue('primary', $primaryPanel.hasClass('collapsed') ? 1 : 0)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.updateUi = function() {
|
||||
$(window).trigger('oc.updateUi')
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.createTablessCollapseIcon = function() {
|
||||
return $('<a href="javascript:;" class="tab-collapse-icon tabless" data-control="tabless-collapse-icon"><i class="icon-chevron-up"></i></a>')
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.createPrimaryCollapseIcon = function() {
|
||||
return $('<a href="javascript:;" class="tab-collapse-icon primary" data-control="primary-collapse-icon"><i class="icon-chevron-down"></i></a>')
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.generateStorageKey = function(section) {
|
||||
return 'oc' + section + this.tabsControlId.replace('-', '') + 'collapsed'
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.findPrimaryPanel = function(pane) {
|
||||
return $(pane).find('.control-tabs.primary-tabs')
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.findSecondaryPanel = function(pane) {
|
||||
return $(pane).find('.control-tabs.secondary-tabs')
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.getLocalStorageValue = function(section, defaultValue) {
|
||||
var key = this.generateStorageKey(section)
|
||||
|
||||
if (typeof(localStorage) !== 'undefined') {
|
||||
return localStorage[key]
|
||||
}
|
||||
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
TabFormExpandControls.prototype.setLocalStorageValue = function(section, value) {
|
||||
var key = this.generateStorageKey(section)
|
||||
|
||||
if (typeof(localStorage) !== 'undefined') {
|
||||
localStorage[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
TabFormExpandControls.DEFAULTS = {
|
||||
onInitTab: null
|
||||
}
|
||||
|
||||
$.wn.tabFormExpandControls = TabFormExpandControls
|
||||
}(window.jQuery);
|
||||
133
modules/backend/assets/js/winter.treelist.js
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* TreeList Widget
|
||||
*
|
||||
* Supported options:
|
||||
* - handle - class name to use as a handle
|
||||
* - nested - set to false if sorting should be kept within each OL container, if using
|
||||
* a handle it should be focused enough to exclude nested handles.
|
||||
*
|
||||
* Events:
|
||||
* - move.oc.treelist - triggered when a node on the tree is moved.
|
||||
*
|
||||
* Dependences:
|
||||
* - Sortable Plugin (winter.sortable.js)
|
||||
*/
|
||||
+function ($) { "use strict";
|
||||
var Base = $.wn.foundation.base,
|
||||
BaseProto = Base.prototype
|
||||
|
||||
var TreeListWidget = function (element, options) {
|
||||
this.$el = $(element)
|
||||
this.options = options || {};
|
||||
|
||||
Base.call(this)
|
||||
|
||||
$.wn.foundation.controlUtils.markDisposable(element)
|
||||
this.init()
|
||||
}
|
||||
|
||||
TreeListWidget.prototype = Object.create(BaseProto)
|
||||
TreeListWidget.prototype.constructor = TreeListWidget
|
||||
|
||||
TreeListWidget.prototype.init = function() {
|
||||
var sortableOptions = {
|
||||
handle: this.options.handle,
|
||||
nested: this.options.nested,
|
||||
onDrop: this.proxy(this.onDrop),
|
||||
afterMove: this.proxy(this.onAfterMove)
|
||||
}
|
||||
|
||||
this.$el.find('> ol').sortable($.extend(sortableOptions, this.options))
|
||||
|
||||
if (!this.options.nested)
|
||||
this.$el.find('> ol ol').sortable($.extend(sortableOptions, this.options))
|
||||
|
||||
this.$el.one('dispose-control', this.proxy(this.dispose))
|
||||
}
|
||||
|
||||
TreeListWidget.prototype.dispose = function() {
|
||||
this.unbind()
|
||||
BaseProto.dispose.call(this)
|
||||
}
|
||||
|
||||
TreeListWidget.prototype.unbind = function() {
|
||||
this.$el.off('dispose-control', this.proxy(this.dispose))
|
||||
|
||||
this.$el.find('> ol').sortable('destroy')
|
||||
|
||||
if (!this.options.nested) {
|
||||
this.$el.find('> ol ol').sortable('destroy')
|
||||
}
|
||||
|
||||
this.$el.removeData('oc.treelist')
|
||||
|
||||
this.$el = null
|
||||
this.options = null
|
||||
}
|
||||
|
||||
TreeListWidget.DEFAULTS = {
|
||||
handle: null,
|
||||
nested: true
|
||||
}
|
||||
|
||||
// TREELIST EVENT HANDLERS
|
||||
// ============================
|
||||
|
||||
TreeListWidget.prototype.onDrop = function($item, container, _super) {
|
||||
// The event handler could be registered after the
|
||||
// sortable is destroyed. This should be fixed later.
|
||||
if (!this.$el) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$el.trigger('move.oc.treelist', { item: $item, container: container })
|
||||
_super($item, container)
|
||||
}
|
||||
|
||||
TreeListWidget.prototype.onAfterMove = function($placeholder, container, $closestEl) {
|
||||
if (!this.$el) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$el.trigger('aftermove.oc.treelist', { placeholder: $placeholder, container: container, closestEl: $closestEl })
|
||||
}
|
||||
|
||||
// TREELIST WIDGET PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.treeListWidget
|
||||
|
||||
$.fn.treeListWidget = function (option) {
|
||||
var args = arguments,
|
||||
result
|
||||
|
||||
this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.treelist')
|
||||
var options = $.extend({}, TreeListWidget.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('oc.treelist', (data = new TreeListWidget(this, options)))
|
||||
if (typeof option == 'string') result = data[option].call(data)
|
||||
if (typeof result != 'undefined') return false
|
||||
})
|
||||
|
||||
return result ? result : this
|
||||
}
|
||||
|
||||
$.fn.treeListWidget.Constructor = TreeListWidget
|
||||
|
||||
// TREELIST WIDGET NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.treeListWidget.noConflict = function () {
|
||||
$.fn.treeListWidget = old
|
||||
return this
|
||||
}
|
||||
|
||||
// TREELIST WIDGET DATA-API
|
||||
// ==============
|
||||
|
||||
$(document).render(function(){
|
||||
$('[data-control="treelist"]').treeListWidget();
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
437
modules/backend/assets/js/winter.treeview.js
Normal file
@@ -0,0 +1,437 @@
|
||||
/*
|
||||
* TreeView Widget. Represents a sortable and draggable tree view. This widget was first used in the Pages plugin, for the sidebar page tree.
|
||||
*
|
||||
* Data attributes:
|
||||
* - data-group-status-handler - AJAX handler to execute when an item is collapsed or expanded by a user
|
||||
* - data-reorder-handler - AJAX handler to execute when items are reordered
|
||||
*
|
||||
* Events
|
||||
* - open.oc.treeview - this event is triggered on the list element when an item is clicked.
|
||||
*
|
||||
* Dependences:
|
||||
* - Tree list (winter.treelist.js)
|
||||
*
|
||||
*/
|
||||
+function ($) { "use strict";
|
||||
var Base = $.wn.foundation.base,
|
||||
BaseProto = Base.prototype
|
||||
|
||||
var TreeView = function (element, options) {
|
||||
this.$el = $(element)
|
||||
this.options = options
|
||||
this.$allItems = null
|
||||
this.$scrollbar = null
|
||||
|
||||
Base.call(this)
|
||||
|
||||
$.wn.foundation.controlUtils.markDisposable(element)
|
||||
this.init()
|
||||
}
|
||||
|
||||
TreeView.prototype = Object.create(BaseProto)
|
||||
TreeView.prototype.constructor = TreeView
|
||||
|
||||
TreeView.prototype.init = function () {
|
||||
this.$allItems = $('li', this.$el)
|
||||
this.$scrollbar = this.$el.closest('[data-control=scrollbar]')
|
||||
|
||||
/*
|
||||
* Init the sortable
|
||||
*/
|
||||
|
||||
this.initSortable()
|
||||
|
||||
/*
|
||||
* Create expand/collapse icons and drag handles
|
||||
*/
|
||||
|
||||
this.createItemControls()
|
||||
|
||||
/*
|
||||
* Bind the click events
|
||||
*/
|
||||
|
||||
this.$el.on('click.treeview', 'li > div > ul.submenu li a', this.proxy(this.onOpenSubmenu))
|
||||
this.$el.on('click.treeview', 'li > div > a', this.proxy(this.onOpen))
|
||||
this.$el.on('click.treeview', 'li span.expand', this.proxy(this.onItemExpandClick))
|
||||
|
||||
/*
|
||||
* Listen for the AJAX updates and dispose the widget
|
||||
*/
|
||||
|
||||
this.$el.one('dispose-control', this.proxy(this.dispose))
|
||||
|
||||
/*
|
||||
* Mark previously active item, if it was set
|
||||
*/
|
||||
var dataId = this.$el.data('oc.active-item')
|
||||
if (dataId !== undefined) {
|
||||
this.markActive(dataId)
|
||||
}
|
||||
|
||||
this.$scrollbar.on('oc.scrollEnd', this.proxy(this.onScroll))
|
||||
}
|
||||
|
||||
TreeView.prototype.dispose = function() {
|
||||
this.unregisterHandlers()
|
||||
this.clearScrollTimeout()
|
||||
|
||||
this.options = null
|
||||
this.$el.removeData('oc.treeView')
|
||||
this.$el = null
|
||||
this.$allItems = null
|
||||
this.$scrollbar = null
|
||||
|
||||
BaseProto.dispose.call(this)
|
||||
}
|
||||
|
||||
TreeView.prototype.unregisterHandlers = function() {
|
||||
this.$scrollbar.off('oc.scrollEnd', this.proxy(this.onScroll))
|
||||
this.$el.off('.treeview')
|
||||
this.$el.off('move.oc.treelist', this.proxy(this.onNodeMove))
|
||||
this.$el.off('aftermove.oc.treelist', this.proxy(this.onAfterNodeMove))
|
||||
this.$el.off('dispose-control', this.proxy(this.dispose))
|
||||
}
|
||||
|
||||
TreeView.prototype.createItemControls = function() {
|
||||
$('li', this.$el).each(function() {
|
||||
var $container = $('> div', this),
|
||||
$expand = $('> span.expand', $container)
|
||||
|
||||
if ($expand.length > 0)
|
||||
return
|
||||
|
||||
$expand = $('<span class="expand">Expand</span>')
|
||||
|
||||
$container.prepend($expand)
|
||||
|
||||
if (!$('.drag-handle', $container).length)
|
||||
$container.append($('<span class="drag-handle">Drag</span>'))
|
||||
|
||||
$container.append($('<span class="borders"></span>'))
|
||||
|
||||
if ($(this).attr('data-no-drag-mode') !== undefined)
|
||||
$('span.drag-handle', this).attr('title', 'Dragging is disabled when the Search is active')
|
||||
})
|
||||
}
|
||||
|
||||
TreeView.prototype.collapseGroup = function($group) {
|
||||
var $subitems = $('> ol', $group)
|
||||
|
||||
$subitems.css({
|
||||
'overflow': 'hidden'
|
||||
})
|
||||
|
||||
$subitems.animate({'height': 0}, { duration: 100, queue: false, complete: function() {
|
||||
$subitems.css({
|
||||
'overflow': 'visible',
|
||||
'display': 'none',
|
||||
'height' : 'auto'
|
||||
})
|
||||
$group.attr('data-status', 'collapsed')
|
||||
$(window).trigger('resize')
|
||||
} })
|
||||
|
||||
this.sendGroupStatusRequest($group, 0)
|
||||
}
|
||||
|
||||
TreeView.prototype.expandGroup = function($group) {
|
||||
var $subitems = $('> ol', $group)
|
||||
|
||||
$subitems.css({
|
||||
'overflow': 'hidden',
|
||||
'display': 'block',
|
||||
'height': 0
|
||||
})
|
||||
|
||||
$group.attr('data-status', 'expanded')
|
||||
$subitems.animate({'height': $subitems[0].scrollHeight}, { duration: 100, queue: false, complete: function() {
|
||||
$subitems.css({
|
||||
'overflow': 'visible',
|
||||
'height': 'auto'
|
||||
})
|
||||
$(window).trigger('resize')
|
||||
} })
|
||||
|
||||
this.sendGroupStatusRequest($group, 1);
|
||||
}
|
||||
|
||||
TreeView.prototype.fixSubItems = function() {
|
||||
$('li', this.$el).each(function(){
|
||||
var $li = $(this),
|
||||
$subitems = $('> ol > li', $li)
|
||||
$li.toggleClass('has-subitems', $subitems.length > 0)
|
||||
})
|
||||
}
|
||||
|
||||
TreeView.prototype.toggleGroup = function(group) {
|
||||
var $group = $(group);
|
||||
|
||||
$group.attr('data-status') == 'expanded'
|
||||
? this.collapseGroup($group)
|
||||
: this.expandGroup($group)
|
||||
}
|
||||
|
||||
TreeView.prototype.sendGroupStatusRequest = function($group, status) {
|
||||
if (this.options.groupStatusHandler !== undefined) {
|
||||
var groupId = $group.data('group-id')
|
||||
|
||||
$group.request(this.options.groupStatusHandler, {data: {group: groupId, status: status}})
|
||||
}
|
||||
}
|
||||
|
||||
TreeView.prototype.sendReorderRequest = function() {
|
||||
if (this.options.reorderHandler === undefined)
|
||||
return
|
||||
|
||||
var groups = {}
|
||||
|
||||
function iterator($container, node) {
|
||||
$('> li', $container).each(function(){
|
||||
var subnodes = {}
|
||||
iterator($('> ol', this), subnodes)
|
||||
|
||||
node[$(this).data('groupId')] = subnodes
|
||||
})
|
||||
}
|
||||
|
||||
iterator($('> ol', this.$el), groups)
|
||||
|
||||
this.$el.request(this.options.reorderHandler, {data: {structure: JSON.stringify(groups)}})
|
||||
}
|
||||
|
||||
TreeView.prototype.initSortable = function() {
|
||||
var $noDragItems = $('[data-no-drag-mode]', this.$el)
|
||||
|
||||
if ($noDragItems.length > 0)
|
||||
return
|
||||
|
||||
if (this.$el.data('oc.treelist'))
|
||||
this.$el.treeListWidget('unbind')
|
||||
|
||||
this.$el.treeListWidget({
|
||||
tweakCursorAdjustment: this.proxy(this.tweakCursorAdjustment),
|
||||
isValidTarget: this.proxy(this.isValidTarget),
|
||||
useAnimation: false,
|
||||
usePlaceholderClone: true,
|
||||
handle: 'span.drag-handle',
|
||||
onDrag: this.proxy(this.onDrag),
|
||||
tolerance: -20 // Give 20px of carry between containers
|
||||
})
|
||||
|
||||
this.$el.on('move.oc.treelist', this.proxy(this.onNodeMove))
|
||||
this.$el.on('aftermove.oc.treelist', this.proxy(this.onAfterNodeMove))
|
||||
}
|
||||
|
||||
TreeView.prototype.markActive = function(dataId) {
|
||||
$('li', this.$el).removeClass('active')
|
||||
|
||||
if (dataId)
|
||||
$('li[data-id="'+dataId+'"]', this.$el).addClass('active')
|
||||
|
||||
this.$el.data('oc.active-item', dataId)
|
||||
}
|
||||
|
||||
// It seems the method is not used anymore as we re-create the control
|
||||
// instead of updating it. Remove later if nothing weird is noticed.
|
||||
// -ab Apr 26 2015
|
||||
//
|
||||
TreeView.prototype.update = function() {
|
||||
this.$allItems = $('li', this.$el)
|
||||
this.createItemControls()
|
||||
//this.initSortable()
|
||||
|
||||
var dataId = this.$el.data('oc.active-item')
|
||||
if (dataId !== undefined) {
|
||||
this.markActive(dataId)
|
||||
}
|
||||
}
|
||||
|
||||
TreeView.prototype.handleMovedNode = function() {
|
||||
this.$el.trigger('change')
|
||||
this.$allItems.removeClass('drop-target')
|
||||
this.fixSubItems()
|
||||
this.sendReorderRequest()
|
||||
}
|
||||
|
||||
TreeView.prototype.tweakCursorAdjustment = function(adjustment) {
|
||||
if (!adjustment) {
|
||||
return adjustment
|
||||
}
|
||||
|
||||
if (this.$scrollbar.length > 0) {
|
||||
adjustment.top -= this.$scrollbar.scrollTop()
|
||||
}
|
||||
|
||||
return adjustment
|
||||
}
|
||||
|
||||
TreeView.prototype.isValidTarget = function($item, container) {
|
||||
return $(container.el).closest('li').attr('data-status') != 'collapsed'
|
||||
}
|
||||
|
||||
TreeView.DEFAULTS = {
|
||||
|
||||
}
|
||||
|
||||
// TREEVIEW EVENT HANDLERS
|
||||
// ============================
|
||||
|
||||
TreeView.prototype.onOpenSubmenu = function(ev) {
|
||||
var e = $.Event('submenu.oc.treeview', {relatedTarget: ev.currentTarget, clickEvent: ev})
|
||||
this.$el.trigger(e, this)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
TreeView.prototype.onOpen = function(ev) {
|
||||
var e = $.Event('open.oc.treeview', {relatedTarget: $(ev.currentTarget).closest('li').get(0), clickEvent: ev})
|
||||
this.$el.trigger(e, ev.currentTarget)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
TreeView.prototype.onNodeMove = function() {
|
||||
setTimeout(this.proxy(this.handleMovedNode), 50)
|
||||
}
|
||||
|
||||
TreeView.prototype.onAfterNodeMove = function(ev, data) {
|
||||
this.$allItems.removeClass('drop-target')
|
||||
data.container.el.closest('li').addClass('drop-target')
|
||||
}
|
||||
|
||||
TreeView.prototype.onItemExpandClick = function(ev) {
|
||||
this.toggleGroup($(ev.currentTarget).closest('li'))
|
||||
return false
|
||||
}
|
||||
|
||||
// TREEVIEW SCROLL ON DRAG
|
||||
// ============================
|
||||
|
||||
TreeView.prototype.onScroll = function () {
|
||||
if (!$('body').hasClass('dragging')) {
|
||||
return
|
||||
}
|
||||
|
||||
var changed = this.lastScrollPos - this.$scrollbar.scrollTop()
|
||||
|
||||
this.$el.children('ol').each(function() {
|
||||
var sortable = $(this).data('oc.sortable')
|
||||
sortable.refresh()
|
||||
sortable.cursorAdjustment.top += changed // Keep cursor adjustment in sync with scroll
|
||||
});
|
||||
|
||||
this.dragCallback()
|
||||
|
||||
this.lastScrollPos = this.$scrollbar.scrollTop()
|
||||
}
|
||||
|
||||
TreeView.prototype.onDrag = function ($item, position, _super, event) {
|
||||
this.lastScrollPos = this.$scrollbar.scrollTop()
|
||||
|
||||
this.dragCallback = function() {
|
||||
_super($item, position, null, event)
|
||||
};
|
||||
|
||||
this.clearScrollTimeout()
|
||||
this.dragCallback()
|
||||
|
||||
if (!this.$scrollbar || this.$scrollbar.length === 0)
|
||||
return
|
||||
|
||||
if (position.top < 0) {
|
||||
this.scrollOffset = -10 + Math.floor(position.top / 5)
|
||||
}
|
||||
else if (position.top > this.$scrollbar.height()) {
|
||||
this.scrollOffset = 10 + Math.ceil((position.top - this.$scrollbar.height()) / 5)
|
||||
}
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
this.dragScroll()
|
||||
}
|
||||
|
||||
TreeView.prototype.scrollMax = function() {
|
||||
return this.$el.height() - this.$scrollbar.height()
|
||||
}
|
||||
|
||||
TreeView.prototype.dragScroll = function() {
|
||||
var startScrollTop = this.$scrollbar.scrollTop()
|
||||
var changed
|
||||
|
||||
this.scrollTimeout = null
|
||||
|
||||
this.$scrollbar.scrollTop(Math.min(startScrollTop + this.scrollOffset, this.scrollMax()))
|
||||
|
||||
changed = this.$scrollbar.scrollTop() - startScrollTop
|
||||
if (changed === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$el.children('ol').each(function() {
|
||||
var sortable = $(this).data('oc.sortable')
|
||||
sortable.refresh()
|
||||
sortable.cursorAdjustment.top -= changed // Keep cursor adjustment in sync with scroll
|
||||
});
|
||||
|
||||
this.dragCallback()
|
||||
|
||||
this.$scrollbar.data('oc.scrollbar').setThumbPosition() // Update scrollbar position
|
||||
|
||||
this.scrollTimeout = window.setTimeout(this.proxy(this.dragScroll), 100)
|
||||
}
|
||||
|
||||
TreeView.prototype.clearScrollTimeout = function() {
|
||||
if (this.scrollTimeout) {
|
||||
window.clearTimeout(this.scrollTimeout)
|
||||
this.scrollTimeout = null
|
||||
}
|
||||
}
|
||||
|
||||
// TREEVIEW PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.treeView
|
||||
|
||||
$.fn.treeView = function (option) {
|
||||
var args = arguments
|
||||
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.treeView')
|
||||
var options = $.extend({}, TreeView.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('oc.treeView', (data = new TreeView(this, options)))
|
||||
|
||||
if (typeof option == 'string' && data) {
|
||||
var methodArgs = [];
|
||||
for (var i=1; i<args.length; i++)
|
||||
methodArgs.push(args[i])
|
||||
|
||||
if (data[option])
|
||||
data[option].apply(data, methodArgs)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.treeView.Constructor = TreeView
|
||||
|
||||
// TREEVIEW NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.treeView.noConflict = function () {
|
||||
$.fn.treeView = old
|
||||
return this
|
||||
}
|
||||
|
||||
// TREEVIEW DATA-API
|
||||
// ===============
|
||||
// $(window).load(function(){
|
||||
// $('[data-control=treeview]').treeView()
|
||||
// })
|
||||
|
||||
$(document).render(function(){
|
||||
$('[data-control=treeview]').treeView()
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
159
modules/backend/assets/js/winter.verticalmenu.js
Normal file
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Creates a vertical responsive menu.
|
||||
*
|
||||
* JavaScript API:
|
||||
* $('#menu').verticalMenu()
|
||||
*
|
||||
* Dependences:
|
||||
* - Drag Scroll (winter.dragscroll.js)
|
||||
*/
|
||||
+function ($) { "use strict";
|
||||
|
||||
var VerticalMenu = function (element, toggle, options) {
|
||||
this.$el = $(element)
|
||||
this.body = $('body')
|
||||
this.toggle = $(toggle)
|
||||
this.options = options || {}
|
||||
this.options = $.extend({}, VerticalMenu.DEFAULTS, this.options)
|
||||
this.wrapper = $(this.options.contentWrapper)
|
||||
this.breakpoint = options.breakpoint
|
||||
|
||||
/*
|
||||
* Insert the menu
|
||||
*/
|
||||
this.menuPanel = $('<div></div>').appendTo('body').addClass(this.options.collapsedMenuClass).css('width', 0)
|
||||
this.menuContainer = $('<div></div>').appendTo(this.menuPanel).css('display', 'none')
|
||||
this.menuElement = this.$el.clone().appendTo(this.menuContainer).css('width', 'auto')
|
||||
|
||||
var self = this
|
||||
|
||||
/*
|
||||
* Handle the menu toggle click
|
||||
*/
|
||||
this.toggle.click(function() {
|
||||
if (!self.body.hasClass(self.options.bodyMenuOpenClass)) {
|
||||
var wrapperWidth = self.wrapper.outerWidth()
|
||||
|
||||
self.menuElement.dragScroll('goToStart')
|
||||
|
||||
self.wrapper.css({
|
||||
'position': 'absolute',
|
||||
'min-width': self.wrapper.width(),
|
||||
'height': '100%'
|
||||
})
|
||||
self.body.addClass(self.options.bodyMenuOpenClass)
|
||||
self.menuContainer.css('display', 'block')
|
||||
|
||||
self.wrapper.animate({'left': self.options.menuWidth}, { duration: 200, queue: false })
|
||||
self.menuPanel.animate({'width': self.options.menuWidth}, {
|
||||
duration: 200,
|
||||
queue: false,
|
||||
complete: function() {
|
||||
self.menuElement.css('width', self.options.menuWidth)
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
closeMenu()
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
this.wrapper.click(function() {
|
||||
if (self.body.hasClass(self.options.bodyMenuOpenClass)) {
|
||||
closeMenu()
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
/*
|
||||
* Disable the menu if the window is wider than the breakpoint width
|
||||
*/
|
||||
$(window).resize(function() {
|
||||
if (self.body.hasClass(self.options.bodyMenuOpenClass)) {
|
||||
if ($(window).width() > self.breakpoint) {
|
||||
hideMenu()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/*
|
||||
* Make the menu draggable
|
||||
*/
|
||||
this.menuElement.dragScroll({
|
||||
vertical: true,
|
||||
useNative: true,
|
||||
start: function(){self.menuElement.addClass('drag')},
|
||||
stop: function(){self.menuElement.removeClass('drag')},
|
||||
scrollClassContainer: self.menuPanel,
|
||||
scrollMarkerContainer: self.menuContainer
|
||||
})
|
||||
|
||||
this.menuElement.on('click', function() {
|
||||
// Do not handle menu item clicks while dragging
|
||||
if (self.menuElement.hasClass('drag'))
|
||||
return false
|
||||
})
|
||||
|
||||
/*
|
||||
* Internal event, completely hides the menu
|
||||
*/
|
||||
function hideMenu() {
|
||||
self.body.removeClass(self.options.bodyMenuOpenClass)
|
||||
self.wrapper.css({
|
||||
'position': 'static',
|
||||
'min-width': 0,
|
||||
'right': 0,
|
||||
'height': '100%'
|
||||
})
|
||||
self.menuPanel.css('width', 0)
|
||||
self.menuElement.css('width', 'auto')
|
||||
self.menuContainer.css('display', 'none')
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal event, smoothly collapses the menu
|
||||
*/
|
||||
function closeMenu() {
|
||||
self.wrapper.animate({'left': 0}, { duration: 200, queue: false})
|
||||
self.menuPanel.animate({'width': 0}, { duration: 200, queue: false, complete: hideMenu })
|
||||
self.menuElement.animate({'width': 0}, { duration: 200, queue: false })
|
||||
}
|
||||
}
|
||||
|
||||
VerticalMenu.DEFAULTS = {
|
||||
menuWidth: 230,
|
||||
breakpoint: 769,
|
||||
bodyMenuOpenClass: 'mainmenu-open',
|
||||
collapsedMenuClass: 'mainmenu-collapsed',
|
||||
contentWrapper: '#layout-canvas'
|
||||
}
|
||||
|
||||
// VERTICAL MENU PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.verticalMenu
|
||||
|
||||
$.fn.verticalMenu = function (toggleSelector, option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.verticalMenu')
|
||||
var options = typeof option == 'object' && option
|
||||
|
||||
if (!data) $this.data('oc.verticalMenu', (data = new VerticalMenu(this, toggleSelector, options)))
|
||||
if (typeof option == 'string') data[option].call($this)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.verticalMenu.Constructor = VerticalMenu
|
||||
|
||||
// VERTICAL MENU NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.verticalMenu.noConflict = function () {
|
||||
$.fn.verticalMenu = old
|
||||
return this
|
||||
}
|
||||
|
||||
}(window.jQuery);
|
||||
1
modules/backend/assets/less/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.css
|
||||
37
modules/backend/assets/less/controls/alert.less
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Custom alerts (Based on Sweet Alert)
|
||||
// --------------------------------------------------
|
||||
|
||||
.sweet-overlay {
|
||||
background-color: @overlay-background;
|
||||
z-index: @zindex-alert - 1;
|
||||
}
|
||||
|
||||
.sweet-alert {
|
||||
text-align: right;
|
||||
border-radius: @border-radius-base;
|
||||
.box-shadow(@popup-box-shadow);
|
||||
z-index: @zindex-alert;
|
||||
|
||||
h2 {
|
||||
word-break: break-word;
|
||||
word-wrap: break-word;
|
||||
max-height: 350px;
|
||||
overflow-y: auto;
|
||||
|
||||
margin: 10px 0 17px 0;
|
||||
color: #2b3e50;
|
||||
text-align: left;
|
||||
font-size: 15px;
|
||||
line-height: 23px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
p.text-muted {
|
||||
margin-bottom: 20px;
|
||||
color: #555555;
|
||||
}
|
||||
}
|
||||
66
modules/backend/assets/less/controls/common.less
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// Common control styles
|
||||
// --------------------------------------------------
|
||||
|
||||
//
|
||||
// The scroll panel can host a scrollbar control. It has a right border that covers
|
||||
// the scrollbar to satisfy the design requirements.
|
||||
//
|
||||
.control-scrollpanel {
|
||||
position: relative;
|
||||
background: @color-panel-light;
|
||||
|
||||
.control-scrollbar {
|
||||
&.vertical > .scrollbar-scrollbar {right: 0;}
|
||||
}
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
.tooltip-inner {
|
||||
text-align: left;
|
||||
padding: 5px 8px;
|
||||
}
|
||||
|
||||
&.in {
|
||||
.opacity(1);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Logos
|
||||
//
|
||||
|
||||
.wn-logo-white, .oc-logo-white {
|
||||
background-image: url(../images/winter-logo-white.svg);
|
||||
background-position: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.wn-logo, .oc-logo {
|
||||
background-image: url(../images/winter-logo.svg);
|
||||
background-position: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.layout.control-tabs.wn-logo-transparent:not(.has-tabs), .layout.control-tabs.oc-logo-transparent:not(.has-tabs),
|
||||
.flex-layout-column.wn-logo-transparent:not(.has-tabs), .flex-layout-column.oc-logo-transparent:not(.has-tabs),
|
||||
.layout-cell.wn-logo-transparent, .layout-cell.oc-logo-transparent {
|
||||
background-size: 50% auto;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(../images/winter-logo.svg);
|
||||
background-position: 50% 50%;
|
||||
position: relative;
|
||||
|
||||
&:after {
|
||||
content: '';
|
||||
display: table-cell;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: rgba(249,249,249,0.7);
|
||||
}
|
||||
}
|
||||
427
modules/backend/assets/less/controls/filelist.less
Normal file
@@ -0,0 +1,427 @@
|
||||
//
|
||||
// File list control
|
||||
// --------------------------------------------------
|
||||
|
||||
.control-filelist {
|
||||
.listPaddings (@level, @offset-base) when (@level > 0) {
|
||||
> li.group {
|
||||
> ul {
|
||||
> li > a {
|
||||
padding-left: (@level+2)*@offset-base;
|
||||
margin-left: -1*@level*@offset-base;
|
||||
}
|
||||
|
||||
.listPaddings(@level - 1, @offset-base);
|
||||
}
|
||||
}
|
||||
}
|
||||
.listPaddings (0, 27px) {}
|
||||
|
||||
p.no-data {
|
||||
padding: 22px 0;
|
||||
margin: 0;
|
||||
color: @color-filelist-norecords-text;
|
||||
font-size: @font-size-base;
|
||||
text-align: center;
|
||||
font-weight: normal;
|
||||
.border-radius(@border-radius-base);
|
||||
}
|
||||
|
||||
ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
li {
|
||||
font-weight: normal;
|
||||
line-height: 150%;
|
||||
position: relative;
|
||||
list-style: none;
|
||||
|
||||
a:hover {
|
||||
background: @color-list-hover;
|
||||
}
|
||||
|
||||
&.active > a {
|
||||
background: @color-list-active;
|
||||
position: relative;
|
||||
&:after {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 4px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background: @color-list-active-border;
|
||||
display: block;
|
||||
content: ' ';
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
display: block;
|
||||
padding: 10px 45px 10px 20px;
|
||||
outline: none;
|
||||
|
||||
&:hover, &:focus, &:active {text-decoration: none;}
|
||||
|
||||
span {
|
||||
display: block;
|
||||
|
||||
&.title {
|
||||
font-weight: normal;
|
||||
color: @color-text-title;
|
||||
font-size: @font-size-base;
|
||||
}
|
||||
|
||||
&.description {
|
||||
color: @color-text-description;
|
||||
font-size: @font-size-base - 2;
|
||||
white-space: nowrap;
|
||||
font-weight: normal;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
strong {
|
||||
color: @color-text-title;
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.group {
|
||||
> h4, > div.group > h4 {
|
||||
font-weight: normal;
|
||||
font-size: @font-size-base;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
position: relative;
|
||||
|
||||
a {
|
||||
padding: 10px 20px 10px 53px;
|
||||
color: @color-text-title;
|
||||
position: relative;
|
||||
outline: none;
|
||||
|
||||
&:hover { background: transparent; }
|
||||
|
||||
&:before, &:after {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
}
|
||||
|
||||
&:after {
|
||||
left: 33px;
|
||||
top: 9px;
|
||||
.icon(@folder);
|
||||
color: @color-list-icon;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
&:before {
|
||||
left: 20px;
|
||||
top: 9px;
|
||||
color: @color-list-arrow;
|
||||
.icon(@caret-right);
|
||||
.transform( ~'rotate(90deg) translate(5px, 0)' );
|
||||
.transition(all 0.1s ease);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> ul {
|
||||
> li > a {
|
||||
padding-left: 52px;
|
||||
}
|
||||
|
||||
> li.group {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.listPaddings(10, 27px);
|
||||
}
|
||||
|
||||
&[data-status=collapsed] {
|
||||
> h4 a:before, > div.group > h4 a:before {
|
||||
.transform(~'rotate(0deg) translate(3px, 0)');
|
||||
}
|
||||
|
||||
& > ul, & > div.subitems {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> div.controls {
|
||||
position: absolute;
|
||||
right: 19px;
|
||||
top: 6px;
|
||||
|
||||
.dropdown {
|
||||
width: 14px;
|
||||
height: 21px;
|
||||
|
||||
&.open a.control {
|
||||
display: block!important;
|
||||
&:before {
|
||||
visibility: visible;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a.control {
|
||||
color: @color-text-title;
|
||||
font-size: @font-size-base;
|
||||
visibility: hidden;
|
||||
overflow: hidden;
|
||||
width: 14px;
|
||||
height: 21px;
|
||||
display: none;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
.opacity(0.5);
|
||||
&:before {
|
||||
visibility: visible;
|
||||
display: block;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.opacity(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
> div.controls, > a.control {
|
||||
display: block!important;
|
||||
|
||||
> a.control {
|
||||
display: block!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
right: 0;
|
||||
|
||||
label {
|
||||
margin-right: 0;
|
||||
|
||||
&:before {
|
||||
border-color: @color-filelist-cb-border;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.single-line {
|
||||
ul {
|
||||
li a span.title {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Templates have emphasis
|
||||
//
|
||||
|
||||
&.filelist-hero {
|
||||
.a-hover() {
|
||||
background: @color-filelist-hero-hover-bg;
|
||||
border-bottom: 1px solid @color-filelist-hero-hover-bg !important;
|
||||
span.title, span.description {
|
||||
color: @color-filelist-hero-hover-text !important;
|
||||
}
|
||||
|
||||
.list-icon {
|
||||
color: @color-filelist-hero-hover-text !important;
|
||||
}
|
||||
}
|
||||
|
||||
.a-active() {
|
||||
background: @color-filelist-hero-active-bg;
|
||||
border-bottom: 1px solid @color-filelist-hero-active-bg !important;
|
||||
span.title, span.description {
|
||||
color: @color-filelist-hero-active-text !important;
|
||||
}
|
||||
|
||||
.list-icon {
|
||||
color: @color-filelist-hero-active-text !important;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
li {
|
||||
background: @color-filelist-hero-item-bg;
|
||||
border-bottom: none;
|
||||
|
||||
> a {
|
||||
padding: 11px 45px 10px 50px;
|
||||
font-size: @font-size-base - 1;
|
||||
border-bottom: 1px solid @color-panel-light;
|
||||
|
||||
span.title {
|
||||
font-size: @font-size-base;
|
||||
font-weight: normal;
|
||||
color: @color-filelist-title-hero;
|
||||
}
|
||||
|
||||
span.description {
|
||||
font-size: @font-size-base - 1;
|
||||
}
|
||||
|
||||
.list-icon {
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 22px;
|
||||
color: #b7c0c2;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.a-hover();
|
||||
}
|
||||
|
||||
&:active {
|
||||
.a-active();
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
top: -2px;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
&.active {
|
||||
> a {
|
||||
border-bottom: 1px solid @color-list-active;
|
||||
|
||||
&:after {
|
||||
top: -1px;
|
||||
bottom: -1px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
> span.borders {
|
||||
&:before {
|
||||
content: ' ';
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
display: block;
|
||||
left: 0;
|
||||
background-color: @color-list-active;
|
||||
}
|
||||
|
||||
&:before {top: -1px;}
|
||||
}
|
||||
|
||||
&:hover > span.borders:before {
|
||||
background-color: @color-filelist-hero-hover-bg;
|
||||
}
|
||||
|
||||
&:active > span.borders:before {
|
||||
background-color: @color-filelist-hero-active-bg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> h4 {
|
||||
padding-top: 7px;
|
||||
padding-bottom: 6px;
|
||||
border-bottom: 1px solid @color-panel-light;
|
||||
}
|
||||
|
||||
> div.controls {
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: 16px;
|
||||
top: 15px;
|
||||
|
||||
> a.control {
|
||||
width: 16px;
|
||||
height: 23px;
|
||||
background: transparent;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
color: @color-filelist-hero-hover-text!important;
|
||||
padding: 0;
|
||||
|
||||
&:before {
|
||||
font-size: 17px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:hover > div.controls {
|
||||
display: block;
|
||||
}
|
||||
|
||||
&.separator {
|
||||
position: relative;
|
||||
border-bottom: 1px solid #95a5a6;
|
||||
padding: 12px 15px 13px 15px;
|
||||
|
||||
&:before {
|
||||
z-index: 31;
|
||||
.triangle(down, 19px, 11px, white);
|
||||
position: absolute;
|
||||
left: 13px;
|
||||
bottom: -8px;
|
||||
}
|
||||
|
||||
&:after {
|
||||
z-index: 30;
|
||||
.triangle(down, 17px, 9px, #95a5a6);
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
bottom: -9px;
|
||||
}
|
||||
|
||||
h5 {
|
||||
color: #2b3e50;
|
||||
font-size: @font-size-base;
|
||||
margin: 0;
|
||||
font-weight: normal;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> li.group {
|
||||
> ul > li > a {
|
||||
padding-left: 66px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.single-level {
|
||||
ul li:hover {
|
||||
background: @color-filelist-hero-hover-bg;
|
||||
|
||||
> a {
|
||||
.a-hover();
|
||||
}
|
||||
}
|
||||
ul li:active {
|
||||
background: @color-filelist-hero-active-bg;
|
||||
|
||||
> a {
|
||||
.a-active();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
modules/backend/assets/less/controls/global-notice.less
Normal file
@@ -0,0 +1,25 @@
|
||||
.global-notice {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5em;
|
||||
justify-content: space-between;
|
||||
z-index: 10500;
|
||||
background: #ab2a1c;
|
||||
color: #FFF;
|
||||
padding: 0.5em 0.75em;
|
||||
|
||||
.notice-icon {
|
||||
font-size: 1.5em;
|
||||
vertical-align: bottom;
|
||||
display: inline-block;
|
||||
margin-right: .25em;
|
||||
}
|
||||
|
||||
.notice-text {
|
||||
display: inline-block;
|
||||
vertical-align:middle;
|
||||
}
|
||||
}
|
||||
27
modules/backend/assets/less/controls/namevaluelist.less
Normal file
@@ -0,0 +1,27 @@
|
||||
table.name-value-list {
|
||||
border-collapse: collapse;
|
||||
font-size: 13px;
|
||||
|
||||
th, td {
|
||||
padding: 4px 0 4px 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
tr:first-child {
|
||||
th, td {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
th {
|
||||
font-weight: 600;
|
||||
color: #95a5a6;
|
||||
padding-right: 15px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
td {
|
||||
color: #2b3e50;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
77
modules/backend/assets/less/controls/panels.less
Normal file
@@ -0,0 +1,77 @@
|
||||
div.panel {
|
||||
@panel-border-color: #e8eaeb;
|
||||
|
||||
padding: 20px;
|
||||
|
||||
&.no-padding {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
&.no-padding-bottom {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
&.padding-top {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
&.padding-less {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
&.transparent {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
&.border-left {
|
||||
border-left: 1px solid @panel-border-color;
|
||||
}
|
||||
|
||||
&.border-right {
|
||||
border-right: 1px solid @panel-border-color;
|
||||
}
|
||||
|
||||
&.border-bottom {
|
||||
border-bottom: 1px solid @panel-border-color;
|
||||
}
|
||||
|
||||
&.border-top {
|
||||
border-top: 1px solid @panel-border-color;
|
||||
}
|
||||
|
||||
&.triangle-down {
|
||||
position: relative;
|
||||
|
||||
&:after {
|
||||
.triangle(down, 15px, 8px, white);
|
||||
position: absolute;
|
||||
left: 15px;
|
||||
bottom: -8px;
|
||||
z-index: 101;
|
||||
}
|
||||
|
||||
&:before {
|
||||
.triangle(down, 17px, 9px, #e8eaeb);
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
bottom: -9px;
|
||||
z-index: 100;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Panel sections
|
||||
*/
|
||||
|
||||
h3.section, > label {
|
||||
text-transform: uppercase;
|
||||
color: #95a5a6;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
margin: 0 0 15px 0;
|
||||
}
|
||||
|
||||
> label {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
69
modules/backend/assets/less/controls/record-navigation.less
Normal file
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Record navigation
|
||||
//
|
||||
// Previous/next navigation shown in the breadcrumb row of a form, letting the
|
||||
// user step through the sibling records of the controller's list (respecting
|
||||
// its active filters, search and sorting). Rendered by the FormController
|
||||
// behavior via formcontroller/partials/_record_navigation.php.
|
||||
// ========================================================================
|
||||
|
||||
.control-breadcrumb {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.form-record-nav {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 9px;
|
||||
font-size: 12px;
|
||||
|
||||
.form-record-nav-position {
|
||||
color: #5a6b7b;
|
||||
font-weight: 600;
|
||||
letter-spacing: .3px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.form-record-nav-group {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
background: rgba(255, 255, 255, .55);
|
||||
border: 1px solid rgba(0, 0, 0, .09);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, .03);
|
||||
}
|
||||
|
||||
.form-record-nav-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 24px;
|
||||
color: #5a6b7b;
|
||||
text-decoration: none;
|
||||
transition: background-color .12s ease, color .12s ease;
|
||||
|
||||
& + .form-record-nav-btn {
|
||||
border-left: 1px solid rgba(0, 0, 0, .09);
|
||||
}
|
||||
|
||||
&:not(.is-disabled):hover {
|
||||
background-color: #fff;
|
||||
color: #1f2d3d;
|
||||
}
|
||||
|
||||
&.is-disabled {
|
||||
color: #b6bfc7;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
svg {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
51
modules/backend/assets/less/controls/reportwidgets.less
Normal file
@@ -0,0 +1,51 @@
|
||||
.report-widget {
|
||||
padding: 15px;
|
||||
background: white;
|
||||
.box-sizing(border-box);
|
||||
.border-radius(@border-radius-base);
|
||||
font-size: @font-size-base - 1;
|
||||
|
||||
h3 {
|
||||
font-size: @font-size-base;
|
||||
color: @color-report-widget-title;
|
||||
text-transform: uppercase;
|
||||
font-weight: 600;
|
||||
margin-top: 0;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.height-100 { height: 100px; }
|
||||
.height-200 { height: 200px; }
|
||||
.height-300 { height: 300px; }
|
||||
.height-400 { height: 400px; }
|
||||
.height-500 { height: 500px; }
|
||||
|
||||
p.report-description {
|
||||
margin-bottom: 0;
|
||||
margin-top: 15px;
|
||||
font-size: 12px;
|
||||
line-height: 190%;
|
||||
color: @color-report-widget-description;
|
||||
}
|
||||
|
||||
a:not(.btn) {
|
||||
color: @color-report-widget-link;
|
||||
text-decoration: none;
|
||||
&:hover {
|
||||
color: @link-color;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
p.flash-message.static {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.icon-circle {
|
||||
&.success { color: @brand-success; }
|
||||
&.primary { color: @brand-primary; }
|
||||
&.warning { color: @brand-warning; }
|
||||
&.danger { color: @brand-danger; }
|
||||
&.info { color: @brand-info; }
|
||||
}
|
||||
}
|
||||
125
modules/backend/assets/less/controls/scrollbar.less
Normal file
@@ -0,0 +1,125 @@
|
||||
//
|
||||
// Scrollbar
|
||||
// --------------------------------------------------
|
||||
|
||||
.drag-noselect {
|
||||
.user-select(none);
|
||||
}
|
||||
|
||||
@scrollbar-thumb-size: 6px;
|
||||
|
||||
.control-scrollbar {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
|
||||
>.scrollbar-scrollbar {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
.scrollbar-track {
|
||||
background-color: @color-scrollbar-track;
|
||||
position: relative;
|
||||
.border-radius(5px);
|
||||
|
||||
.scrollbar-thumb {
|
||||
background-color: @color-scrollbar-thumb;
|
||||
.border-radius(5px);
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.vertical {
|
||||
>.scrollbar-scrollbar {
|
||||
right: 0;
|
||||
margin-right: 5px;
|
||||
width: @scrollbar-thumb-size;
|
||||
.scrollbar-track {
|
||||
height: 100%;
|
||||
width: @scrollbar-thumb-size;
|
||||
.scrollbar-thumb {
|
||||
height: 20px;
|
||||
width: @scrollbar-thumb-size;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&:active, &:hover {
|
||||
width: @scrollbar-thumb-size + 2px;
|
||||
.transition(width .3s);
|
||||
.scrollbar-track,
|
||||
.scrollbar-thumb {
|
||||
width: @scrollbar-thumb-size + 2px;
|
||||
.transition(width .3s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.horizontal {
|
||||
>.scrollbar-scrollbar {
|
||||
margin: 0 0 5px;
|
||||
clear: both;
|
||||
height: @scrollbar-thumb-size;
|
||||
.scrollbar-track {
|
||||
width: 100%;
|
||||
height: @scrollbar-thumb-size;
|
||||
.scrollbar-thumb {
|
||||
height: @scrollbar-thumb-size;
|
||||
margin: 2px 0;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&:active, &:hover {
|
||||
height: @scrollbar-thumb-size + 2px;
|
||||
.transition(height .3s);
|
||||
.scrollbar-track,
|
||||
.scrollbar-thumb {
|
||||
height: @scrollbar-thumb-size + 2px;
|
||||
.transition(height .3s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
html.mobile {
|
||||
.control-scrollbar {
|
||||
overflow: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
}
|
||||
|
||||
.no-touch .control-scrollbar {
|
||||
>.scrollbar-scrollbar {
|
||||
opacity: 0;
|
||||
.transition(opacity 0.3s);
|
||||
}
|
||||
|
||||
&:active >.scrollbar-scrollbar,
|
||||
&:hover >.scrollbar-scrollbar {opacity: 1;}
|
||||
}
|
||||
|
||||
@media (max-width: @screen-sm) {
|
||||
&.responsive-sidebar {
|
||||
> .layout-cell:last-child {
|
||||
.control-scrollbar {
|
||||
overflow: visible;
|
||||
height: auto;
|
||||
|
||||
.scrollbar-scrollbar {
|
||||
display: none!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
98
modules/backend/assets/less/controls/scrollpad.less
Normal file
@@ -0,0 +1,98 @@
|
||||
.scrollpad-scrollbar-size-tester {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
overflow-y: scroll;
|
||||
position: absolute;
|
||||
top: -200px;
|
||||
left: -200px;
|
||||
|
||||
div {
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
div.control-scrollpad {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
|
||||
> div {
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
height: 100%;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&[data-direction=horizontal] > div {
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
width: 100%;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: auto;
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
> .scrollpad-scrollbar {
|
||||
z-index: 199; // Be careful here
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 11px;
|
||||
background-color: @color-scrollbar-track;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
.border-radius(5px);
|
||||
.transition(opacity 0.3s);
|
||||
|
||||
.drag-handle {
|
||||
position: absolute;
|
||||
right: 2px;
|
||||
min-height: 10px;
|
||||
width: 7px;
|
||||
background-color: @color-scrollbar-thumb;
|
||||
.border-radius(5px);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.opacity(.7);
|
||||
.transition(opacity 0 linear);
|
||||
}
|
||||
|
||||
&[data-visible] {
|
||||
.opacity(.7);
|
||||
}
|
||||
|
||||
&[data-hidden] {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&[data-direction=horizontal] > .scrollpad-scrollbar {
|
||||
top: auto;
|
||||
left: 0;
|
||||
width: auto;
|
||||
height: 11px;
|
||||
|
||||
.drag-handle {
|
||||
right: auto;
|
||||
top: 2px;
|
||||
height: 7px;
|
||||
min-height: 0;
|
||||
min-width: 10px;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
modules/backend/assets/less/controls/selector-group.less
Normal file
@@ -0,0 +1,35 @@
|
||||
.nav.selector-group {
|
||||
font-size: 13px;
|
||||
letter-spacing: 0.01em;
|
||||
margin-bottom: 20px;
|
||||
|
||||
li {
|
||||
a {
|
||||
padding: 7px 20px 7px 23px;
|
||||
color: #95a5a6;
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-left: 3px solid #e6802b;
|
||||
padding-left: 0;
|
||||
|
||||
a {
|
||||
padding-left: 20px;
|
||||
color: #2b3e50;
|
||||
}
|
||||
}
|
||||
|
||||
i[class^="icon-"] {
|
||||
font-size: 17px;
|
||||
margin-right: 6px;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
div.panel {
|
||||
.nav.selector-group {
|
||||
margin: 0 -20px 20px -20px;
|
||||
}
|
||||
}
|
||||
270
modules/backend/assets/less/controls/sidenav-tree.less
Normal file
@@ -0,0 +1,270 @@
|
||||
.sidenav-tree {
|
||||
width: 300px;
|
||||
|
||||
.control-toolbar {
|
||||
padding: 0;
|
||||
|
||||
.toolbar-item {
|
||||
display: block;
|
||||
}
|
||||
|
||||
input.form-control {
|
||||
border: none;
|
||||
outline: none;
|
||||
padding: 12px 13px 13px;
|
||||
.border-radius(0);
|
||||
.box-shadow(inset -3px 0 3px rgba(0,0,0,0.1));
|
||||
|
||||
&.search {
|
||||
background-position: right -78px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
div.scrollbar-thumb {
|
||||
background: rgba(0,0,0,.2) !important;
|
||||
}
|
||||
|
||||
ul.top-level > li {
|
||||
&[data-status=collapsed] {
|
||||
> div.group {
|
||||
h3:before {
|
||||
.transform(~'rotate(0deg) translate(2px, -2px)');
|
||||
}
|
||||
|
||||
// Hide triangle
|
||||
&:before, &:after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
> div.group {
|
||||
position: relative;
|
||||
|
||||
h3 {
|
||||
background: @color-sidebarnav-tree-group-bg;
|
||||
color: @color-sidebarnav-tree-group;
|
||||
text-transform: uppercase;
|
||||
font-size: 15px;
|
||||
padding: 15px 15px 15px 40px;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
font-weight: 400;
|
||||
|
||||
&:before {
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
left: 16px;
|
||||
top: 15px;
|
||||
color: @color-list-arrow;
|
||||
.icon(@angle-right);
|
||||
.transform(~'rotate(90deg) translate(5px, -3px)');
|
||||
.transition(all 0.1s ease);
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
// Use two triangles to achieve the darkening effect
|
||||
&:before,
|
||||
&:after {
|
||||
.triangle(down, 15px, 8px, @brand-primary);
|
||||
position: absolute;
|
||||
left: 15px;
|
||||
bottom: -8px;
|
||||
z-index: 101;
|
||||
}
|
||||
|
||||
&:after {
|
||||
.triangle(down, 15px, 8px, @color-sidebarnav-tree-group-bg);
|
||||
}
|
||||
}
|
||||
|
||||
> ul {
|
||||
li {
|
||||
|
||||
a {
|
||||
display: block;
|
||||
position: relative;
|
||||
padding: 18px 25px 18px 55px;
|
||||
background: @color-sidebarnav-tree-inactive-bg;
|
||||
border-bottom: 1px solid @color-sidebarnav-tree-group-bg;
|
||||
color: @color-sidebarnav-tree-inactive-text;
|
||||
text-decoration: none !important;
|
||||
.opacity(.65);
|
||||
|
||||
&:active,
|
||||
&:hover {
|
||||
.opacity(1);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
i {
|
||||
position: absolute;
|
||||
left: 16px;
|
||||
top: 18px;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
span {
|
||||
display: block;
|
||||
line-height: 150%;
|
||||
|
||||
&.header {
|
||||
color: @color-sidebarnav-tree-inactive-header;
|
||||
font-size: @font-size-base + 1;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
&.description {
|
||||
color: @color-sidebarnav-tree-inactive-desc;
|
||||
font-size: @font-size-base - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:hover a,
|
||||
&.active a {
|
||||
.opacity(1);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-left: 5px solid @brand-secondary;
|
||||
|
||||
a {
|
||||
color: @color-sidebarnav-tree-active-text;
|
||||
padding-right: 20px;
|
||||
|
||||
span.header {
|
||||
color: @color-sidebarnav-tree-active-header;
|
||||
}
|
||||
|
||||
span.description {
|
||||
color: @color-sidebarnav-tree-active-text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// &:last-child a {
|
||||
// border-bottom: none;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.back-link {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: @screen-sm-min) {
|
||||
.sidenav-tree-root .sidenav-tree {
|
||||
width: 600px;
|
||||
|
||||
ul.top-level > li > ul {
|
||||
font-size: 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
align-items: stretch;
|
||||
align-content: stretch;
|
||||
|
||||
> li {
|
||||
display: inline-block;
|
||||
// flex-grow: 1;
|
||||
width: 300px;
|
||||
|
||||
a {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {
|
||||
.sidenav-tree-root .sidenav-tree {
|
||||
width: 100%;
|
||||
|
||||
ul.top-level > li > ul > li {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: @screen-lg-min) {
|
||||
.sidenav-tree-root .sidenav-tree {
|
||||
width: 900px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: @screen-sm) {
|
||||
.sidenav-tree {
|
||||
width: 100%;
|
||||
height: auto !important;
|
||||
display: block !important;
|
||||
|
||||
> .layout {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.sidenav-tree-root {
|
||||
.sidenav-tree {
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
display: table-cell !important;
|
||||
|
||||
.back-link {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
> .layout {
|
||||
display: table !important;
|
||||
}
|
||||
}
|
||||
|
||||
#layout-body {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
body.has-sidenav-tree {
|
||||
.sidenav-tree {
|
||||
.back-link {
|
||||
display: block;
|
||||
padding: 13px 15px;
|
||||
background: @color-sidebarnav-back-link-bg;
|
||||
color: @color-sidebarnav-back-link-text;
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
text-transform: uppercase;
|
||||
i {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#layout-body {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
265
modules/backend/assets/less/controls/simplelist.less
Normal file
@@ -0,0 +1,265 @@
|
||||
//
|
||||
// Simple List
|
||||
// --------------------------------------------------
|
||||
// Usage (bullets):
|
||||
// <div class="control-simplelist">
|
||||
// <ul>
|
||||
// <li>Hello friend</li>
|
||||
// </ul>
|
||||
// </div>
|
||||
//
|
||||
// With icons (no bullets):
|
||||
// <div class="control-simplelist with-icons">
|
||||
// <ul>
|
||||
// <li class="wn-icon-check">Hello friend</li>
|
||||
// </ul>
|
||||
// </div>
|
||||
//
|
||||
// With checkboxes:
|
||||
// <div class="control-simplelist with-checkboxes">
|
||||
// <ul>
|
||||
// <li>
|
||||
// <div class="checkbox custom-checkbox">
|
||||
// <input id="checkbox-example1" name="checkbox" value="1" type="checkbox">
|
||||
// <label class="choice" for="checkbox-example1"> Dodge Viper</label>
|
||||
// </div>
|
||||
// </li>
|
||||
// </ul>
|
||||
// </div>
|
||||
//
|
||||
// Divided (basic):
|
||||
// <div class="control-simplelist is-divided">
|
||||
// <ul>
|
||||
// <li>Hello friend</li>
|
||||
// </ul>
|
||||
// </div>
|
||||
//
|
||||
// Selectable:
|
||||
// <div class="control-simplelist is-selectable">
|
||||
// <ul>
|
||||
// <li>
|
||||
// <a href="#">
|
||||
// <h5 class="heading">Hello friend</h5>
|
||||
// <p class="description">Something cool over here</p>
|
||||
// </a>
|
||||
// </li>
|
||||
// </ul>
|
||||
// </div>
|
||||
//
|
||||
// Selectable (box):
|
||||
// <div class="control-simplelist is-selectable-box">
|
||||
// <ul>
|
||||
// <li>
|
||||
// <a href="#">
|
||||
// <div class="box">
|
||||
// <div class="image"><i class="icon-user"></i></div>
|
||||
// </div>
|
||||
// <h5 class="heading">Hello friend</h5>
|
||||
// <p class="description">Something cool over here</p>
|
||||
// </a>
|
||||
// </li>
|
||||
// </ul>
|
||||
// </div>
|
||||
//
|
||||
|
||||
.control-simplelist {
|
||||
font-size: 13px;
|
||||
padding: 20px 20px 2px 20px;
|
||||
margin-bottom: @padding-standard;
|
||||
background: @color-form-checkboxlist-background;
|
||||
.border-radius(@border-radius-base);
|
||||
|
||||
ul { padding-left: 15px; }
|
||||
|
||||
&.form-control {
|
||||
ul { margin-bottom: 0; }
|
||||
li {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
&.with-icons,
|
||||
&.with-checkboxes,
|
||||
&.is-divided,
|
||||
&.is-selectable {
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.with-checkboxes {
|
||||
li {
|
||||
margin-top: -5px;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
div.custom-checkbox {
|
||||
margin-bottom: 0;
|
||||
|
||||
label {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.is-sortable {
|
||||
|
||||
li.placeholder {
|
||||
position: relative;
|
||||
&:before {
|
||||
top: -10px;
|
||||
position: absolute;
|
||||
.triangle(right, 5px, 9px, @color-sortable-caret);
|
||||
}
|
||||
}
|
||||
|
||||
li.dragged {
|
||||
position: absolute;
|
||||
.opacity(.5);
|
||||
z-index: 2000;
|
||||
color: @color-sortable-active;
|
||||
|
||||
width: auto !important; // Prevent browser scrollbars
|
||||
}
|
||||
}
|
||||
|
||||
&.is-scrollable {
|
||||
height: 200px;
|
||||
&.size-tiny { min-height: @size-tiny + 200; }
|
||||
&.size-small { min-height: @size-small + 200; }
|
||||
&.size-large { min-height: @size-large + 200; }
|
||||
&.size-huge { min-height: @size-huge + 200; }
|
||||
&.size-giant { min-height: @size-giant + 200; }
|
||||
}
|
||||
|
||||
&.is-divided,
|
||||
&.is-selectable,
|
||||
&.is-selectable-box {
|
||||
padding: 0;
|
||||
|
||||
li {
|
||||
.heading {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.description {}
|
||||
}
|
||||
}
|
||||
|
||||
&.is-divided,
|
||||
&.is-selectable {
|
||||
li {
|
||||
padding: 5px 10px;
|
||||
border-bottom: 1px solid @color-list-border;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.is-selectable {
|
||||
li {
|
||||
a {
|
||||
padding: 5px 10px;
|
||||
margin: -5px -10px;
|
||||
display: block;
|
||||
color: @text-color;
|
||||
}
|
||||
&:hover {
|
||||
background: @color-list-hover-bg;
|
||||
cursor: pointer;
|
||||
&, a { color: white; }
|
||||
a { text-decoration: none; }
|
||||
}
|
||||
|
||||
&.active {
|
||||
a {
|
||||
background: #f0f0f0;
|
||||
&:hover {
|
||||
background: @color-list-hover-bg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.is-selectable-box {
|
||||
padding-top: 15px;
|
||||
margin-bottom: 0;
|
||||
|
||||
li {
|
||||
width: 155px;
|
||||
margin: 8px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
color: @text-color;
|
||||
|
||||
.box {
|
||||
display: block;
|
||||
width: 155px;
|
||||
height: 155px;
|
||||
border: 3px solid rgba(0,0,0,.1);
|
||||
position: relative;
|
||||
.transition(border .3s ease);
|
||||
}
|
||||
|
||||
.image {
|
||||
display: block;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-top: -28px;
|
||||
margin-left: -28px;
|
||||
|
||||
> i {
|
||||
font-size: 56px;
|
||||
color: rgba(0,0,0,.25);
|
||||
}
|
||||
}
|
||||
|
||||
.heading {
|
||||
margin: 7px 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.description {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.box {
|
||||
border-color: rgba(0,0,0,.2);
|
||||
}
|
||||
|
||||
.image > i {
|
||||
color: rgba(0,0,0,.45);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list-preview .control-simplelist {
|
||||
&.is-selectable {
|
||||
ul {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
modules/backend/assets/less/controls/svg-icons.less
Normal file
@@ -0,0 +1,33 @@
|
||||
.svg-icon-container {
|
||||
img.svg-icon {
|
||||
// SVG icons are invisible until SVG support is detected
|
||||
// with JavaScript to reduce flickering on page load.
|
||||
// This should be overridden in a specific control,
|
||||
// inside html.svg {}
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.svg-active-effects {
|
||||
img.svg-icon {
|
||||
-webkit-filter: grayscale(100%);
|
||||
filter: grayscale(100%);
|
||||
.opacity(0.6);
|
||||
}
|
||||
|
||||
&:hover, &.active {
|
||||
img.svg-icon {
|
||||
-webkit-filter: none;
|
||||
filter: none;
|
||||
.opacity(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
html.svg {
|
||||
.svg-icon-container {
|
||||
i.svg-replace {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
61
modules/backend/assets/less/controls/tree-path.less
Normal file
@@ -0,0 +1,61 @@
|
||||
ul.tree-path {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin-bottom: 0;
|
||||
|
||||
li {
|
||||
display: inline-block;
|
||||
margin-right: 1px;
|
||||
font-size: 13px;
|
||||
|
||||
&:after {
|
||||
.icon(@angle-right);
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
margin-left: 5px;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
color: #95a5a6;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
a {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
&:after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.go-up {
|
||||
font-size: 12px;
|
||||
margin-right: 7px;
|
||||
|
||||
a {
|
||||
color: #95a5a6;
|
||||
|
||||
&:hover {
|
||||
color: @link-color;
|
||||
}
|
||||
}
|
||||
|
||||
&:after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.root a {
|
||||
font-weight: 600;
|
||||
color: #405261;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #95a5a6;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
93
modules/backend/assets/less/controls/treelist.less
Normal file
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// Tree List
|
||||
// --------------------------------------------------
|
||||
|
||||
.control-treelist {
|
||||
ol {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
|
||||
ol {
|
||||
margin: 0;
|
||||
margin-left: 15px;
|
||||
padding-left: 15px;
|
||||
border-left: 1px solid #dbdee0;
|
||||
}
|
||||
}
|
||||
|
||||
> ol > li > div.record:before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
> div.record {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
margin-bottom: 5px;
|
||||
position: relative;
|
||||
display: block;
|
||||
|
||||
&:before {
|
||||
color: #bdc3c7;
|
||||
.icon(@circle);
|
||||
font-size: 6px;
|
||||
position: absolute;
|
||||
left: -18px;
|
||||
top: 11px;
|
||||
}
|
||||
|
||||
> a.move {
|
||||
display: inline-block;
|
||||
padding: 7px 0 7px 10px;
|
||||
text-decoration: none;
|
||||
color: #bdc3c7;
|
||||
&:hover {
|
||||
color: @color-list-hover-bg;
|
||||
}
|
||||
&:before { .icon(@bars); }
|
||||
}
|
||||
> span {
|
||||
color: @color-list-text;
|
||||
display: inline-block;
|
||||
padding: 7px 15px 7px 5px;
|
||||
}
|
||||
}
|
||||
|
||||
&.dragged {
|
||||
position: absolute;
|
||||
z-index: 2000;
|
||||
width: auto !important; // Prevent browser scrollbars
|
||||
height: auto !important;
|
||||
> div.record {
|
||||
.opacity(.5);
|
||||
background: @color-list-hover-bg !important;
|
||||
> a.move:before, > span { color: white; }
|
||||
|
||||
&:before {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.placeholder {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
background: @color-list-hover-bg !important;
|
||||
height: 25px;
|
||||
margin-bottom: 5px;
|
||||
&:before {
|
||||
display: block;
|
||||
position: absolute;
|
||||
.icon(@chevron-left);
|
||||
color: #d35714;
|
||||
left: -10px;
|
||||
top: 8px;
|
||||
z-index: 2000;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
630
modules/backend/assets/less/controls/treeview.less
Normal file
@@ -0,0 +1,630 @@
|
||||
.control-treeview {
|
||||
margin-bottom: 40px;
|
||||
|
||||
.no-data() {
|
||||
padding: 18px 0;
|
||||
margin: 0;
|
||||
color: @color-filelist-norecords-text;
|
||||
font-size: @font-size-base;
|
||||
text-align: center;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
ol {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
background: @color-treeview-item-bg;
|
||||
|
||||
> li {
|
||||
.transition(width 1s);
|
||||
|
||||
> div {
|
||||
font-size: @font-size-base;
|
||||
font-weight: normal;
|
||||
background: @color-treeview-item-bg;
|
||||
border-bottom: 1px solid @color-panel-light;
|
||||
position: relative;
|
||||
|
||||
> a {
|
||||
color: @color-treeview-item-title;
|
||||
padding: 11px 45px 10px 61px;
|
||||
display: block;
|
||||
line-height: 150%;
|
||||
text-decoration: none;
|
||||
.box-sizing(border-box);
|
||||
}
|
||||
|
||||
&:before {
|
||||
content: ' ';
|
||||
background-image: url(../images/treeview-icons.png);
|
||||
background-position: 0px -28px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 42px auto;
|
||||
|
||||
position: absolute;
|
||||
width: 21px;
|
||||
height: 22px;
|
||||
left: 28px;
|
||||
top: 15px;
|
||||
}
|
||||
|
||||
span.comment {
|
||||
display: block;
|
||||
font-weight: 400;
|
||||
color: @color-treeview-item-comment;
|
||||
font-size: @font-size-base - 1;
|
||||
margin-top: 2px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
> span.expand {
|
||||
.hide-text();
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
top: 19px;
|
||||
left: 2px;
|
||||
cursor: pointer;
|
||||
color: @color-treeview-control;
|
||||
.transition(transform 0.1s ease);
|
||||
|
||||
&:before {
|
||||
.icon(@caret-right);
|
||||
line-height: 100%;
|
||||
font-size: @font-size-base + 1;
|
||||
|
||||
position: relative;
|
||||
left: 8px;
|
||||
top: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
> span.drag-handle {
|
||||
.hide-text();
|
||||
.transition(opacity 0.4s);
|
||||
|
||||
position: absolute;
|
||||
right: 9px;
|
||||
bottom: 0;
|
||||
width: 18px;
|
||||
height: 19px;
|
||||
cursor: move;
|
||||
color: @color-treeview-control;
|
||||
.opacity(0);
|
||||
|
||||
&:before {
|
||||
.icon(@bars);
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
span.borders {
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
> ul.submenu {
|
||||
position: absolute;
|
||||
left: 20px;
|
||||
bottom: -36.9px;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
z-index: 200;
|
||||
height: 37px;
|
||||
display: none;
|
||||
margin-left: 15px;
|
||||
|
||||
background: transparent url(../images/treeview-submenu-tabs.png) repeat-x left -39px;
|
||||
|
||||
&:before, &:after {
|
||||
background: transparent url(../images/treeview-submenu-tabs.png) no-repeat left top;
|
||||
content: ' ';
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 37px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
&:before {
|
||||
left: -20px;
|
||||
}
|
||||
|
||||
&:after {
|
||||
background-position: -100px top;
|
||||
right: -20px;
|
||||
}
|
||||
|
||||
li {
|
||||
font-size: @font-size-base - 2;
|
||||
|
||||
a {
|
||||
display: block;
|
||||
padding: 4px 3px 0 3px;
|
||||
color: @color-treeview-submenu-text;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
|
||||
i {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
> ul.submenu {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
&:active {
|
||||
> ul.submenu {
|
||||
background-position: left -116px;
|
||||
|
||||
&:before {
|
||||
background-position: left -77px;
|
||||
}
|
||||
&:after {
|
||||
background-position: -100px -77px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
right: 0;
|
||||
|
||||
label {
|
||||
margin-right: 0;
|
||||
|
||||
&:before {
|
||||
border-color: @color-filelist-cb-border;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.popover-highlight {
|
||||
background-color: @color-treeview-hover-bg !important;
|
||||
|
||||
&:before {
|
||||
background-position: 0px -80px;
|
||||
}
|
||||
|
||||
> a {
|
||||
color: @color-treeview-hover-text !important;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
span {
|
||||
color: @color-treeview-hover-text !important;
|
||||
}
|
||||
|
||||
> ul.submenu, > span.drag-handle {
|
||||
display: none!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.dragged div, > div:hover {
|
||||
background-color: @color-treeview-hover-bg !important;
|
||||
|
||||
> a {
|
||||
color: @color-treeview-hover-text !important;
|
||||
}
|
||||
|
||||
&:before {
|
||||
background-position: 0px -80px;
|
||||
}
|
||||
|
||||
&:after {
|
||||
top: 0 !important;
|
||||
bottom: 0 !important;
|
||||
}
|
||||
|
||||
span {
|
||||
color: @color-treeview-hover-text !important;
|
||||
|
||||
&.drag-handle {
|
||||
cursor: move;
|
||||
.opacity(1);
|
||||
}
|
||||
|
||||
&.borders {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> div:active {
|
||||
background-color: @color-treeview-active-bg !important;
|
||||
|
||||
> a {
|
||||
color: @color-treeview-active-text !important;
|
||||
}
|
||||
}
|
||||
|
||||
&[data-no-drag-mode] div:hover {
|
||||
span.drag-handle {
|
||||
cursor: default!important;
|
||||
.opacity(.3)!important;
|
||||
}
|
||||
}
|
||||
|
||||
&.dragged {
|
||||
li.has-subitems, &.has-subitems {
|
||||
> div:before {
|
||||
background-position: 0px -52px;
|
||||
}
|
||||
}
|
||||
|
||||
div > ul.submenu {
|
||||
display: none!important;
|
||||
}
|
||||
}
|
||||
|
||||
> ol {
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
&[data-status=collapsed] > ol {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.has-subitems {
|
||||
> div {
|
||||
&:before {
|
||||
background-position: 0 0;
|
||||
width: 23px;
|
||||
height: 26px;
|
||||
left: 26px;
|
||||
}
|
||||
|
||||
&:hover, &.popover-highlight {
|
||||
&:before { background-position: 0px -52px; }
|
||||
}
|
||||
|
||||
span.expand {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.placeholder {
|
||||
position: relative;
|
||||
.opacity(.5);
|
||||
|
||||
ol {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.dragged {
|
||||
position: absolute;
|
||||
z-index: 2000;
|
||||
.opacity(.25);
|
||||
|
||||
> div {
|
||||
.border-radius(3px);
|
||||
}
|
||||
|
||||
ol {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.drop-target {
|
||||
> div {
|
||||
background-color: #2581b8!important;
|
||||
|
||||
> a {
|
||||
color: @color-treeview-hover-text;
|
||||
> span.comment {
|
||||
color: @color-treeview-hover-text;
|
||||
}
|
||||
}
|
||||
|
||||
&:before {
|
||||
background-position: 0px -80px;
|
||||
}
|
||||
}
|
||||
|
||||
&.has-subitems > div:before {
|
||||
background-position: 0px -52px;
|
||||
}
|
||||
}
|
||||
|
||||
&[data-status=expanded] > div > span.expand {
|
||||
.transform( ~'rotate(90deg) translate(0, 0)' );
|
||||
}
|
||||
|
||||
&.drag-ghost {
|
||||
background-color: transparent;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
&.active {
|
||||
> div {
|
||||
background: @color-list-active;
|
||||
|
||||
&:after {
|
||||
position: absolute;
|
||||
width: 4px;
|
||||
left: 0;
|
||||
top: -1px;
|
||||
bottom: -1px;
|
||||
background: @color-list-active-border;
|
||||
display: block;
|
||||
content: ' ';
|
||||
}
|
||||
|
||||
> span.comment, > span.expand {
|
||||
color: @color-treeview-item-active-comment;
|
||||
}
|
||||
|
||||
> span.borders {
|
||||
&:before, &:after {
|
||||
content: ' ';
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
display: block;
|
||||
left: 0;
|
||||
background-color: @color-list-active;
|
||||
}
|
||||
|
||||
&:before {top: -1px;}
|
||||
&:after {bottom: -1px;}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.no-data {
|
||||
.no-data();
|
||||
}
|
||||
}
|
||||
|
||||
@max-level: 10;
|
||||
|
||||
.tree-view-paddings (@level) when (@level > 0) {
|
||||
> li {
|
||||
> ol {
|
||||
> li > div {
|
||||
margin-left: -20-(@max-level - @level)*20px;
|
||||
margin-right: -20-(@max-level - @level)*20px;
|
||||
padding-left: 61+(@max-level - @level + 1)*10px;
|
||||
|
||||
> a {
|
||||
margin-left: -61-(@max-level - @level + 1)*10px;
|
||||
padding-left: 61+(@max-level - @level + 1)*10px;
|
||||
}
|
||||
|
||||
&:before {
|
||||
margin-left: (@max-level - @level + 1)*10px;
|
||||
}
|
||||
|
||||
> span.expand {
|
||||
left: 2+(@max-level - @level + 1)*10px;
|
||||
}
|
||||
}
|
||||
|
||||
.tree-view-paddings(@level - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tree-view-paddings (@max-level);
|
||||
}
|
||||
|
||||
p.no-data {
|
||||
.no-data();
|
||||
}
|
||||
|
||||
a.menu-control {
|
||||
display: block;
|
||||
margin: 20px;
|
||||
padding: 13px 15px;
|
||||
border: dotted 2px #ebebeb;
|
||||
color: #bdc3c7;
|
||||
font-size: @font-size-base - 2;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
border-radius: 5px;
|
||||
vertical-align: middle;
|
||||
|
||||
&:hover, &:focus {
|
||||
text-decoration: none;
|
||||
background-color: @color-treeview-hover-bg;
|
||||
color: @color-treeview-hover-text;
|
||||
border: none;
|
||||
padding: 15px 17px;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: @color-treeview-active-bg;
|
||||
color: @color-treeview-active-text;
|
||||
}
|
||||
|
||||
i {
|
||||
margin-right: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Light version of the treeview - transparent background, no bottom borders,
|
||||
* smaller paddings, inline submenu
|
||||
*/
|
||||
&.treeview-light {
|
||||
margin-bottom: 0;
|
||||
margin-top: 20px;
|
||||
|
||||
ol {
|
||||
background-color: transparent;
|
||||
> li {
|
||||
> div {
|
||||
background-color: transparent;
|
||||
border-bottom: none;
|
||||
|
||||
&:before {
|
||||
top: 15px;
|
||||
}
|
||||
|
||||
> a {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
span.expand {
|
||||
top: 19px;
|
||||
}
|
||||
|
||||
> span.drag-handle {
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: auto;
|
||||
height: 100%;
|
||||
width: 60px;
|
||||
background: @color-treeview-light-submenu-bg;
|
||||
.transition(none)!important;
|
||||
|
||||
&:before {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-left: -6px;
|
||||
}
|
||||
}
|
||||
|
||||
> ul.submenu {
|
||||
right: 60px;
|
||||
left: auto;
|
||||
bottom: auto;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
white-space: nowrap;
|
||||
font-size: 0;
|
||||
|
||||
&:before, &:after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
li {
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
background: @color-treeview-light-submenu-bg;
|
||||
border-right: 1px solid @color-treeview-light-submenu-border;
|
||||
|
||||
p {
|
||||
display: table;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
a {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
height: 100%;
|
||||
padding: 0 20px;
|
||||
font-size: @font-size-base - 1;
|
||||
.box-sizing(border-box);
|
||||
|
||||
i.control-icon {
|
||||
font-size: 22px;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Sorting guides
|
||||
//
|
||||
|
||||
body.dragging .control-treeview {
|
||||
ol.dragging, ol.dragging ol {
|
||||
background: #ccc;
|
||||
padding-right: 0;
|
||||
|
||||
> li {
|
||||
> div {
|
||||
margin-right: 0;
|
||||
.transition(margin 1s);
|
||||
|
||||
.custom-checkbox {
|
||||
.transition(opacity .5s);
|
||||
.opacity(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.treeview-light {
|
||||
ol.dragging, ol.dragging ol {
|
||||
> li > div {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Retina
|
||||
//
|
||||
|
||||
@media only screen and (min--moz-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-devicepixel-ratio: 1.5), only screen and (min-resolution: 1.5dppx) {
|
||||
.control-treeview {
|
||||
ol {
|
||||
> li {
|
||||
> div{
|
||||
&:before {
|
||||
background-position: 0px -79px;
|
||||
background-size: 21px auto;
|
||||
}
|
||||
}
|
||||
|
||||
&.has-subitems > div {
|
||||
&:before {background-position: 0px -52px;}
|
||||
&:hover, &.popover-highlight {
|
||||
&:before {background-position: 0px -102px;}
|
||||
}
|
||||
}
|
||||
|
||||
&.dragged > div, &.dragged li > div, > div:hover, > div.popover-highlight {
|
||||
&:before {background-position: 0px -129px;}
|
||||
}
|
||||
|
||||
&.dragged {
|
||||
li.has-subitems, &.has-subitems {
|
||||
> div:before {
|
||||
background-position: 0px -102px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.drop-target {
|
||||
> div:before {
|
||||
background-position: 0px -129px;
|
||||
}
|
||||
|
||||
&.has-subitems > div:before {
|
||||
background-position: 0px -102px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
363
modules/backend/assets/less/core/animations.less
Normal file
@@ -0,0 +1,363 @@
|
||||
//
|
||||
// Fade In
|
||||
//
|
||||
|
||||
@-webkit-keyframes fadeIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.fadeIn {
|
||||
-webkit-animation-name: fadeIn;
|
||||
animation-name: fadeIn;
|
||||
}
|
||||
|
||||
//
|
||||
// Fade In Down
|
||||
//
|
||||
|
||||
@-webkit-keyframes fadeInDown {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(0, -100%, 0);
|
||||
transform: translate3d(0, -100%, 0);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInDown {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(0, -100%, 0);
|
||||
-ms-transform: translate3d(0, -100%, 0);
|
||||
transform: translate3d(0, -100%, 0);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: none;
|
||||
-ms-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
.fadeInDown {
|
||||
-webkit-animation-name: fadeInDown;
|
||||
animation-name: fadeInDown;
|
||||
}
|
||||
|
||||
//
|
||||
// Fade In Left
|
||||
//
|
||||
|
||||
@-webkit-keyframes fadeInLeft {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(-100%, 0, 0);
|
||||
transform: translate3d(-100%, 0, 0);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInLeft {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(-100%, 0, 0);
|
||||
-ms-transform: translate3d(-100%, 0, 0);
|
||||
transform: translate3d(-100%, 0, 0);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: none;
|
||||
-ms-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
.fadeInLeft {
|
||||
-webkit-animation-name: fadeInLeft;
|
||||
animation-name: fadeInLeft;
|
||||
}
|
||||
|
||||
//
|
||||
// Fade In Right
|
||||
//
|
||||
|
||||
@-webkit-keyframes fadeInRight {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(100%, 0, 0);
|
||||
transform: translate3d(100%, 0, 0);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInRight {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(100%, 0, 0);
|
||||
-ms-transform: translate3d(100%, 0, 0);
|
||||
transform: translate3d(100%, 0, 0);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: none;
|
||||
-ms-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
.fadeInRight {
|
||||
-webkit-animation-name: fadeInRight;
|
||||
animation-name: fadeInRight;
|
||||
}
|
||||
|
||||
//
|
||||
// Fade In Up
|
||||
//
|
||||
|
||||
@-webkit-keyframes fadeInUp {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(0, 100%, 0);
|
||||
transform: translate3d(0, 100%, 0);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInUp {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(0, 100%, 0);
|
||||
-ms-transform: translate3d(0, 100%, 0);
|
||||
transform: translate3d(0, 100%, 0);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: none;
|
||||
-ms-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
.fadeInUp {
|
||||
-webkit-animation-name: fadeInUp;
|
||||
animation-name: fadeInUp;
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeInUpBig {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(0, 2000px, 0);
|
||||
transform: translate3d(0, 2000px, 0);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
-webkit-transform: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Fade Out
|
||||
//
|
||||
|
||||
@-webkit-keyframes fadeOut {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeOut {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.fadeOut {
|
||||
-webkit-animation-name: fadeOut;
|
||||
animation-name: fadeOut;
|
||||
}
|
||||
|
||||
//
|
||||
// Fade Out Down
|
||||
//
|
||||
|
||||
@-webkit-keyframes fadeOutDown {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(0, 100%, 0);
|
||||
transform: translate3d(0, 100%, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeOutDown {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(0, 100%, 0);
|
||||
-ms-transform: translate3d(0, 100%, 0);
|
||||
transform: translate3d(0, 100%, 0);
|
||||
}
|
||||
}
|
||||
|
||||
.fadeOutDown {
|
||||
-webkit-animation-name: fadeOutDown;
|
||||
animation-name: fadeOutDown;
|
||||
}
|
||||
|
||||
//
|
||||
// Fade Out Left
|
||||
//
|
||||
|
||||
@-webkit-keyframes fadeOutLeft {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(-100%, 0, 0);
|
||||
transform: translate3d(-100%, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeOutLeft {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(-100%, 0, 0);
|
||||
-ms-transform: translate3d(-100%, 0, 0);
|
||||
transform: translate3d(-100%, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
.fadeOutLeft {
|
||||
-webkit-animation-name: fadeOutLeft;
|
||||
animation-name: fadeOutLeft;
|
||||
}
|
||||
|
||||
//
|
||||
// Fade Out Right
|
||||
//
|
||||
|
||||
@-webkit-keyframes fadeOutRight {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(100%, 0, 0);
|
||||
transform: translate3d(100%, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeOutRight {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(100%, 0, 0);
|
||||
-ms-transform: translate3d(100%, 0, 0);
|
||||
transform: translate3d(100%, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
.fadeOutRight {
|
||||
-webkit-animation-name: fadeOutRight;
|
||||
animation-name: fadeOutRight;
|
||||
}
|
||||
|
||||
//
|
||||
// Fade Out Up
|
||||
//
|
||||
|
||||
@-webkit-keyframes fadeOutUp {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(0, -100%, 0);
|
||||
transform: translate3d(0, -100%, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeOutUp {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate3d(0, -100%, 0);
|
||||
-ms-transform: translate3d(0, -100%, 0);
|
||||
transform: translate3d(0, -100%, 0);
|
||||
}
|
||||
}
|
||||
|
||||
.fadeOutUp {
|
||||
-webkit-animation-name: fadeOutUp;
|
||||
animation-name: fadeOutUp;
|
||||
}
|
||||
11
modules/backend/assets/less/core/boot.less
Normal file
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// Boots the Core LESS
|
||||
//
|
||||
// Includes non-output LESS files such as mixins and variables
|
||||
//
|
||||
|
||||
// Core variables and mixins
|
||||
@import "../../../../system/assets/ui/less/global.less";
|
||||
|
||||
@import "variables.less";
|
||||
@import "mixins.less";
|
||||
165
modules/backend/assets/less/core/mixins.less
Normal file
@@ -0,0 +1,165 @@
|
||||
// --------------------------------------------------
|
||||
// Flexbox LESS mixins
|
||||
// The spec: http://www.w3.org/TR/css3-flexbox
|
||||
// --------------------------------------------------
|
||||
|
||||
// Flexbox display
|
||||
// flex or inline-flex
|
||||
.flex-display() {
|
||||
display: ~"-webkit-box";
|
||||
display: ~"-webkit-flex";
|
||||
display: ~"-moz-flex";
|
||||
display: ~"-ms-flexbox"; // IE10 uses -ms-flexbox
|
||||
display: ~"-ms-flex"; // IE11
|
||||
display: flex;
|
||||
}
|
||||
|
||||
// The 'flex: 0 0 auto' shorthand
|
||||
.flex-fix() {
|
||||
-webkit-box-flex: 0;
|
||||
-webkit-flex: 0 0 auto;
|
||||
-moz-flex: 0 0 auto;
|
||||
-ms-flex: 0 0 auto;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
// The 'flex: 1 1 auto' shorthand
|
||||
.flex-stretch() {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1 1 auto;
|
||||
-moz-flex: 1 1 auto;
|
||||
-ms-flex: 1 1 auto;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
// The 'flex: 1' shorthand
|
||||
.flex-stretch-constrain() {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1;
|
||||
-moz-flex: 1;
|
||||
-ms-flex: 1;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
// Flex Flow Direction Column
|
||||
// - applies to: flex containers
|
||||
.flex-direction-column() {
|
||||
-webkit-flex-direction: column;
|
||||
-moz-flex-direction: column;
|
||||
-webkit-box-orient: vertical;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
// Flex Flow Direction Row
|
||||
// - applies to: flex containers
|
||||
.flex-direction-row() {
|
||||
-webkit-flex-direction: row;
|
||||
-moz-flex-direction: row;
|
||||
-webkit-box-orient: horizontal;
|
||||
-ms-flex-direction: row;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
// Flex Line Wrapping
|
||||
// - applies to: flex containers
|
||||
// nowrap | wrap | wrap-reverse
|
||||
.flex-wrap(@wrap: nowrap) {
|
||||
-webkit-flex-wrap: @wrap;
|
||||
-moz-flex-wrap: @wrap;
|
||||
-ms-flex-wrap: @wrap;
|
||||
flex-wrap: @wrap;
|
||||
}
|
||||
|
||||
// Flex Direction and Wrap
|
||||
// - applies to: flex containers
|
||||
// <flex-direction> || <flex-wrap>
|
||||
.flex-flow(@flow) {
|
||||
-webkit-flex-flow: @flow;
|
||||
-moz-flex-flow: @flow;
|
||||
-ms-flex-flow: @flow;
|
||||
flex-flow: @flow;
|
||||
}
|
||||
|
||||
// Display Order
|
||||
// - applies to: flex items
|
||||
// <integer>
|
||||
.flex-order(@order: 0) {
|
||||
-webkit-order: @order;
|
||||
-moz-order: @order;
|
||||
-ms-order: @order;
|
||||
order: @order;
|
||||
}
|
||||
|
||||
// Flex grow factor
|
||||
// - applies to: flex items
|
||||
// <number>
|
||||
.flex-grow(@grow: 0) {
|
||||
-webkit-flex-grow: @grow;
|
||||
-moz-flex-grow: @grow;
|
||||
-ms-flex-grow: @grow;
|
||||
flex-grow: @grow;
|
||||
}
|
||||
|
||||
// Flex shr
|
||||
// - applies to: flex itemsink factor
|
||||
// <number>
|
||||
.flex-shrink(@shrink: 1) {
|
||||
-webkit-flex-shrink: @shrink;
|
||||
-moz-flex-shrink: @shrink;
|
||||
-ms-flex-shrink: @shrink;
|
||||
flex-shrink: @shrink;
|
||||
}
|
||||
|
||||
// Flex basis
|
||||
// - the initial main size of the flex item
|
||||
// - applies to: flex itemsnitial main size of the flex item
|
||||
// <width>
|
||||
.flex-basis(@width: auto) {
|
||||
-webkit-flex-basis: @width;
|
||||
-moz-flex-basis: @width;
|
||||
-ms-flex-basis: @width;
|
||||
flex-basis: @width;
|
||||
}
|
||||
|
||||
// Axis Alignment
|
||||
// - applies to: flex containers
|
||||
// flex-start | flex-end | center | space-between | space-around
|
||||
.justify-content(@justify: flex-start) {
|
||||
-webkit-justify-content: @justify;
|
||||
-moz-justify-content: @justify;
|
||||
-ms-justify-content: @justify;
|
||||
-webkit-box-pack: @justify;
|
||||
justify-content: @justify;
|
||||
}
|
||||
|
||||
// Packing Flex Lines
|
||||
// - applies to: multi-line flex containers
|
||||
// flex-start | flex-end | center | space-between | space-around | stretch
|
||||
.align-content(@align: stretch) {
|
||||
-webkit-align-content: @align;
|
||||
-moz-align-content: @align;
|
||||
-webkit-box-align: @align;
|
||||
-ms-align-content: @align;
|
||||
align-content: @align;
|
||||
}
|
||||
|
||||
// Cross-axis Alignment
|
||||
// - applies to: flex containers
|
||||
// flex-start | flex-end | center | baseline | stretch
|
||||
.align-items(@align: stretch) {
|
||||
-webkit-align-items: @align;
|
||||
-moz-align-items: @align;
|
||||
-ms-align-items: @align;
|
||||
align-items: @align;
|
||||
}
|
||||
|
||||
// Cross-axis Alignment
|
||||
// - applies to: flex items
|
||||
// auto | flex-start | flex-end | center | baseline | stretch
|
||||
.align-self(@align: auto) {
|
||||
-webkit-align-self: @align;
|
||||
-moz-align-self: @align;
|
||||
-ms-align-self: @align;
|
||||
align-self: @align;
|
||||
}
|
||||
153
modules/backend/assets/less/core/variables.less
Normal file
@@ -0,0 +1,153 @@
|
||||
//
|
||||
// Override UI variables
|
||||
// --------------------------------------------------
|
||||
|
||||
@font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
|
||||
//
|
||||
// Paths
|
||||
// --------------------------------------------------
|
||||
|
||||
@type-font-path: "../font";
|
||||
|
||||
//
|
||||
// Colors
|
||||
// --------------------------------------------------
|
||||
|
||||
@color-border: #cccccc;
|
||||
@color-border-light: #e1e1e1;
|
||||
|
||||
@color-mainmenu: #151515;
|
||||
@color-mainmenu-inactive: rgba(255,255,255,.6);
|
||||
@color-mainmenu-active: #ffffff;
|
||||
@color-mainmenu-active-bg: #262626;
|
||||
@color-mainmenu-collapsed: #000000;
|
||||
|
||||
@color-accountmenu-bg: #f9f9f9;
|
||||
@color-accountmenu-text: #666666;
|
||||
@color-accountmenu-divider: #e0e0e0;
|
||||
|
||||
@color-footer: rgba(255,255,255,.8);
|
||||
@color-footer-border: #dfdfdf;
|
||||
@color-footer-text: #666666;
|
||||
|
||||
@color-sidebarnav-active-text: #ffffff;
|
||||
@color-sidebarnav-active-icon: #ffffff;
|
||||
@color-sidebarnav-inactive-text: rgba(255,255,255,.6);
|
||||
@color-sidebarnav-inactive-icon: rgba(255,255,255,.6);
|
||||
@color-sidebarnav-counter-bg: #d9350f;
|
||||
@color-sidebarnav-counter-text: #ffffff;
|
||||
|
||||
@color-sidebarnav-tree-group: #ecf0f1;
|
||||
@color-sidebarnav-tree-group-bg: rgba(0,0,0,.15);
|
||||
@color-sidebarnav-tree-inactive-header: #ffffff;
|
||||
@color-sidebarnav-tree-inactive-desc: rgba(255,255,255,.6);
|
||||
@color-sidebarnav-tree-inactive-text: #ffffff;
|
||||
@color-sidebarnav-tree-active-header: #ffffff;
|
||||
@color-sidebarnav-tree-inactive-bg: transparent;
|
||||
@color-sidebarnav-tree-active-text: rgba(255,255,255,.91);
|
||||
@color-sidebarnav-tree-active-marker: @brand-secondary;
|
||||
@color-sidebarnav-back-link-bg: #2b3e50;
|
||||
@color-sidebarnav-back-link-text: #bdc3c7;
|
||||
|
||||
@color-scrollbar-track: transparent;
|
||||
@color-scrollbar-thumb: rgba(0,0,0,.35);
|
||||
@color-scrollpanel-border: #efefef;
|
||||
@color-scrollpanel-fix-button: #aaaaaa;
|
||||
@color-scrollpanel-fix-button-light: #eeeeee;
|
||||
@color-scroll-indicator: #bbbbbb;
|
||||
|
||||
@color-panel-light: #ECF0F1;
|
||||
|
||||
@color-outer-muted-text: rgba(255,255,255,.44);
|
||||
@color-outer-heading: #feffff;
|
||||
@color-outer-description: #999999;
|
||||
@color-outer-bg: #2b3e50;
|
||||
@color-outer-header: @body-bg;
|
||||
@color-outer-form-label: #666666;
|
||||
|
||||
@color-breadcrumb-text-active: #9da3a7;
|
||||
@color-breadcrumb-text: #9B9B9B;
|
||||
@color-breadcrumb-background: #2b343d;
|
||||
|
||||
@color-custom-input-icon: #666666;
|
||||
@color-custom-input-border: #999999;
|
||||
|
||||
@color-input-sidebar-control: #C4C4C4;
|
||||
|
||||
@color-switch-input-bg: #f6f6f6;
|
||||
@color-switch-input-on: #8da85e;
|
||||
@color-switch-input-off: #cc3300;
|
||||
|
||||
@color-custom-select-border: #b2b9be;
|
||||
@color-custom-select-bg: #f6f6f6;
|
||||
@color-custom-select-bg-hover: #4da7e8;
|
||||
|
||||
@color-filelist-norecords-text: #666666;
|
||||
@color-filelist-norecords-bg: #eeeeee;
|
||||
@color-filelist-cb-border: #cccccc;
|
||||
@color-filelist-title-hero: #2b3e50;
|
||||
@color-filelist-hero-item-bg: #ffffff;
|
||||
@color-filelist-hero-hover-bg: @highlight-hover-bg;
|
||||
@color-filelist-hero-hover-text: @highlight-hover-text;
|
||||
@color-filelist-hero-active-bg: @highlight-active-bg;
|
||||
@color-filelist-hero-active-text: @highlight-active-text;
|
||||
|
||||
@color-fancy-master-tabs-bg: @brand-secondary-darker;
|
||||
@color-fancy-master-tabs-active-text: #ffffff;
|
||||
@color-fancy-master-tabs-inactive-text: rgba(255, 255, 255, .35);
|
||||
@color-fancy-master-panel-bg: @brand-secondary-darker;
|
||||
|
||||
@color-fancy-secondary-tabs-bg: #475354;
|
||||
@color-fancy-secondary-tabs-active-text: #ffffff;
|
||||
@color-fancy-secondary-tabs-inactive-text: #919898;
|
||||
|
||||
@color-fancy-primary-tabs-bg: #7F8C8D;
|
||||
@color-fancy-primary-tabs-inactive-text: #95a5a6;
|
||||
@color-fancy-primary-tabs-active-text: #808c8d;
|
||||
@color-fancy-primary-tabs-active-bg: #fafafa;
|
||||
@color-fancy-primary-tabs-inactive-bg: #d5d9d8;
|
||||
|
||||
@color-fancy-form-tabless-fields-bg: @brand-secondary;
|
||||
@color-fancy-form-label: rgba(255, 255, 255, .5);
|
||||
@color-fancy-form-text: #ffffff;
|
||||
@color-fancy-form-text-selection: @brand-secondary-darker;
|
||||
@color-fancy-form-placeholder: rgba(255, 255, 255, .5);
|
||||
@color-fancy-form-inactive-tab: #2c9cb9;
|
||||
|
||||
@color-sortable-caret: #999999;
|
||||
@color-sortable-active: @brand-secondary;
|
||||
|
||||
@color-report-widget-title: #7e8c8d;
|
||||
@color-report-widget-control-inactive: #b6b6b6;
|
||||
@color-report-widget-description: @color-report-widget-title;
|
||||
@color-report-widget-link: @color-report-widget-title;
|
||||
|
||||
@color-treeview-item-bg: #ffffff;
|
||||
@color-treeview-item-title: #2b3e50;
|
||||
@color-treeview-item-comment: #95a5a6;
|
||||
@color-treeview-control: #bdc3c7;
|
||||
@color-treeview-hover-bg: @highlight-hover-bg;
|
||||
@color-treeview-hover-text: @highlight-hover-text;
|
||||
@color-treeview-active-bg: @highlight-active-bg;
|
||||
@color-treeview-active-text: @highlight-active-text;
|
||||
@color-treeview-item-active-comment: #8f8f8f;
|
||||
@color-treeview-submenu-text: #ffffff;
|
||||
@color-treeview-light-submenu-bg: #2581b8;
|
||||
@color-treeview-light-submenu-border: #328ec8;
|
||||
|
||||
//
|
||||
// Sizes
|
||||
// --------------------------------------------------
|
||||
@size-tiny: 50px;
|
||||
@size-small: 100px;
|
||||
@size-large: 200px;
|
||||
@size-huge: 250px;
|
||||
@size-giant: 350px;
|
||||
|
||||
//
|
||||
// Media breakpoints
|
||||
// --------------------------------------------------
|
||||
|
||||
@menu-breakpoint-min: 770px;
|
||||
@menu-breakpoint-max: (@menu-breakpoint-min - 1);
|
||||
17
modules/backend/assets/less/dashboard/dashboard.less
Normal file
@@ -0,0 +1,17 @@
|
||||
@import "../../../../backend/assets/less/core/boot.less";
|
||||
|
||||
.dashboard-container > .report-container {
|
||||
&.loading {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.loading-indicator-container {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
733
modules/backend/assets/less/layout/fancylayout.less
Normal file
@@ -0,0 +1,733 @@
|
||||
//
|
||||
// FANCY LAYOUT
|
||||
// Applies branding colours to the Backend UI.
|
||||
//
|
||||
|
||||
//
|
||||
// --- TABS
|
||||
//
|
||||
|
||||
// Master tabs
|
||||
body.fancy-layout .master-tabs.control-tabs,
|
||||
.master-tabs.control-tabs.fancy-layout {
|
||||
overflow: hidden;
|
||||
|
||||
&:before, &:after {
|
||||
top: 13px;
|
||||
font-size: 14px;
|
||||
color: @color-fancy-master-tabs-inactive-text;
|
||||
}
|
||||
&:before { left: 8px; }
|
||||
&:after { right: 8px; }
|
||||
&.scroll-before:before { color: @color-fancy-master-tabs-active-text; }
|
||||
&.scroll-after:after { color: @color-fancy-master-tabs-active-text; }
|
||||
|
||||
> div > div.tabs-container {
|
||||
background: @color-fancy-master-tabs-bg;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
|
||||
> ul.nav-tabs {
|
||||
margin-left: -8px;
|
||||
> li {
|
||||
margin-left: -5px;
|
||||
top: 1px;
|
||||
padding-top: 3px;
|
||||
|
||||
span.tab-close {
|
||||
top: 14px;
|
||||
right: -3px;
|
||||
left: auto;
|
||||
z-index: 110;
|
||||
font-family: sans-serif;
|
||||
|
||||
i {
|
||||
top: 4px;
|
||||
right: 1px;
|
||||
color: rgba(255, 255, 255, 0.3) !important;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
|
||||
&:hover { color: @color-fancy-master-tabs-active-text !important; }
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
border-bottom: none;
|
||||
background: transparent;
|
||||
font-size: 14px;
|
||||
color: @color-fancy-master-tabs-inactive-text;
|
||||
padding: 6px 0 0 24px!important;
|
||||
overflow: visible;
|
||||
|
||||
> span.title {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding: 12px 5px 0 5px;
|
||||
height: 38px;
|
||||
font-size: 14px;
|
||||
z-index: 100;
|
||||
background-color: @color-fancy-form-inactive-tab;
|
||||
|
||||
&:before, &:after {
|
||||
content: ' ';
|
||||
position: absolute;
|
||||
width: 20px;
|
||||
display: block;
|
||||
height: 37px;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
background-color: @color-fancy-form-inactive-tab;
|
||||
}
|
||||
|
||||
&:before {
|
||||
left: -14px;
|
||||
.border-radius(8px 0 0 0);
|
||||
.transform( ~'skewX(-20deg)');
|
||||
|
||||
}
|
||||
|
||||
&:after {
|
||||
right: -14px;
|
||||
.border-radius(0 8px 0 0);
|
||||
.transform( ~'skewX(20deg)');
|
||||
}
|
||||
|
||||
span {
|
||||
border-top: none;
|
||||
padding: 0;
|
||||
margin-top: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
|
||||
&:before {
|
||||
z-index: 110;
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
left: 22px;
|
||||
}
|
||||
|
||||
&[class*=icon] > span.title {
|
||||
padding-left: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
&.active {
|
||||
a {
|
||||
z-index: 107;
|
||||
color: @color-fancy-master-tabs-active-text;
|
||||
}
|
||||
span.tab-close i { color: @color-fancy-master-tabs-active-text; }
|
||||
|
||||
a > span.title {
|
||||
background-color: @color-fancy-form-tabless-fields-bg;
|
||||
z-index: 105;
|
||||
&:before {
|
||||
z-index: 107;
|
||||
background-color: @color-fancy-form-tabless-fields-bg;
|
||||
}
|
||||
&:after {
|
||||
background-color: @color-fancy-form-tabless-fields-bg;
|
||||
z-index: 107;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&[data-modified] {
|
||||
span.tab-close i {
|
||||
top: 5px;
|
||||
.hide-text();
|
||||
|
||||
&:before {
|
||||
.icon(@circle);
|
||||
font-size: 9px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&[data-closable] {
|
||||
> div > div.tabs-container {
|
||||
> ul.nav-tabs {
|
||||
> li {
|
||||
a > span.title {
|
||||
padding-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.has-tabs {
|
||||
&:before, &:after {display: block;}
|
||||
}
|
||||
|
||||
&.has-tabs {
|
||||
> div.tab-content {
|
||||
background: @body-bg;
|
||||
}
|
||||
}
|
||||
|
||||
> .tab-content > .tab-pane {
|
||||
padding: 0;
|
||||
|
||||
&.padded-pane {
|
||||
padding: @padding-standard @padding-standard 0 @padding-standard;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Primary Tabs
|
||||
.fancy-layout *:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .control-tabs.primary-tabs,
|
||||
*:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .control-tabs.fancy-layout.primary-tabs {
|
||||
&.master-area {
|
||||
> div > ul.nav-tabs {
|
||||
.transition(background-color 0.5s);
|
||||
background: @color-fancy-form-tabless-fields-bg;
|
||||
}
|
||||
}
|
||||
|
||||
> div > ul.nav-tabs {
|
||||
background: @color-fancy-primary-tabs-bg;
|
||||
margin-left: 0!important;
|
||||
margin-right: 0!important;
|
||||
|
||||
&:before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
> li {
|
||||
background: transparent;
|
||||
border-right: none;
|
||||
margin-right: -8px;
|
||||
|
||||
&:first-child {
|
||||
margin-left: -5px;
|
||||
}
|
||||
|
||||
a {
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 12px 16px 0px;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: @color-fancy-primary-tabs-inactive-text;
|
||||
|
||||
span.title {
|
||||
background: @color-fancy-primary-tabs-inactive-bg;
|
||||
border-top: none;
|
||||
padding: 5px 5px 3px 5px;
|
||||
|
||||
&:before, &:after {
|
||||
background: @color-fancy-primary-tabs-inactive-bg;
|
||||
border-width: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
&:before {
|
||||
left: -20px;
|
||||
}
|
||||
|
||||
&:after {
|
||||
right: -20px;
|
||||
}
|
||||
|
||||
span {
|
||||
border-width: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.active {
|
||||
a {
|
||||
color: @color-fancy-primary-tabs-active-text;
|
||||
&:before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
span.title {
|
||||
background: @color-fancy-primary-tabs-active-bg;
|
||||
|
||||
&:before, &:after {
|
||||
background: @color-fancy-primary-tabs-active-bg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> .tab-content > .tab-pane {
|
||||
padding: @padding-standard @padding-standard 0 @padding-standard;
|
||||
|
||||
&.pane-compact {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.collapsed {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.has-tabs {
|
||||
> div.tab-content {
|
||||
background: @body-bg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Secondary tabs
|
||||
.fancy-layout *:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .control-tabs.secondary-tabs {
|
||||
// Target horizontal scroll indicators
|
||||
&:before {
|
||||
left: 5px;
|
||||
}
|
||||
&:after {
|
||||
right: 5px;
|
||||
}
|
||||
> div > ul.nav-tabs {
|
||||
background: @color-fancy-secondary-tabs-bg;
|
||||
> li {
|
||||
border-right: none;
|
||||
padding-right: 0;
|
||||
margin-right: 0;
|
||||
a {
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 12px 10px 13px 10px;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
line-height: 14px;
|
||||
color: @color-fancy-secondary-tabs-inactive-text;
|
||||
|
||||
span {
|
||||
span {
|
||||
overflow: visible;
|
||||
border-top: none;
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
padding-left: 15px; // Will cause issues when first child is hidden
|
||||
}
|
||||
|
||||
&.active {
|
||||
a {color: @color-fancy-secondary-tabs-active-text;}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tab-collapse-icon {
|
||||
position: absolute;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
.opacity(0.6);
|
||||
.transition(all 0.3s);
|
||||
font-size: 12px;
|
||||
color: @color-fancy-master-tabs-active-text;
|
||||
right: 11px;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
.opacity(1);
|
||||
}
|
||||
|
||||
&.primary {
|
||||
color: @color-fancy-master-tabs-active-text;
|
||||
top: 12px;
|
||||
right: 11px;
|
||||
bottom: auto;
|
||||
z-index: 100;
|
||||
.scaleAxes(1, -1);
|
||||
|
||||
i {
|
||||
position: relative;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.primary-collapsed {
|
||||
.tab-collapse-icon.primary {
|
||||
.scaleAxes(1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
&.secondary-content-tabs {
|
||||
> div > ul.nav-tabs {
|
||||
background: @body-bg;
|
||||
|
||||
> li {
|
||||
margin-left: -19px;
|
||||
|
||||
&:first-child {
|
||||
margin-left: 0;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
a {
|
||||
padding: 8px 16px 0 16px;
|
||||
font-weight: 400;
|
||||
height: 36px;
|
||||
color: #2b3e50;
|
||||
.opacity(0.6);
|
||||
|
||||
> span.title {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding: 8px 5px 9px 5px;
|
||||
font-size: 14px;
|
||||
z-index: 100;
|
||||
height: 27px!important;
|
||||
background-color: transparent;
|
||||
|
||||
&:before, &:after {
|
||||
content: ' ';
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
width: 15px;
|
||||
height: 28px;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:before {
|
||||
left: -11px;
|
||||
.border-radius(8px 0 0 0);
|
||||
.transform( ~'skewX(-20deg)');
|
||||
}
|
||||
|
||||
&:after {
|
||||
right: -11px;
|
||||
.border-radius(0 8px 0 0);
|
||||
.transform( ~'skewX(20deg)');
|
||||
}
|
||||
|
||||
span {
|
||||
height: 18px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.active a {
|
||||
.opacity(1);
|
||||
|
||||
> span.title {
|
||||
background-color: white;
|
||||
&:before, &:after {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tab-collapse-icon.primary {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
&.primary-collapsed {
|
||||
.tab-collapse-icon.primary {
|
||||
color: @color-fancy-master-tabs-active-text;
|
||||
}
|
||||
|
||||
> div > ul.nav-tabs {
|
||||
background: @color-fancy-form-tabless-fields-bg;
|
||||
|
||||
> li {
|
||||
a {
|
||||
color: white;
|
||||
|
||||
> span.title {
|
||||
&:before, &:after {
|
||||
background-color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.active a {
|
||||
color: #2b3e50;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.has-tabs {
|
||||
> div.tab-content {
|
||||
background: @body-bg;
|
||||
}
|
||||
}
|
||||
|
||||
> .tab-content > .tab-pane {
|
||||
padding: 0;
|
||||
|
||||
&.padded-pane {
|
||||
padding: @padding-standard @padding-standard 0 @padding-standard;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tabless (outside) fields
|
||||
.fancy-layout *:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .form-tabless-fields {
|
||||
.clearfix();
|
||||
position: relative;
|
||||
background: @color-fancy-form-tabless-fields-bg;
|
||||
padding: 18px 23px 0 23px;
|
||||
.transition(all 0.5s);
|
||||
|
||||
label {
|
||||
text-transform: uppercase;
|
||||
color: @color-fancy-form-label;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.form-control[disabled] {
|
||||
background-color: rgba(29, 29, 29, 0.11) !important;
|
||||
}
|
||||
|
||||
input[type=text] {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: @color-fancy-form-text;
|
||||
font-size: 35px;
|
||||
font-weight: 100;
|
||||
height: auto;
|
||||
padding: 0;
|
||||
.placeholder(@color-fancy-form-placeholder);
|
||||
.box-shadow(none);
|
||||
|
||||
&:focus, &:hover {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.form-group {
|
||||
padding-bottom: 0;
|
||||
|
||||
&.is-required {
|
||||
> label:after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tab-collapse-icon {
|
||||
position: absolute;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
.opacity(0.6);
|
||||
.transition(all 0.3s);
|
||||
font-size: 12px;
|
||||
color: @color-fancy-master-tabs-active-text;
|
||||
right: 11px;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
.opacity(1);
|
||||
}
|
||||
|
||||
&.primary {
|
||||
color: @color-fancy-master-tabs-active-text;
|
||||
top: 12px;
|
||||
right: 11px;
|
||||
bottom: auto;
|
||||
z-index: 100;
|
||||
.scaleAxes(1, -1);
|
||||
|
||||
i {
|
||||
position: relative;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
&.tabless {
|
||||
top: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
&.collapsed {
|
||||
padding: 5px 23px 0 10px;
|
||||
|
||||
.tab-collapse-icon {
|
||||
&.tabless {
|
||||
.scaleAxes(1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
.form-group:not(.collapse-visible) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.form-buttons {
|
||||
margin-left: 10px;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.loading-indicator-container {
|
||||
.loading-indicator {
|
||||
background-color: @color-fancy-form-tabless-fields-bg;
|
||||
padding: 0 0 0 30px;
|
||||
color: @color-fancy-form-label;
|
||||
margin-top: 1px;
|
||||
height: 90%;
|
||||
font-size: 12px;
|
||||
line-height: 100%;
|
||||
> span {
|
||||
left: -10px;
|
||||
top: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// --- FANCY BREADCRUMBS
|
||||
//
|
||||
|
||||
body.breadcrumb-fancy .control-breadcrumb,
|
||||
.control-breadcrumb.breadcrumb-fancy {
|
||||
margin-bottom: 0;
|
||||
|
||||
background-color: mix(black, saturate(@color-fancy-form-tabless-fields-bg, 20%), 16%);
|
||||
|
||||
li {
|
||||
background-color: mix(black, saturate(@color-fancy-form-tabless-fields-bg, 20%), 31%);
|
||||
color: rgba(255,255,255, .5);
|
||||
|
||||
a {
|
||||
opacity: .5;
|
||||
.transition(all 0.3s ease);
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
&:not(:last-child)::before {
|
||||
border-left-color: @color-fancy-form-tabless-fields-bg;
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
&:after {
|
||||
border-left-color: mix(black, saturate(@color-fancy-form-tabless-fields-bg, 20%), 31%);
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
background-color: mix(black, saturate(@color-fancy-form-tabless-fields-bg, 20%), 16%);
|
||||
|
||||
&:before {
|
||||
opacity: 1;
|
||||
border-left-color: mix(black, saturate(@color-fancy-form-tabless-fields-bg, 20%), 16%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// --- FORM BUTTONS
|
||||
//
|
||||
|
||||
.fancy-layout *:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .control-tabs .form-buttons:not(.normalized),
|
||||
.fancy-layout *:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .form-tabless-fields .form-buttons:not(.normalized) {
|
||||
.transition(all 0.5s);
|
||||
padding-top: 14px;
|
||||
padding-bottom: 5px;
|
||||
|
||||
.btn {
|
||||
padding: 0;
|
||||
margin-right: 5px;
|
||||
margin-top: -6px;
|
||||
margin-right: 30px;
|
||||
background: transparent;
|
||||
color: @color-fancy-master-tabs-active-text;
|
||||
font-weight: normal;
|
||||
.box-shadow(none);
|
||||
|
||||
.opacity(0.5);
|
||||
.transition(all 0.3s ease);
|
||||
|
||||
&:hover {
|
||||
.opacity(1);
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
&[class^="wn-icon-"],
|
||||
&[class*=" wn-icon-"],
|
||||
&[class^="oc-icon-"],
|
||||
&[class*=" oc-icon-"] {
|
||||
&:before {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fancy-layout form[class$="-data-changed"] *:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .control-tabs .btn.save {
|
||||
.opacity(1);
|
||||
}
|
||||
|
||||
//
|
||||
// --- FIELDS AND WIDGETS
|
||||
//
|
||||
|
||||
// Code editor
|
||||
.fancy-layout *:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .control-tabs > .tab-content > .tab-pane > .form-group > .field-codeeditor {
|
||||
border: none !important;
|
||||
.border-radius(0);
|
||||
|
||||
.editor-code {
|
||||
.border-radius(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Rich editor
|
||||
.fancy-layout *:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .control-tabs > .tab-content > .tab-pane > .form-group > .field-richeditor {
|
||||
border: none;
|
||||
border-left: 1px solid @color-form-field-border !important;
|
||||
|
||||
&, .fr-toolbar, .fr-wrapper {
|
||||
.border-radius(0);
|
||||
.border-top-radius(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Rich editor in a secondary content tab
|
||||
.fancy-layout *:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .control-tabs.secondary-content-tabs > .tab-content > .tab-pane > .form-group > .field-richeditor {
|
||||
.fr-toolbar {
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
|
||||
// Rich editor when the side panel is not fixed
|
||||
body.side-panel-not-fixed .fancy-layout *:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .control-tabs > .tab-content > .tab-pane > .form-group > .field-richeditor,
|
||||
body.side-panel-not-fixed.fancy-layout *:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .control-tabs > .tab-content > .tab-pane > .form-group > .field-richeditor {
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
// Loading indicator
|
||||
html.cssanimations .fancy-layout *:not(.nested-form):not(.modal-body) > .form-widget > .layout-row > .form-tabless-fields .loading-indicator-container .loading-indicator > span {
|
||||
.animation(spin 1s linear infinite);
|
||||
background-image: url('../../../system/assets/ui/images/loader-white.svg');
|
||||
background-size: 20px 20px;
|
||||
}
|
||||
50
modules/backend/assets/less/layout/flexlayout.less
Normal file
@@ -0,0 +1,50 @@
|
||||
.flex-layout-column {
|
||||
.flex-display();
|
||||
.flex-direction-column();
|
||||
|
||||
&.full-height-strict {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&.absolute {
|
||||
position: absolute!important;
|
||||
}
|
||||
|
||||
&.fill-container {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.flex-layout-row {
|
||||
.flex-display();
|
||||
.flex-direction-row();
|
||||
}
|
||||
|
||||
.flex-layout-column, .flex-layout-row {
|
||||
&.justify-center {.justify-content(center);}
|
||||
&.align-center {
|
||||
.align-items(center);
|
||||
.align-content(center);
|
||||
}
|
||||
|
||||
&.full-height {
|
||||
min-height: 100%;
|
||||
// height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.flex-layout-item {
|
||||
margin: 0;
|
||||
&.fix { .flex-fix(); }
|
||||
&.stretch { .flex-stretch(); }
|
||||
&.stretch-constrain { .flex-stretch-constrain(); }
|
||||
&.center { .align-self(center); }
|
||||
|
||||
&.relative { position: relative; }
|
||||
|
||||
&.layout-container { max-width: none; }
|
||||
}
|
||||
48
modules/backend/assets/less/layout/flyout.less
Normal file
@@ -0,0 +1,48 @@
|
||||
.flyout-container {
|
||||
> .flyout {
|
||||
overflow: hidden;
|
||||
width: 0;
|
||||
left: 0!important;
|
||||
.transition(width 0.1s);
|
||||
}
|
||||
}
|
||||
|
||||
.flyout-overlay {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
z-index: 5000;
|
||||
position: absolute;
|
||||
background-color: rgba(0,0,0,0);
|
||||
.transition(background-color 0.3s);
|
||||
}
|
||||
|
||||
.flyout-toggle {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: 0;
|
||||
width: 23px;
|
||||
height: 25px;
|
||||
background: #2b3e50;
|
||||
cursor: pointer;
|
||||
.border-right-radius(4px);
|
||||
color: #bdc3c7;
|
||||
font-size: 10px;
|
||||
|
||||
i {
|
||||
margin: 7px 0 0 6px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
&:hover i {
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
body.flyout-visible {
|
||||
overflow: hidden;
|
||||
|
||||
.flyout-overlay {
|
||||
background-color: rgba(0,0,0,0.3);
|
||||
}
|
||||
}
|
||||
32
modules/backend/assets/less/layout/footer.less
Normal file
@@ -0,0 +1,32 @@
|
||||
@footer-zindex: 100;
|
||||
@footer-height: 60;
|
||||
|
||||
#layout-footer {
|
||||
width: 100%;
|
||||
z-index: @footer-zindex;
|
||||
height: @footer-height + 0px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
color: @color-footer-text;
|
||||
background-color: @color-footer;
|
||||
border-top: 1px solid @color-footer-border;
|
||||
|
||||
.brand, .tagline {
|
||||
margin: 10px;
|
||||
height: (@footer-height - 20) + 0px;
|
||||
line-height: (@footer-height - 20) + 0px;
|
||||
}
|
||||
|
||||
.brand {
|
||||
float: left;
|
||||
font-size: 16px;
|
||||
.logo { margin: 0 10px; }
|
||||
.name { }
|
||||
}
|
||||
|
||||
.tagline {
|
||||
float: right;
|
||||
p { color: lighten(@color-footer-text, 20%); }
|
||||
}
|
||||
}
|
||||
|
||||
234
modules/backend/assets/less/layout/layout.less
Normal file
@@ -0,0 +1,234 @@
|
||||
//
|
||||
// Common layout elements
|
||||
// --------------------------------------------------
|
||||
|
||||
html:not(.mobile) body.drag * {
|
||||
cursor: grab !important;
|
||||
cursor: -webkit-grab !important;
|
||||
cursor: -moz-grab !important;
|
||||
}
|
||||
|
||||
// Used by sortable plugin
|
||||
body.dragging, body.dragging * {
|
||||
cursor: move !important;
|
||||
}
|
||||
|
||||
body.loading, body.loading * {
|
||||
cursor: wait !important;
|
||||
}
|
||||
|
||||
body.no-select {
|
||||
.user-select(none);
|
||||
cursor: default !important;
|
||||
}
|
||||
|
||||
//
|
||||
// Layout canvas
|
||||
//
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
/* The html and body elements cannot have any padding or margin. */
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: @font-family-base;
|
||||
background: @body-bg;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
#layout-canvas {
|
||||
min-height: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
//
|
||||
// Font
|
||||
//
|
||||
|
||||
// Removed for performance reasons
|
||||
//
|
||||
// @import url(https://fonts.googleapis.com/css?family=Noto+Sans:400,400italic,700,700italic);
|
||||
//
|
||||
// body {
|
||||
// font-family: 'Noto Sans', sans-serif;
|
||||
// }
|
||||
|
||||
//
|
||||
// Tabs override for Layout
|
||||
// Primary tabs should use inset by default, unless otherwise specified
|
||||
// --------------------------------------------------
|
||||
|
||||
.control-tabs.primary-tabs {
|
||||
> ul.nav-tabs, > div > ul.nav-tabs, > div > div > ul.nav-tabs {
|
||||
margin-left: -(@padding-standard);
|
||||
margin-right: -(@padding-standard);
|
||||
}
|
||||
|
||||
&.tabs-no-inset {
|
||||
> ul.nav-tabs, > div > ul.nav-tabs, > div > div > ul.nav-tabs {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Flexible layout system
|
||||
// --------------------------------------------------
|
||||
|
||||
.layout {
|
||||
.layout-cell() {
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
height: 100%;
|
||||
|
||||
&.layout-container, .layout-container, &.padded-container, .padded-container {
|
||||
padding: @padding-standard @padding-standard 0 @padding-standard;
|
||||
|
||||
// Container to sit flush to the element above
|
||||
.container-flush {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.layout-relative {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.layout-absolute {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&.min-size {
|
||||
width: 0;
|
||||
}
|
||||
|
||||
&.min-height {
|
||||
height: 0;
|
||||
}
|
||||
|
||||
&.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&.middle {
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
display: table;
|
||||
table-layout: fixed;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
> .layout-row {
|
||||
display: table-row;
|
||||
vertical-align: top;
|
||||
height: 100%;
|
||||
|
||||
> .layout-cell {
|
||||
.layout-cell();
|
||||
}
|
||||
|
||||
&.min-size {
|
||||
height: 0.1px;
|
||||
}
|
||||
}
|
||||
|
||||
> .layout-cell {
|
||||
.layout-cell();
|
||||
}
|
||||
}
|
||||
|
||||
.whiteboard {
|
||||
background: white;
|
||||
}
|
||||
|
||||
.layout-fill-container {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculated fixed width
|
||||
//
|
||||
|
||||
[data-calculate-width] {
|
||||
> form, > div {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Layout styles
|
||||
//
|
||||
|
||||
body.compact-container {
|
||||
.layout {
|
||||
&.layout-container, .layout-container { padding: 0 !important; }
|
||||
}
|
||||
}
|
||||
|
||||
body.slim-container {
|
||||
.layout {
|
||||
&.layout-container, .layout-container { padding-left: 0 !important; padding-right: 0 !important; }
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Screen specific
|
||||
//
|
||||
|
||||
@media (max-width: @screen-sm) {
|
||||
.layout {
|
||||
.hide-on-small {
|
||||
display: none;
|
||||
}
|
||||
|
||||
//
|
||||
// Layout with a responsive sidebar
|
||||
//
|
||||
|
||||
&.responsive-sidebar {
|
||||
> .layout-cell:first-child {
|
||||
display: table-footer-group;
|
||||
height: auto;
|
||||
|
||||
.control-breadcrumb {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
> .layout-cell:last-child {
|
||||
display: table-header-group;
|
||||
width: auto;
|
||||
height: auto;
|
||||
|
||||
.layout-absolute {
|
||||
position: static;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Browser specific
|
||||
//
|
||||
|
||||
// Remove focus outline for mouse clicks, keep for keyboard navigation
|
||||
@supports (-moz-appearance: none) {
|
||||
a:focus:not(:focus-visible) {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
680
modules/backend/assets/less/layout/mainmenu.less
Normal file
@@ -0,0 +1,680 @@
|
||||
//
|
||||
// Top navigation bar
|
||||
// --------------------------------------------------
|
||||
|
||||
@mainmenu-mode-tile-height: 78px;
|
||||
@mainmenu-mode-inline-height: 60px;
|
||||
@mainmenu-mode-collapse-height: 45px;
|
||||
|
||||
@mainmenu-icon-dimension: 30px;
|
||||
@mainmenu-tile-dimension: 65px;
|
||||
@mainmenu-tile-label-height: 20px;
|
||||
@mainmenu-tile-label-width: 100px;
|
||||
|
||||
body.mainmenu-open {
|
||||
overflow: hidden;
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.mainmenu-item-link() {
|
||||
display: inline-block;
|
||||
font-size: @font-size-base;
|
||||
color: inherit;
|
||||
|
||||
&:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
&:active, &:focus {
|
||||
text-decoration: none;
|
||||
color: @color-mainmenu-inactive;
|
||||
}
|
||||
|
||||
i {
|
||||
line-height: 1;
|
||||
font-size: 30px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.mainmenu-item-link-active() {
|
||||
// background: @color-mainmenu-active-bg;
|
||||
// .border-radius(3px);
|
||||
// .box-shadow(inset 0 -2px 0 rgba(0,0,0,.25));
|
||||
}
|
||||
|
||||
.mainmenu-set-height(@height) {
|
||||
height: @height;
|
||||
|
||||
ul.mainmenu-toolbar {
|
||||
li.mainmenu-quick-action {
|
||||
a {
|
||||
height: @height;
|
||||
line-height: @height;
|
||||
}
|
||||
}
|
||||
|
||||
li.mainmenu-account {
|
||||
> a {
|
||||
height: @height;
|
||||
line-height: @height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul li .mainmenu-accountmenu {
|
||||
top: @height + 10;
|
||||
}
|
||||
}
|
||||
|
||||
.mainmenu-tooltip {
|
||||
.tooltip-inner {
|
||||
font-size: @font-size-base - 1;
|
||||
padding: 6px 16px;
|
||||
}
|
||||
}
|
||||
|
||||
ul.mainmenu-nav {
|
||||
font-size: @font-size-base;
|
||||
|
||||
li {
|
||||
/* Fix for SVG icons not rendering on initial page load until repaint (hover, move, etc) */
|
||||
.svg-icon {
|
||||
-webkit-backface-visibility: hidden;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
span.counter {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: .143em;
|
||||
right: 0;
|
||||
padding: .143em .429em .214em .286em;
|
||||
background-color: @color-sidebarnav-counter-bg;
|
||||
color: @color-sidebarnav-counter-text;
|
||||
font-size: .786em;
|
||||
line-height: 100%;
|
||||
.border-radius(3px);
|
||||
.opacity(1);
|
||||
.scale(1);
|
||||
.transition(all 0.3s);
|
||||
|
||||
&.empty {
|
||||
.opacity(0);
|
||||
.scale(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nav#layout-mainmenu {
|
||||
background-color: @color-mainmenu;
|
||||
padding: 0 0 0 20px;
|
||||
line-height: 0;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
&:focus {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
float: left;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
||||
li {
|
||||
color: @color-mainmenu-inactive;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
position: relative;
|
||||
margin-right: 30px;
|
||||
|
||||
a {
|
||||
.mainmenu-item-link();
|
||||
padding: 14px 0 10px;
|
||||
|
||||
img.svg-icon {
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.nav {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.toolbar-item {
|
||||
flex: 1 1 auto;
|
||||
display: block;
|
||||
padding-right: 0;
|
||||
overflow: hidden;
|
||||
|
||||
&-account {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
&:before, &:after {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&:before {
|
||||
left: -12px;
|
||||
}
|
||||
|
||||
&:after {
|
||||
right: -12px;
|
||||
}
|
||||
|
||||
&.scroll-active-before:before {
|
||||
color: @color-mainmenu-active;
|
||||
}
|
||||
|
||||
&.scroll-active-after:after {
|
||||
color: @color-mainmenu-active;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Toolbar
|
||||
//
|
||||
|
||||
ul.mainmenu-toolbar {
|
||||
li.mainmenu-quick-action {
|
||||
margin: 0;
|
||||
|
||||
&:first-child {
|
||||
margin-left: 21px;
|
||||
}
|
||||
|
||||
i {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
a {
|
||||
position: relative;
|
||||
padding: 0 10px;
|
||||
top: -1px;
|
||||
}
|
||||
}
|
||||
|
||||
li.mainmenu-account {
|
||||
margin-right: 0;
|
||||
|
||||
> a {
|
||||
padding: 0 15px 0 10px;
|
||||
font-size: @font-size-base - 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&.highlight > a {
|
||||
z-index: @zindex-popover;
|
||||
}
|
||||
|
||||
img.account-avatar {
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.account-name {
|
||||
//font-weight: bold;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
ul {
|
||||
line-height: 23px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Fading animation (disabled)
|
||||
//
|
||||
|
||||
&:hover {
|
||||
ul.mainmenu-nav li {
|
||||
//.transition(opacity .15s ease);
|
||||
//.opacity(1);
|
||||
}
|
||||
}
|
||||
|
||||
ul.mainmenu-nav li {
|
||||
//.opacity(.65);
|
||||
//.transition(opacity 5s ease);
|
||||
//.transition-delay(5s);
|
||||
|
||||
&.active {
|
||||
//.opacity(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// SVG support
|
||||
//
|
||||
|
||||
html.svg {
|
||||
nav#layout-mainmenu,
|
||||
.mainmenu-collapsed {
|
||||
img.svg-icon {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// User account menu
|
||||
//
|
||||
|
||||
nav#layout-mainmenu ul li .mainmenu-accountmenu {
|
||||
position: fixed;
|
||||
top: 0; // See mode for this value
|
||||
right: @padding-standard;
|
||||
background: @color-accountmenu-bg;
|
||||
z-index: @zindex-popover;
|
||||
display: none;
|
||||
.box-shadow(@overlay-box-shadow);
|
||||
border-radius: @border-radius-base;
|
||||
|
||||
&.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
&:after {
|
||||
.triangle(up, 17px, 7px, @color-accountmenu-bg);
|
||||
right: 9px;
|
||||
top: -7px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
ul {
|
||||
float: none;
|
||||
display: block;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
li {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
display: block;
|
||||
|
||||
a {
|
||||
display: block;
|
||||
padding: (@padding-standard * 0.5) (@padding-standard * 1.5);
|
||||
text-align: left;
|
||||
font-size: @font-size-base;
|
||||
color: @color-accountmenu-text;
|
||||
|
||||
&:hover, &:focus {
|
||||
background: @highlight-hover-bg;
|
||||
color: @highlight-hover-text;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: @highlight-active-bg;
|
||||
color: @highlight-active-text;
|
||||
}
|
||||
}
|
||||
|
||||
&:first-child a {
|
||||
&:hover, &:focus, &:active {
|
||||
&:after {
|
||||
.triangle(up, 17px, 7px, @highlight-hover-bg);
|
||||
position: absolute;
|
||||
right: 9px;
|
||||
top: -7px;
|
||||
z-index: 102;
|
||||
}
|
||||
}
|
||||
&:active {
|
||||
&:after {
|
||||
.triangle(up, 17px, 7px, @highlight-active-bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
li.divider {
|
||||
height: 1px;
|
||||
width: 100%;
|
||||
background-color: @color-accountmenu-divider;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Navbar (Inline mode)
|
||||
//
|
||||
|
||||
nav#layout-mainmenu.navbar-mode-inline,
|
||||
nav#layout-mainmenu.navbar-mode-inline_no_icons {
|
||||
.mainmenu-set-height(@mainmenu-mode-inline-height);
|
||||
|
||||
ul.mainmenu-nav {
|
||||
li {
|
||||
margin: 5px 0;
|
||||
|
||||
a {
|
||||
padding: 10px 15px;
|
||||
|
||||
.nav-icon {
|
||||
position: relative;
|
||||
top: -1px;
|
||||
margin-right: 5px;
|
||||
width: @mainmenu-icon-dimension;
|
||||
height: @mainmenu-icon-dimension;
|
||||
i, img { margin: 0; }
|
||||
}
|
||||
.nav-label {
|
||||
line-height: @mainmenu-icon-dimension;
|
||||
}
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
margin-left: -13px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
li.active {
|
||||
.mainmenu-item-link-active();
|
||||
|
||||
// &:first-child {
|
||||
// margin-left: 0;
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Navbar (Inline no icons mode)
|
||||
//
|
||||
nav#layout-mainmenu.navbar-mode-inline_no_icons .nav-icon {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
//
|
||||
// Navbar (Tiles mode)
|
||||
//
|
||||
|
||||
nav#layout-mainmenu.navbar-mode-tile {
|
||||
.mainmenu-set-height(@mainmenu-mode-tile-height);
|
||||
.mainmenu-navbar-tiles();
|
||||
}
|
||||
|
||||
.mainmenu-navbar-tiles() {
|
||||
ul.mainmenu-nav {
|
||||
li a {
|
||||
position: relative;
|
||||
width: @mainmenu-tile-dimension;
|
||||
height: @mainmenu-tile-dimension;
|
||||
|
||||
// Offset from bottom
|
||||
@tile-bottom-offset: 4;
|
||||
|
||||
.nav-icon {
|
||||
text-align: center;
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-left: -(@mainmenu-icon-dimension / 2);
|
||||
margin-top: -((@mainmenu-tile-dimension - @mainmenu-tile-label-height) / 2) - @tile-bottom-offset;
|
||||
width: @mainmenu-icon-dimension;
|
||||
height: @mainmenu-icon-dimension;
|
||||
i, img { margin: 0; }
|
||||
}
|
||||
|
||||
.nav-label {
|
||||
display: block;
|
||||
width: @mainmenu-tile-label-width;
|
||||
height: @mainmenu-tile-label-height;
|
||||
line-height: @mainmenu-tile-label-height;
|
||||
position: absolute;
|
||||
bottom: @tile-bottom-offset + 0px;
|
||||
left: 50%;
|
||||
padding: 0 5px;
|
||||
margin-left: -(@mainmenu-tile-label-width / 2);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
li {
|
||||
padding: 0 15px;
|
||||
margin: 7px 0 0;
|
||||
|
||||
&:first-child {
|
||||
margin-left: -7px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.nav-label {
|
||||
width: auto;
|
||||
min-width: @mainmenu-tile-label-width;
|
||||
text-overflow: all;
|
||||
overflow: visible;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
li.active {
|
||||
.mainmenu-item-link-active();
|
||||
|
||||
a {
|
||||
// font-weight: bold;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Mobile (Collapsed mode)
|
||||
//
|
||||
|
||||
nav#layout-mainmenu {
|
||||
.menu-toggle {
|
||||
height: @mainmenu-mode-collapse-height;
|
||||
line-height: @mainmenu-mode-collapse-height;
|
||||
font-size: @font-size-base + 2;
|
||||
display: none;
|
||||
|
||||
.menu-toggle-icon {
|
||||
background: #333;
|
||||
display: inline-block;
|
||||
height: @mainmenu-mode-collapse-height;
|
||||
line-height: @mainmenu-mode-collapse-height;
|
||||
width: @mainmenu-mode-collapse-height;
|
||||
text-align: center;
|
||||
opacity: .7;
|
||||
|
||||
i {
|
||||
line-height: @mainmenu-mode-collapse-height;
|
||||
font-size: 20px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-toggle-title {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.menu-toggle-icon {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
body.mainmenu-open {
|
||||
nav#layout-mainmenu {
|
||||
.menu-toggle-icon {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nav#layout-mainmenu.navbar-mode-collapse {
|
||||
.mainmenu-navbar-collapse();
|
||||
}
|
||||
|
||||
@media (max-width: @menu-breakpoint-max) {
|
||||
nav#layout-mainmenu.navbar {
|
||||
.mainmenu-navbar-collapse();
|
||||
}
|
||||
}
|
||||
|
||||
.mainmenu-navbar-collapse() {
|
||||
padding-left: 0;
|
||||
|
||||
.mainmenu-set-height(@mainmenu-mode-collapse-height);
|
||||
|
||||
ul.mainmenu-toolbar li.mainmenu-account > a {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
ul li .mainmenu-accountmenu:after {
|
||||
right: 13px;
|
||||
}
|
||||
|
||||
ul.nav { display: none; }
|
||||
|
||||
.menu-toggle {
|
||||
display: inline-block;
|
||||
color: @color-mainmenu-active !important;
|
||||
// font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.mainmenu-collapsed {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin: 0;
|
||||
background: @color-mainmenu-collapsed;
|
||||
|
||||
> div {
|
||||
display: block;
|
||||
height: 100%;
|
||||
|
||||
.mainmenu-navbar-tiles();
|
||||
|
||||
ul.mainmenu-nav li:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 5px 0 15px 15px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
ul li {
|
||||
color: @color-mainmenu-inactive;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
position: relative;
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
ul li a {
|
||||
.mainmenu-item-link();
|
||||
|
||||
img.svg-icon {
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.vertical-scroll-marker(@color-mainmenu-inactive);
|
||||
}
|
||||
|
||||
body.mainmenu-open .mainmenu-collapsed ul {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 10px;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
html.mobile {
|
||||
.mainmenu-collapsed ul {
|
||||
overflow: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
|
||||
nav#layout-mainmenu.navbar ul li:hover,
|
||||
.mainmenu-collapsed li:hover {
|
||||
a {
|
||||
&:active, &:focus {
|
||||
color: @color-mainmenu-active !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.touch .mainmenu-collapsed li a:hover {
|
||||
color: @color-mainmenu-inactive;
|
||||
}
|
||||
|
||||
nav#layout-mainmenu.navbar ul li,
|
||||
.mainmenu-collapsed li {
|
||||
|
||||
// Used by account menu
|
||||
&.highlight > a {
|
||||
color: @color-mainmenu-active !important;
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: @color-mainmenu-active !important;
|
||||
|
||||
a {
|
||||
color: @color-mainmenu-active !important;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: @color-mainmenu-active;
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
body.drag {
|
||||
nav#layout-mainmenu.navbar ul.nav li,
|
||||
.mainmenu-collapsed ul li {
|
||||
&:hover {
|
||||
color: @color-mainmenu-inactive;
|
||||
}
|
||||
}
|
||||
}
|
||||
147
modules/backend/assets/less/layout/outerlayout.less
Normal file
@@ -0,0 +1,147 @@
|
||||
|
||||
// Layout for "Outside" pages, such as the Login screen
|
||||
//
|
||||
|
||||
body.outer {
|
||||
background: @color-outer-bg;
|
||||
|
||||
.layout {
|
||||
> .layout-row {
|
||||
&.layout-head {
|
||||
text-align: center;
|
||||
background: @color-outer-header;
|
||||
|
||||
> .layout-cell {
|
||||
height: 40%;
|
||||
padding: 50px 0;
|
||||
.box-sizing(border-box);
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
|
||||
&:after {
|
||||
.triangle(down, 56px, 20px, @color-outer-header);
|
||||
position: absolute;
|
||||
bottom: -20px;
|
||||
left: 50%;
|
||||
margin-left: -28px;
|
||||
}
|
||||
|
||||
h1.wn-logo,
|
||||
h1.oc-logo {
|
||||
.hide-text();
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
max-width: 450px;
|
||||
height: 170px;
|
||||
min-height: 72px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> .layout-cell {
|
||||
vertical-align: top;
|
||||
|
||||
.outer-form-container {
|
||||
margin: 0 auto;
|
||||
width: 436px;
|
||||
padding: (@padding-standard * 2) 0;
|
||||
|
||||
h2 {
|
||||
font-size: 18px;
|
||||
margin: 20px 0;
|
||||
color: @color-outer-heading;
|
||||
}
|
||||
|
||||
.horizontal-form {
|
||||
font-size: 0;
|
||||
.flex-display();
|
||||
|
||||
input {
|
||||
vertical-align: top;
|
||||
margin-right: 9px;
|
||||
display: inline-block;
|
||||
border: none;
|
||||
.border-radius(2px);
|
||||
}
|
||||
|
||||
button {
|
||||
background: @link-color;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
height: 40px;
|
||||
vertical-align: top;
|
||||
.box-sizing(border-box);
|
||||
}
|
||||
}
|
||||
|
||||
.remember {
|
||||
label {
|
||||
color: @color-outer-muted-text;
|
||||
}
|
||||
input#remember {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.forgot-password {
|
||||
margin-top: 30px;
|
||||
font-size: 13px;
|
||||
top: 8px;
|
||||
|
||||
a {
|
||||
color: @color-outer-muted-text;
|
||||
}
|
||||
|
||||
&:before {
|
||||
color: @color-outer-muted-text;
|
||||
font-size: 14px;
|
||||
position: relative;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
html.csstransitions {
|
||||
body.outer {
|
||||
.outer-form-container {
|
||||
.transition(all 0.5s ease-out);
|
||||
.scaleAxes(1, 1);
|
||||
}
|
||||
|
||||
&.preload {
|
||||
.outer-form-container {
|
||||
.scaleAxes(0.2, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: @screen-sm) {
|
||||
body.outer .layout > .layout-row {
|
||||
&.layout-head {
|
||||
> .layout-cell {
|
||||
padding: 50px @padding-standard;
|
||||
}
|
||||
}
|
||||
|
||||
> .layout-cell .outer-form-container {
|
||||
width: auto;
|
||||
padding: @padding-standard * 2;
|
||||
|
||||
.horizontal-form {
|
||||
display: block;
|
||||
|
||||
input {
|
||||
display: block;
|
||||
width: 100% !important;
|
||||
margin-bottom: @padding-standard;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
116
modules/backend/assets/less/layout/sidenav.less
Normal file
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// Side navigation bar
|
||||
// --------------------------------------------------
|
||||
|
||||
.layout-sidenav-container {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
#layout-sidenav {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
.box-sizing(border-box);
|
||||
font-size: @font-size-base;
|
||||
|
||||
ul {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
|
||||
li {
|
||||
display: block;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
|
||||
a {
|
||||
padding: 1.429em .714em;
|
||||
display: block;
|
||||
font-size: .929em;
|
||||
color: @color-sidebarnav-inactive-text;
|
||||
font-weight: normal;
|
||||
position: relative;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
i {
|
||||
color: @color-sidebarnav-inactive-icon;
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
font-size: 2em;
|
||||
}
|
||||
}
|
||||
|
||||
&:first-child a {
|
||||
padding-top: 2.143em;
|
||||
}
|
||||
|
||||
&.active a, a:hover {
|
||||
color: @color-sidebarnav-active-text;
|
||||
i { color: @color-sidebarnav-active-icon; }
|
||||
}
|
||||
|
||||
span.counter {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 1.071em;
|
||||
right: 1.071em;
|
||||
padding: .143em .429em .214em .286em;
|
||||
background-color: @color-sidebarnav-counter-bg;
|
||||
color: @color-sidebarnav-counter-text;
|
||||
font-size: .786em;
|
||||
line-height: 100%;
|
||||
.border-radius(3px);
|
||||
.opacity(1);
|
||||
.scale(1);
|
||||
.transition(all 0.3s);
|
||||
|
||||
&.empty {
|
||||
.opacity(0);
|
||||
.scale(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) {
|
||||
#layout-sidenav {
|
||||
font-size: 12px;
|
||||
}
|
||||
.layout-sidenav-container {
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: @screen-xs-max) {
|
||||
#layout-sidenav {
|
||||
font-size: 10px;
|
||||
}
|
||||
.layout-sidenav-container {
|
||||
width: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
html.mobile {
|
||||
#layout-sidenav ul {
|
||||
overflow: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
}
|
||||
|
||||
#layout-sidenav.layout-sidenav ul.drag li:not(.active) a:hover,
|
||||
.touch #layout-sidenav.layout-sidenav li:not(.active) a:hover {
|
||||
color: @color-sidebarnav-inactive-text !important;
|
||||
i { color: @color-sidebarnav-inactive-icon !important; }
|
||||
&:after { display: none !important; }
|
||||
}
|
||||
97
modules/backend/assets/less/layout/sidepanel.less
Normal file
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// Side panel
|
||||
// --------------------------------------------------
|
||||
|
||||
#layout-side-panel {
|
||||
.fix-button {
|
||||
position: absolute;
|
||||
right: -25px;
|
||||
top: 0;
|
||||
display: none;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
font-size: 13px;
|
||||
background: #ecf0f1;
|
||||
z-index: 120;
|
||||
.opacity(0.5);
|
||||
.border-radius(~'0 4px 4px 0');
|
||||
|
||||
i {
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-top: 5px;
|
||||
color: @color-scrollpanel-fix-button;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
.opacity(1)!important;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.fix-button {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.fix-button-content-header .fix-button {
|
||||
top: 46px;
|
||||
}
|
||||
|
||||
.sidepanel-content-header {
|
||||
background: @brand-secondary-darker;
|
||||
color: white;
|
||||
font-size: 15px;
|
||||
padding: 12px 20px 13px;
|
||||
position: relative;
|
||||
|
||||
&:after {
|
||||
.triangle(down, 15px, 8px, @brand-secondary-darker);
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
bottom: -8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
body.side-panel-not-fixed {
|
||||
#layout-side-panel {
|
||||
display: none;
|
||||
|
||||
.fix-button {
|
||||
.opacity(0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
body.display-side-panel {
|
||||
#layout-side-panel {
|
||||
display: block;
|
||||
position: absolute;
|
||||
// This needs to be higher than the dropdown overlay, otherwise the
|
||||
// mouseout event fires and sidebar hides when opening a dropdown.
|
||||
z-index: @zindex-dropdown;
|
||||
width: 350px;
|
||||
.box-shadow(3px 0px 3px 0 rgba(0, 0, 0, 0.1));
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: @screen-md-min) {
|
||||
body.side-panel-fix-shadow {
|
||||
#layout-side-panel {
|
||||
.box-shadow(none);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.touch #layout-side-panel .fix-button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: @screen-sm) {
|
||||
#layout-side-panel .fix-button {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
56
modules/backend/assets/less/winter.less
Normal file
@@ -0,0 +1,56 @@
|
||||
// Vendor
|
||||
@import "../vendor/sweet-alert/sweet-alert.less";
|
||||
@import "../vendor/jcrop/css/jquery.Jcrop.min.css";
|
||||
@import "../../../system/assets/vendor/prettify/prettify.css";
|
||||
@import "../../../system/assets/vendor/prettify/theme-desert.css";
|
||||
|
||||
//
|
||||
// Winter Controls
|
||||
//
|
||||
|
||||
@import "core/boot.less";
|
||||
@import "controls/alert.less";
|
||||
@import "controls/global-notice.less";
|
||||
@import "controls/simplelist.less";
|
||||
@import "controls/scrollbar.less";
|
||||
@import "controls/filelist.less";
|
||||
@import "controls/common.less";
|
||||
@import "controls/reportwidgets.less";
|
||||
@import "controls/treelist.less";
|
||||
@import "controls/treeview.less";
|
||||
@import "controls/sidenav-tree.less";
|
||||
@import "controls/panels.less";
|
||||
@import "controls/selector-group.less";
|
||||
@import "controls/tree-path.less";
|
||||
@import "controls/namevaluelist.less";
|
||||
@import "controls/scrollpad.less";
|
||||
@import "controls/svg-icons.less";
|
||||
@import "controls/record-navigation.less";
|
||||
|
||||
//
|
||||
// Winter Storm UI
|
||||
//
|
||||
|
||||
@import "../../../system/assets/ui/less/global.less";
|
||||
|
||||
//
|
||||
// Combines layout and vendor styles
|
||||
//
|
||||
|
||||
// Core (shared elements)
|
||||
@import "core/animations.less";
|
||||
|
||||
// Boot variables and mixins
|
||||
@import "core/variables.less";
|
||||
@import "core/mixins.less";
|
||||
|
||||
// Layout
|
||||
@import "layout/layout.less";
|
||||
@import "layout/flexlayout.less";
|
||||
@import "layout/mainmenu.less";
|
||||
@import "layout/sidenav.less";
|
||||
@import "layout/sidepanel.less";
|
||||
@import "layout/footer.less";
|
||||
@import "layout/outerlayout.less";
|
||||
@import "layout/fancylayout.less";
|
||||
@import "layout/flyout.less";
|
||||
130
modules/backend/assets/ui/js/ajax/Handler.js
Normal file
@@ -0,0 +1,130 @@
|
||||
import { delegate } from 'jquery-events-to-dom-events';
|
||||
|
||||
/**
|
||||
* Backend AJAX handler.
|
||||
*
|
||||
* This is a utility script that resolves some backwards-compatibility issues with the functionality
|
||||
* that relies on the old framework, and ensures that Snowboard works well within the Backend
|
||||
* environment.
|
||||
*
|
||||
* Functions:
|
||||
* - Adds the "render" jQuery event to Snowboard requests that widgets use to initialise.
|
||||
* - Ensures the CSRF token is included in requests.
|
||||
*
|
||||
* @copyright 2021 Winter.
|
||||
* @author Ben Thomson <git@alfreido.com>
|
||||
*/
|
||||
export default class Handler extends Snowboard.Singleton {
|
||||
/**
|
||||
* Event listeners.
|
||||
*
|
||||
* @returns {Object}
|
||||
*/
|
||||
listens() {
|
||||
return {
|
||||
ready: 'ready',
|
||||
ajaxFetchOptions: 'ajaxFetchOptions',
|
||||
ajaxUpdateComplete: 'ajaxUpdateComplete',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Ready handler.
|
||||
*
|
||||
* Fires off a "render" event.
|
||||
*/
|
||||
ready() {
|
||||
if (!window.jQuery) {
|
||||
return;
|
||||
}
|
||||
delegate('render');
|
||||
|
||||
// Add global event for rendering in Snowboard
|
||||
delegate('render');
|
||||
document.addEventListener('$render', () => {
|
||||
this.snowboard.globalEvent('render');
|
||||
});
|
||||
|
||||
// Add "render" event for backwards compatibility
|
||||
window.jQuery(document).trigger('render');
|
||||
|
||||
// Add global event for rendering in Snowboard
|
||||
document.addEventListener('$render', () => {
|
||||
this.snowboard.globalEvent('render');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the jQuery AJAX prefilter that the old framework uses to inject the CSRF token in AJAX
|
||||
* calls.
|
||||
*/
|
||||
addPrefilter() {
|
||||
if (!window.jQuery) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.jQuery.ajaxPrefilter((options) => {
|
||||
if (this.hasToken()) {
|
||||
if (!options.headers) {
|
||||
options.headers = {};
|
||||
}
|
||||
options.headers['X-CSRF-TOKEN'] = this.getToken();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch options handler.
|
||||
*
|
||||
* Ensures that the CSRF token is included in Snowboard requests.
|
||||
*
|
||||
* @param {Object} options
|
||||
*/
|
||||
ajaxFetchOptions(options) {
|
||||
if (this.hasToken()) {
|
||||
options.headers['X-CSRF-TOKEN'] = this.getToken();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update complete handler.
|
||||
*
|
||||
* Fires off a "render" event when partials are updated so that any widgets included in
|
||||
* responses are correctly initialised.
|
||||
*/
|
||||
ajaxUpdateComplete() {
|
||||
if (!window.jQuery) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add "render" event for backwards compatibility
|
||||
window.jQuery(document).trigger('render');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a CSRF token is available.
|
||||
*
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
hasToken() {
|
||||
const tokenElement = document.querySelector('meta[name="csrf-token"]');
|
||||
|
||||
if (!tokenElement) {
|
||||
return false;
|
||||
}
|
||||
if (!tokenElement.hasAttribute('content')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the CSRF token.
|
||||
*
|
||||
* @returns {String}
|
||||
*/
|
||||
getToken() {
|
||||
return document.querySelector('meta[name="csrf-token"]').getAttribute('content');
|
||||
}
|
||||
}
|
||||
1
modules/backend/assets/ui/js/build/backend.js
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";(self.webpackChunk_wintercms_wn_backend_module=self.webpackChunk_wintercms_wn_backend_module||[]).push([[476],{286:function(e,t,n){var i=n(35),r=n(171);class s extends Snowboard.Singleton{listens(){return{ready:"ready",ajaxFetchOptions:"ajaxFetchOptions",ajaxUpdateComplete:"ajaxUpdateComplete"}}ready(){window.jQuery&&((0,r.M)("render"),(0,r.M)("render"),document.addEventListener("$render",()=>{this.snowboard.globalEvent("render")}),window.jQuery(document).trigger("render"),document.addEventListener("$render",()=>{this.snowboard.globalEvent("render")}))}addPrefilter(){window.jQuery&&window.jQuery.ajaxPrefilter(e=>{this.hasToken()&&(e.headers||(e.headers={}),e.headers["X-CSRF-TOKEN"]=this.getToken())})}ajaxFetchOptions(e){this.hasToken()&&(e.headers["X-CSRF-TOKEN"]=this.getToken())}ajaxUpdateComplete(){window.jQuery&&window.jQuery(document).trigger("render")}hasToken(){const e=document.querySelector('meta[name="csrf-token"]');return!!e&&!!e.hasAttribute("content")}getToken(){return document.querySelector('meta[name="csrf-token"]').getAttribute("content")}}class a extends Snowboard.PluginBase{construct(e,t){if(e instanceof Snowboard.PluginBase==!1)throw new Error("Event handling can only be applied to Snowboard classes.");if(!t)throw new Error("Event prefix is required.");this.instance=e,this.eventPrefix=t,this.events=[]}on(e,t){this.events.push({event:e,callback:t})}off(e,t){this.events=this.events.filter(n=>n.event!==e||n.callback!==t)}once(e,t){const n=this.events.push({event:e,callback:(...e)=>{t(...e),this.events.splice(n-1,1)}})}fire(e,...t){const n=this.events.filter(t=>t.event===e);let i=!1;n.forEach(e=>{i||!1===e.callback(...t)&&(i=!0)}),i||this.snowboard.globalEvent(`${this.eventPrefix}.${e}`,...t)}firePromise(e,...t){const n=this.events.filter(t=>t.event===e),i=n.filter(e=>null!==e,n.map(e=>e.callback(...t)));Promise.all(i).then(()=>{this.snowboard.globalPromiseEvent(`${this.eventPrefix}.${e}`,...t)})}}class o extends Snowboard.Singleton{construct(){this.registeredWidgets=[],this.elements=[],this.events={mutate:e=>this.onMutation(e)},this.observer=null}listens(){return{ready:"onReady",render:"onRender",ajaxUpdate:"onAjaxUpdate"}}register(e,t,n){this.registeredWidgets.push({control:e,widget:t,callback:n})}unregister(e){this.registeredWidgets=this.registeredWidgets.filter(t=>t.control!==e)}onReady(){this.initializeWidgets(document.body),this.observer||(this.observer=new MutationObserver(this.events.mutate),this.observer.observe(document.body,{childList:!0,subtree:!0}))}onRender(){this.initializeWidgets(document.body)}onAjaxUpdate(e){this.initializeWidgets(e)}initializeWidgets(e){this.registeredWidgets.forEach(t=>{const n=e.querySelectorAll(`[data-control="${t.control}"]:not([data-widget-initialized])`);n.length&&n.forEach(e=>{if(e.dataset.widgetInitialized)return;const n=this.snowboard[t.widget](e);this.elements.push({element:e,instance:n}),e.dataset.widgetInitialized=!0,this.snowboard.globalEvent("backend.widget.initialized",e,n),"function"==typeof t.callback&&t.callback(n,e)})})}getWidget(e){const t=this.elements.find(t=>t.element===e);return t?t.instance:null}onMutation(e){const t=e.filter(e=>e.removedNodes.length).map(e=>Array.from(e.removedNodes)).flat();t.length&&t.forEach(e=>{const t=this.elements.filter(t=>e.contains(t.element));t.length&&t.forEach(e=>{e.instance.destruct(),this.elements=this.elements.filter(t=>t!==e)})})}}if(void 0===window.Snowboard)throw new Error("Snowboard must be loaded in order to use the Backend UI.");(e=>{e.addPlugin("backend.ajax.handler",s),e.addPlugin("backend.ui.eventHandler",a),e.addPlugin("backend.ui.widgetHandler",o),e["backend.ajax.handler"]().addPrefilter(),window.AssetManager={load:(t,n)=>{e.assetLoader().load(t).then(()=>{n&&"function"==typeof n&&n()})}},window.assetManager=window.AssetManager})(window.Snowboard),window.Vue=i}},function(e){e.O(0,[810],function(){return t=286,e(e.s=t);var t});e.O()}]);
|
||||
1
modules/backend/assets/ui/js/build/manifest.js
Normal file
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var n,e={},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={id:n,exports:{}};return e[n](i,i.exports,t),i.exports}t.m=e,n=[],t.O=function(e,r,o,i){if(!r){var u=1/0;for(l=0;l<n.length;l++){r=n[l][0],o=n[l][1],i=n[l][2];for(var f=!0,c=0;c<r.length;c++)(!1&i||u>=i)&&Object.keys(t.O).every(function(n){return t.O[n](r[c])})?r.splice(c--,1):(f=!1,i<u&&(u=i));if(f){n.splice(l--,1);var a=o();void 0!==a&&(e=a)}}return e}i=i||0;for(var l=n.length;l>0&&n[l-1][2]>i;l--)n[l]=n[l-1];n[l]=[r,o,i]},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,{a:e}),e},t.d=function(n,e){for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},function(){var n={624:0};t.O.j=function(e){return 0===n[e]};var e=function(e,r){var o,i,u=r[0],f=r[1],c=r[2],a=0;if(u.some(function(e){return 0!==n[e]})){for(o in f)t.o(f,o)&&(t.m[o]=f[o]);if(c)var l=c(t)}for(e&&e(r);a<u.length;a++)i=u[a],t.o(n,i)&&n[i]&&n[i][0](),n[i]=0;return t.O(l)},r=self.webpackChunk_wintercms_wn_backend_module=self.webpackChunk_wintercms_wn_backend_module||[];r.forEach(e.bind(null,0)),r.push=e.bind(null,r.push.bind(r))}(),t.nc=void 0}();
|
||||
24
modules/backend/assets/ui/js/build/vendor.js
Normal file
34
modules/backend/assets/ui/js/index.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import * as Vue from 'vue';
|
||||
import BackendAjaxHandler from './ajax/Handler';
|
||||
import BackendUiEventHandler from './ui/EventHandler';
|
||||
import BackendUiWidgetHandler from './ui/WidgetHandler';
|
||||
|
||||
if (window.Snowboard === undefined) {
|
||||
throw new Error('Snowboard must be loaded in order to use the Backend UI.');
|
||||
}
|
||||
|
||||
((Snowboard) => {
|
||||
Snowboard.addPlugin('backend.ajax.handler', BackendAjaxHandler);
|
||||
Snowboard.addPlugin('backend.ui.eventHandler', BackendUiEventHandler);
|
||||
Snowboard.addPlugin('backend.ui.widgetHandler', BackendUiWidgetHandler);
|
||||
|
||||
// Add the pre-filter immediately
|
||||
Snowboard['backend.ajax.handler']().addPrefilter();
|
||||
|
||||
// Add polyfill for AssetManager
|
||||
window.AssetManager = {
|
||||
load: (assets, callback) => {
|
||||
Snowboard.assetLoader().load(assets).then(
|
||||
() => {
|
||||
if (callback && typeof callback === 'function') {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
};
|
||||
window.assetManager = window.AssetManager;
|
||||
})(window.Snowboard);
|
||||
|
||||
// Add Vue to global scope
|
||||
window.Vue = Vue;
|
||||
100
modules/backend/assets/ui/js/pages/Preferences.js
Normal file
@@ -0,0 +1,100 @@
|
||||
import { delegate } from 'jquery-events-to-dom-events';
|
||||
|
||||
((Snowboard) => {
|
||||
class Preferences extends Snowboard.Singleton {
|
||||
construct() {
|
||||
this.widget = null;
|
||||
}
|
||||
|
||||
listens() {
|
||||
return {
|
||||
'backend.widget.initialized': 'onWidgetInitialized',
|
||||
};
|
||||
}
|
||||
|
||||
onWidgetInitialized(element, widget) {
|
||||
if (element === document.getElementById('CodeEditor-formEditorPreview-_editor_preview')) {
|
||||
this.widget = widget;
|
||||
this.enablePreferences();
|
||||
}
|
||||
}
|
||||
|
||||
enablePreferences() {
|
||||
delegate('change');
|
||||
|
||||
const checkboxes = {
|
||||
show_gutter: 'showGutter',
|
||||
highlight_active_line: 'highlightActiveLine',
|
||||
use_hard_tabs: '!useSoftTabs',
|
||||
display_indent_guides: 'displayIndentGuides',
|
||||
show_invisibles: 'showInvisibles',
|
||||
show_print_margin: 'showPrintMargin',
|
||||
show_minimap: 'showMinimap',
|
||||
enable_folding: 'codeFolding',
|
||||
bracket_colors: 'bracketColors',
|
||||
show_colors: 'showColors',
|
||||
};
|
||||
|
||||
Object.entries(checkboxes).forEach(([key, value]) => {
|
||||
this.element(key).addEventListener('change', (event) => {
|
||||
this.widget.setConfig(
|
||||
value.replace(/^!/, ''),
|
||||
/^!/.test(value) ? !event.target.checked : event.target.checked,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
this.element('theme').addEventListener('$change', (event) => {
|
||||
this.widget.loadTheme(event.target.value);
|
||||
});
|
||||
|
||||
this.element('font_size').addEventListener('$change', (event) => {
|
||||
this.widget.setConfig('fontSize', event.target.value);
|
||||
});
|
||||
|
||||
this.element('tab_size').addEventListener('$change', (event) => {
|
||||
this.widget.setConfig('tabSize', event.target.value);
|
||||
});
|
||||
|
||||
this.element('word_wrap').addEventListener('$change', (event) => {
|
||||
const { value } = event.target;
|
||||
switch (value) {
|
||||
case 'off':
|
||||
this.widget.setConfig('wordWrap', false);
|
||||
break;
|
||||
case 'fluid':
|
||||
this.widget.setConfig('wordWrap', 'fluid');
|
||||
break;
|
||||
default:
|
||||
this.widget.setConfig('wordWrap', parseInt(value, 10));
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelectorAll('[data-switch-lang]').forEach((element) => {
|
||||
element.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
const language = element.dataset.switchLang;
|
||||
const template = document.querySelector(`[data-lang-snippet="${language}"]`);
|
||||
|
||||
if (!template) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.widget.setValue(template.textContent.trim());
|
||||
this.widget.setLanguage(language);
|
||||
});
|
||||
});
|
||||
|
||||
this.widget.events.once('create', () => {
|
||||
const event = new MouseEvent('click');
|
||||
document.querySelector('[data-switch-lang="css"]').dispatchEvent(event);
|
||||
});
|
||||
}
|
||||
|
||||
element(key) {
|
||||
return document.getElementById(`Form-field-Preference-editor_${key}`);
|
||||
}
|
||||
}
|
||||
|
||||
Snowboard.addPlugin('backend.preferences', Preferences);
|
||||
})(window.Snowboard);
|
||||
116
modules/backend/assets/ui/js/ui/EventHandler.js
Normal file
@@ -0,0 +1,116 @@
|
||||
/**
|
||||
* Widget event handler.
|
||||
*
|
||||
* Extends a widget with event handling functionality, allowing for the quick definition of events
|
||||
* and listening for events on a specific instance of a widget.
|
||||
*
|
||||
* This is a complement to Snowboard's global events - these events will still fire in order to
|
||||
* allow external code to listen and handle events. Local events can cancel the global event (and
|
||||
* further local events) by returning `false` from the callback.
|
||||
*
|
||||
* @copyright 2022 Winter.
|
||||
* @author Ben Thomson <git@alfreido.com>
|
||||
*/
|
||||
export default class EventHandler extends Snowboard.PluginBase {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param {PluginBase} instance
|
||||
* @param {String} eventPrefix
|
||||
*/
|
||||
construct(instance, eventPrefix) {
|
||||
if (instance instanceof Snowboard.PluginBase === false) {
|
||||
throw new Error('Event handling can only be applied to Snowboard classes.');
|
||||
}
|
||||
if (!eventPrefix) {
|
||||
throw new Error('Event prefix is required.');
|
||||
}
|
||||
this.instance = instance;
|
||||
this.eventPrefix = eventPrefix;
|
||||
this.events = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a listener for a widget's event.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} callback
|
||||
*/
|
||||
on(event, callback) {
|
||||
this.events.push({
|
||||
event,
|
||||
callback,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deregisters a listener for a widget's event.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} callback
|
||||
*/
|
||||
off(event, callback) {
|
||||
this.events = this.events.filter((registeredEvent) => registeredEvent.event !== event || registeredEvent.callback !== callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a listener for a widget's event that will only fire once.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} callback
|
||||
*/
|
||||
once(event, callback) {
|
||||
const length = this.events.push({
|
||||
event,
|
||||
callback: (...parameters) => {
|
||||
callback(...parameters);
|
||||
this.events.splice(length - 1, 1);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires an event on the widget.
|
||||
*
|
||||
* Local events are fired first, then a global event is fired afterwards.
|
||||
*
|
||||
* @param {String} eventName
|
||||
* @param {...any} parameters
|
||||
*/
|
||||
fire(eventName, ...parameters) {
|
||||
// Fire local events first
|
||||
const events = this.events.filter((registeredEvent) => registeredEvent.event === eventName);
|
||||
let cancelled = false;
|
||||
events.forEach((event) => {
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
if (event.callback(...parameters) === false) {
|
||||
cancelled = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!cancelled) {
|
||||
this.snowboard.globalEvent(`${this.eventPrefix}.${eventName}`, ...parameters);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires a promise event on the widget.
|
||||
*
|
||||
* Local events are fired first, then a global event is fired afterwards.
|
||||
*
|
||||
* @param {String} eventName
|
||||
* @param {...any} parameters
|
||||
*/
|
||||
firePromise(eventName, ...parameters) {
|
||||
const events = this.events.filter((registeredEvent) => registeredEvent.event === eventName);
|
||||
const promises = events.filter((event) => event !== null, events.map((event) => event.callback(...parameters)));
|
||||
|
||||
Promise.all(promises).then(
|
||||
() => {
|
||||
this.snowboard.globalPromiseEvent(`${this.eventPrefix}.${eventName}`, ...parameters);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
181
modules/backend/assets/ui/js/ui/WidgetHandler.js
Normal file
@@ -0,0 +1,181 @@
|
||||
/**
|
||||
* Backend widget handler.
|
||||
*
|
||||
* Handles the creation and disposal of widgets in the Backend. Widgets should include this as
|
||||
* a dependency in order to be loaded and initialised after the handler, in order to correctly
|
||||
* register.
|
||||
*
|
||||
* @copyright 2022 Winter.
|
||||
* @author Ben Thomson <git@alfreido.com>
|
||||
*/
|
||||
export default class WidgetHandler extends Snowboard.Singleton {
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
construct() {
|
||||
this.registeredWidgets = [];
|
||||
this.elements = [];
|
||||
this.events = {
|
||||
mutate: (mutations) => this.onMutation(mutations),
|
||||
};
|
||||
this.observer = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listeners.
|
||||
*
|
||||
* @returns {Object}
|
||||
*/
|
||||
listens() {
|
||||
return {
|
||||
ready: 'onReady',
|
||||
render: 'onRender',
|
||||
ajaxUpdate: 'onAjaxUpdate',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a widget as a given data control.
|
||||
*
|
||||
* Registering a widget will allow any element that contains a "data-control" attribute matching
|
||||
* the control name to be initialized with the given widget.
|
||||
*
|
||||
* You may optionally provide a callback that will be fired when an instance of the widget is
|
||||
* initialized - the callback will be provided the element and the widget instance as parameters.
|
||||
*
|
||||
* @param {String} control
|
||||
* @param {Snowboard.PluginBase} widget
|
||||
* @param {Function} callback
|
||||
*/
|
||||
register(control, widget, callback) {
|
||||
this.registeredWidgets.push({
|
||||
control,
|
||||
widget,
|
||||
callback,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a data control.
|
||||
*
|
||||
* @param {String} control
|
||||
*/
|
||||
unregister(control) {
|
||||
this.registeredWidgets = this.registeredWidgets.filter((widget) => widget.control !== control);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ready handler.
|
||||
*
|
||||
* Initializes widgets within the entire document.
|
||||
*/
|
||||
onReady() {
|
||||
this.initializeWidgets(document.body);
|
||||
|
||||
// Register a DOM observer and watch for any removed nodes
|
||||
if (!this.observer) {
|
||||
this.observer = new MutationObserver(this.events.mutate);
|
||||
this.observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render handler.
|
||||
*
|
||||
* Initializes widgets within the entire document.
|
||||
*/
|
||||
onRender() {
|
||||
this.initializeWidgets(document.body);
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX update handler.
|
||||
*
|
||||
* Initializes widgets inside an update element from an AJAX response.
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
*/
|
||||
onAjaxUpdate(element) {
|
||||
this.initializeWidgets(element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes all widgets within an element.
|
||||
*
|
||||
* If an element contains a "data-control" attribute matching a registered widget, the widget
|
||||
* is initialized and attached to the element as a "widget" property.
|
||||
*
|
||||
* Only one widget may be initialized to a particular element.
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
*/
|
||||
initializeWidgets(element) {
|
||||
this.registeredWidgets.forEach((widget) => {
|
||||
const instances = element.querySelectorAll(`[data-control="${widget.control}"]:not([data-widget-initialized])`);
|
||||
|
||||
if (instances.length) {
|
||||
instances.forEach((instance) => {
|
||||
// Prevent double-widget initialization
|
||||
if (instance.dataset.widgetInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
const widgetInstance = this.snowboard[widget.widget](instance);
|
||||
this.elements.push({
|
||||
element: instance,
|
||||
instance: widgetInstance,
|
||||
});
|
||||
instance.dataset.widgetInitialized = true;
|
||||
this.snowboard.globalEvent('backend.widget.initialized', instance, widgetInstance);
|
||||
|
||||
if (typeof widget.callback === 'function') {
|
||||
widget.callback(widgetInstance, instance);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a widget that is attached to the given element, if any.
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @returns {Snowboard.PluginBase|null}
|
||||
*/
|
||||
getWidget(element) {
|
||||
const found = this.elements.find((widget) => widget.element === element);
|
||||
|
||||
if (found) {
|
||||
return found.instance;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for mutation events.
|
||||
*
|
||||
* We're only tracking removed nodes, to ensure that those widgets are disposed of.
|
||||
*
|
||||
* @param {MutationRecord[]} mutations
|
||||
*/
|
||||
onMutation(mutations) {
|
||||
const removedNodes = mutations.filter((mutation) => mutation.removedNodes.length).map((mutation) => Array.from(mutation.removedNodes)).flat();
|
||||
if (!removedNodes.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
removedNodes.forEach((node) => {
|
||||
const widgets = this.elements.filter((widget) => node.contains(widget.element));
|
||||
if (widgets.length) {
|
||||
widgets.forEach((widget) => {
|
||||
widget.instance.destruct();
|
||||
this.elements = this.elements.filter((element) => element !== widget);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
2314
modules/backend/assets/vendor/ace-codeeditor/build-min.js
vendored
Normal file
30
modules/backend/assets/vendor/ace-codeeditor/build.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This is a bundle file, you can compile this by running
|
||||
*
|
||||
* php artisan winter:util compile assets
|
||||
*
|
||||
* @see build-min.js
|
||||
*
|
||||
* Current Ace build v1.2.3 using "src-noconflict"
|
||||
* https://github.com/ajaxorg/ace-builds/
|
||||
*
|
||||
|
||||
=require ../emmet/emmet.js
|
||||
=require ../ace/ace.js
|
||||
=require ../ace/ext-emmet.js
|
||||
=require ../ace/ext-language_tools.js
|
||||
=require ../ace/mode-php.js
|
||||
=require ../ace/mode-twig.js
|
||||
=require ../ace/mode-markdown.js
|
||||
=require ../ace/mode-plain_text.js
|
||||
=require ../ace/mode-html.js
|
||||
=require ../ace/mode-less.js
|
||||
=require ../ace/mode-css.js
|
||||
=require ../ace/mode-scss.js
|
||||
=require ../ace/mode-sass.js
|
||||
=require ../ace/mode-yaml.js
|
||||
=require ../ace/mode-javascript.js
|
||||
|
||||
=require codeeditor.js
|
||||
|
||||
*/
|
||||
468
modules/backend/assets/vendor/ace-codeeditor/codeeditor.js
vendored
Normal file
@@ -0,0 +1,468 @@
|
||||
/*
|
||||
* Code editor form field control
|
||||
*
|
||||
* Data attributes:
|
||||
* - data-control="codeeditor" - enables the code editor plugin
|
||||
* - data-vendor-path="/" - sets the path to find Ace editor files
|
||||
* - data-language="php" - set the coding language used
|
||||
* - data-theme="textmate" - the colour scheme and theme
|
||||
*
|
||||
* JavaScript API:
|
||||
* $('textarea').codeEditor({ vendorPath: '/', language: 'php '})
|
||||
*
|
||||
* Dependancies:
|
||||
* - Ace Editor (ace.js)
|
||||
*/
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
var Base = $.wn.foundation.base,
|
||||
BaseProto = Base.prototype
|
||||
|
||||
// CODEEDITOR CLASS DEFINITION
|
||||
// ============================
|
||||
|
||||
var CodeEditor = function(element, options) {
|
||||
Base.call(this)
|
||||
|
||||
this.options = options
|
||||
this.$el = $(element)
|
||||
this.$textarea = this.$el.find('>textarea:first')
|
||||
this.$toolbar = this.$el.find('>.editor-toolbar:first')
|
||||
this.$code = null
|
||||
this.editor = null
|
||||
this.$form = null
|
||||
|
||||
// Toolbar links
|
||||
this.isFullscreen = false
|
||||
this.$fullscreenEnable = this.$toolbar.find('li.fullscreen-enable')
|
||||
this.$fullscreenDisable = this.$toolbar.find('li.fullscreen-disable')
|
||||
this.isSearchbox = false
|
||||
this.$searchboxEnable = this.$toolbar.find('li.searchbox-enable')
|
||||
this.$searchboxDisable = this.$toolbar.find('li.searchbox-disable')
|
||||
this.isReplacebox = false
|
||||
this.$replaceboxEnable = this.$toolbar.find('li.replacebox-enable')
|
||||
this.$replaceboxDisable = this.$toolbar.find('li.replacebox-disable')
|
||||
|
||||
$.wn.foundation.controlUtils.markDisposable(element)
|
||||
|
||||
this.init();
|
||||
|
||||
this.$el.trigger('oc.codeEditorReady')
|
||||
}
|
||||
|
||||
CodeEditor.prototype = Object.create(BaseProto)
|
||||
CodeEditor.prototype.constructor = CodeEditor
|
||||
|
||||
CodeEditor.DEFAULTS = {
|
||||
fontSize: 12,
|
||||
wordWrap: 'off',
|
||||
codeFolding: 'manual',
|
||||
autocompletion: 'manual',
|
||||
tabSize: 4,
|
||||
theme: 'textmate',
|
||||
showInvisibles: true,
|
||||
highlightActiveLine: true,
|
||||
useSoftTabs: true,
|
||||
autoCloseTags: true,
|
||||
showGutter: true,
|
||||
enableEmmet: true,
|
||||
language: 'php',
|
||||
margin: 0,
|
||||
vendorPath: '/',
|
||||
showPrintMargin: false,
|
||||
highlightSelectedWord: false,
|
||||
hScrollBarAlwaysVisible: false,
|
||||
scrollPastEnd: 0,
|
||||
readOnly: false
|
||||
}
|
||||
|
||||
CodeEditor.prototype.init = function (){
|
||||
|
||||
var self = this;
|
||||
|
||||
/*
|
||||
* Control must have an identifier
|
||||
*/
|
||||
if (!this.$el.attr('id')) {
|
||||
this.$el.attr('id', 'element-' + Math.random().toString(36).substring(7))
|
||||
}
|
||||
|
||||
/*
|
||||
* Create code container
|
||||
*/
|
||||
this.$code = $('<div />')
|
||||
.addClass('editor-code')
|
||||
.attr('id', this.$el.attr('id') + '-code')
|
||||
.css({
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0
|
||||
})
|
||||
.appendTo(this.$el)
|
||||
|
||||
/*
|
||||
* Initialize ACE editor
|
||||
*/
|
||||
var editor = this.editor = ace.edit(this.$code.attr('id')),
|
||||
options = this.options,
|
||||
$form = this.$el.closest('form');
|
||||
|
||||
// Fixes a weird notice about scrolling
|
||||
editor.$blockScrolling = Infinity
|
||||
|
||||
this.$form = $form
|
||||
|
||||
this.$textarea.hide();
|
||||
editor.getSession().setValue(this.$textarea.val())
|
||||
|
||||
editor.on('change', this.proxy(this.onChange))
|
||||
$form.on('oc.beforeRequest', this.proxy(this.onBeforeRequest))
|
||||
$(window).on('resize', this.proxy(this.onResize))
|
||||
$(window).on('oc.updateUi', this.proxy(this.onResize))
|
||||
this.$el.one('dispose-control', this.proxy(this.dispose))
|
||||
|
||||
/*
|
||||
* Set theme, anticipated languages should be preloaded
|
||||
*/
|
||||
assetManager.load({
|
||||
js:[
|
||||
// options.vendorPath + '/mode-' + options.language + '.js',
|
||||
options.vendorPath + '/theme-' + options.theme + '.js'
|
||||
]
|
||||
}, function(){
|
||||
editor.setTheme('ace/theme/' + options.theme)
|
||||
var inline = options.language === 'php'
|
||||
editor.getSession().setMode({ path: 'ace/mode/'+options.language, inline: inline })
|
||||
})
|
||||
|
||||
/*
|
||||
* Config editor
|
||||
*/
|
||||
editor.wrapper = this
|
||||
editor.setShowInvisibles(options.showInvisibles)
|
||||
editor.setBehavioursEnabled(options.autoCloseTags)
|
||||
editor.setHighlightActiveLine(options.highlightActiveLine)
|
||||
editor.renderer.setShowGutter(options.showGutter)
|
||||
editor.renderer.setShowPrintMargin(options.showPrintMargin)
|
||||
editor.setHighlightSelectedWord(options.highlightSelectedWord)
|
||||
editor.renderer.setHScrollBarAlwaysVisible(options.hScrollBarAlwaysVisible)
|
||||
editor.setDisplayIndentGuides(options.displayIndentGuides)
|
||||
editor.getSession().setUseSoftTabs(options.useSoftTabs)
|
||||
editor.getSession().setTabSize(options.tabSize)
|
||||
editor.setReadOnly(options.readOnly)
|
||||
editor.getSession().setFoldStyle(options.codeFolding)
|
||||
editor.setFontSize(options.fontSize)
|
||||
editor.on('blur', this.proxy(this.onBlur))
|
||||
editor.on('focus', this.proxy(this.onFocus))
|
||||
editor.setOption("scrollPastEnd", options.scrollPastEnd)
|
||||
this.setWordWrap(options.wordWrap)
|
||||
|
||||
// Set the vendor path for Ace's require path
|
||||
ace.require('ace/config').set('basePath', this.options.vendorPath)
|
||||
|
||||
editor.setOptions({
|
||||
enableEmmet: options.enableEmmet,
|
||||
enableBasicAutocompletion: options.autocompletion === 'basic',
|
||||
enableSnippets: options.enableSnippets,
|
||||
enableLiveAutocompletion: options.autocompletion === 'live'
|
||||
})
|
||||
|
||||
editor.renderer.setScrollMargin(options.margin, options.margin, 0, 0)
|
||||
editor.renderer.setPadding(options.margin)
|
||||
|
||||
/*
|
||||
* Toolbar
|
||||
*/
|
||||
|
||||
this.$toolbar.find('>ul>li>a')
|
||||
.each(function(){
|
||||
var abbr = $(this).find('>abbr'),
|
||||
label = abbr.text(),
|
||||
help = abbr.attr('title'),
|
||||
title = label + ' (<strong>' + help + '</strong>)';
|
||||
|
||||
$(this).attr('title', title)
|
||||
})
|
||||
.tooltip({
|
||||
delay: 500,
|
||||
placement: 'top',
|
||||
html: true
|
||||
})
|
||||
;
|
||||
|
||||
this.$fullscreenDisable.hide()
|
||||
this.$fullscreenEnable.on('click.codeeditor', '>a', $.proxy(this.toggleFullscreen, this))
|
||||
this.$fullscreenDisable.on('click.codeeditor', '>a', $.proxy(this.toggleFullscreen, this))
|
||||
|
||||
this.$searchboxDisable.hide()
|
||||
this.$searchboxEnable.on('click.codeeditor', '>a', $.proxy(this.toggleSearchbox, this))
|
||||
this.$searchboxDisable.on('click.codeeditor', '>a', $.proxy(this.toggleSearchbox, this))
|
||||
|
||||
this.$replaceboxDisable.hide()
|
||||
this.$replaceboxEnable.on('click.codeeditor', '>a', $.proxy(this.toggleReplacebox, this))
|
||||
this.$replaceboxDisable.on('click.codeeditor', '>a', $.proxy(this.toggleReplacebox, this))
|
||||
|
||||
/*
|
||||
* Hotkeys
|
||||
*/
|
||||
this.$el.hotKey({
|
||||
hotkey: 'esc',
|
||||
callback: this.proxy(this.onEscape)
|
||||
})
|
||||
|
||||
editor.commands.addCommand({
|
||||
name: 'toggleFullscreen',
|
||||
bindKey: { win: 'Ctrl+Shift+F', mac: 'Ctrl+Shift+F' },
|
||||
exec: $.proxy(this.toggleFullscreen, this),
|
||||
readOnly: true
|
||||
})
|
||||
}
|
||||
|
||||
CodeEditor.prototype.dispose = function() {
|
||||
if (this.$el === null)
|
||||
return
|
||||
|
||||
this.unregisterHandlers()
|
||||
this.disposeAttachedControls()
|
||||
|
||||
this.$el = null
|
||||
this.$textarea = null
|
||||
this.$toolbar = null
|
||||
this.$code = null
|
||||
this.$fullscreenEnable = null
|
||||
this.$fullscreenDisable = null
|
||||
this.$searchboxEnable = null
|
||||
this.$searchboxDisable = null
|
||||
this.$replaceboxEnable = null
|
||||
this.$replaceboxDisable = null
|
||||
this.$form = null
|
||||
this.options = null
|
||||
|
||||
BaseProto.dispose.call(this)
|
||||
}
|
||||
|
||||
CodeEditor.prototype.disposeAttachedControls = function() {
|
||||
this.editor.destroy()
|
||||
|
||||
var keys = Object.keys(this.editor.renderer)
|
||||
for (var i=0, len=keys.length; i<len; i++)
|
||||
this.editor.renderer[keys[i]] = null
|
||||
|
||||
keys = Object.keys(this.editor)
|
||||
for (var i=0, len=keys.length; i<len; i++)
|
||||
this.editor[keys[i]] = null
|
||||
|
||||
this.editor = null
|
||||
|
||||
this.$toolbar.find('>ul>li>a').tooltip('destroy')
|
||||
this.$el.removeData('oc.codeEditor')
|
||||
this.$el.hotKey('dispose')
|
||||
}
|
||||
|
||||
CodeEditor.prototype.unregisterHandlers = function() {
|
||||
this.editor.off('change', this.proxy(this.onChange))
|
||||
this.editor.off('blur', this.proxy(this.onBlur))
|
||||
this.editor.off('focus', this.proxy(this.onFocus))
|
||||
|
||||
this.$fullscreenEnable.off('.codeeditor')
|
||||
this.$fullscreenDisable.off('.codeeditor')
|
||||
this.$form.off('oc.beforeRequest', this.proxy(this.onBeforeRequest))
|
||||
|
||||
this.$el.off('dispose-control', this.proxy(this.dispose))
|
||||
|
||||
$(window).off('resize', this.proxy(this.onResize))
|
||||
$(window).off('oc.updateUi', this.proxy(this.onResize))
|
||||
}
|
||||
|
||||
CodeEditor.prototype.onBeforeRequest = function() {
|
||||
this.$textarea.val(this.editor.getSession().getValue())
|
||||
}
|
||||
|
||||
CodeEditor.prototype.onChange = function() {
|
||||
this.$textarea.trigger('change')
|
||||
this.$textarea.trigger('oc.codeEditorChange')
|
||||
}
|
||||
|
||||
CodeEditor.prototype.onResize = function() {
|
||||
this.editor.resize()
|
||||
}
|
||||
|
||||
CodeEditor.prototype.onBlur = function() {
|
||||
this.$el.removeClass('editor-focus')
|
||||
}
|
||||
|
||||
CodeEditor.prototype.onFocus = function() {
|
||||
this.$el.addClass('editor-focus')
|
||||
}
|
||||
|
||||
CodeEditor.prototype.onEscape = function() {
|
||||
this.isFullscreen && this.toggleFullscreen()
|
||||
}
|
||||
|
||||
CodeEditor.prototype.setWordWrap = function(mode) {
|
||||
var session = this.editor.getSession(),
|
||||
renderer = this.editor.renderer
|
||||
|
||||
switch (mode + '') {
|
||||
default:
|
||||
case "off":
|
||||
session.setUseWrapMode(false)
|
||||
renderer.setPrintMarginColumn(80)
|
||||
break
|
||||
case "40":
|
||||
session.setUseWrapMode(true)
|
||||
session.setWrapLimitRange(40, 40)
|
||||
renderer.setPrintMarginColumn(40)
|
||||
break
|
||||
case "80":
|
||||
session.setUseWrapMode(true)
|
||||
session.setWrapLimitRange(80, 80)
|
||||
renderer.setPrintMarginColumn(80)
|
||||
break
|
||||
case "fluid":
|
||||
session.setUseWrapMode(true)
|
||||
session.setWrapLimitRange(null, null)
|
||||
renderer.setPrintMarginColumn(80)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
CodeEditor.prototype.setTheme = function(theme) {
|
||||
var self = this
|
||||
assetManager.load({
|
||||
js:[
|
||||
this.options.vendorPath + '/theme-' + theme + '.js'
|
||||
]
|
||||
}, function(){
|
||||
self.editor.setTheme('ace/theme/' + theme)
|
||||
})
|
||||
}
|
||||
|
||||
CodeEditor.prototype.getContent = function() {
|
||||
return this.editor.getSession().getValue()
|
||||
}
|
||||
|
||||
CodeEditor.prototype.setContent = function(html) {
|
||||
this.editor.getSession().setValue(html)
|
||||
}
|
||||
|
||||
CodeEditor.prototype.getEditorObject = function() {
|
||||
return this.editor
|
||||
}
|
||||
|
||||
CodeEditor.prototype.getToolbar = function() {
|
||||
return this.$toolbar
|
||||
}
|
||||
|
||||
CodeEditor.prototype.toggleFullscreen = function() {
|
||||
this.$el.toggleClass('editor-fullscreen')
|
||||
this.$fullscreenEnable.toggle()
|
||||
this.$fullscreenDisable.toggle()
|
||||
|
||||
this.isFullscreen = this.$el.hasClass('editor-fullscreen')
|
||||
|
||||
if (this.isFullscreen) {
|
||||
$('body').css({ overflow: 'hidden' })
|
||||
}
|
||||
else {
|
||||
$('body').css({ overflow: 'inherit' })
|
||||
}
|
||||
|
||||
this.editor.resize()
|
||||
this.editor.focus()
|
||||
}
|
||||
|
||||
CodeEditor.prototype.toggleSearchbox = function() {
|
||||
this.$searchboxEnable.toggle()
|
||||
this.$searchboxDisable.toggle()
|
||||
|
||||
this.editor.execCommand("find")
|
||||
|
||||
this.editor.resize()
|
||||
this.editor.focus()
|
||||
}
|
||||
|
||||
CodeEditor.prototype.toggleReplacebox = function() {
|
||||
this.$replaceboxEnable.toggle()
|
||||
this.$replaceboxDisable.toggle()
|
||||
|
||||
this.editor.execCommand("replace")
|
||||
|
||||
this.editor.resize()
|
||||
this.editor.focus()
|
||||
}
|
||||
|
||||
// CODEEDITOR PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.codeEditor
|
||||
|
||||
$.fn.codeEditor = function (option) {
|
||||
var args = Array.prototype.slice.call(arguments, 1), result
|
||||
this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.codeEditor')
|
||||
var options = $.extend({}, CodeEditor.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('oc.codeEditor', (data = new CodeEditor(this, options)))
|
||||
if (typeof option == 'string') result = data[option].apply(data, args)
|
||||
if (typeof result != 'undefined') return false
|
||||
})
|
||||
|
||||
return result ? result : this
|
||||
}
|
||||
|
||||
$.fn.codeEditor.Constructor = CodeEditor
|
||||
|
||||
if ($.wn === undefined)
|
||||
$.wn = {}
|
||||
if ($.oc === undefined)
|
||||
$.oc = $.wn
|
||||
|
||||
$.wn.codeEditorExtensionModes = {
|
||||
'htm': 'html',
|
||||
'html': 'html',
|
||||
'md': 'markdown',
|
||||
'txt': 'plain_text',
|
||||
'js': 'javascript',
|
||||
'less': 'less',
|
||||
'scss': 'scss',
|
||||
'sass': 'sass',
|
||||
'css': 'css'
|
||||
}
|
||||
|
||||
// CODEEDITOR NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.codeEditor.noConflict = function () {
|
||||
$.fn.codeEditor = old
|
||||
return this
|
||||
}
|
||||
|
||||
// CODEEDITOR DATA-API
|
||||
// ===============
|
||||
$(document).render(function () {
|
||||
$('[data-control="ace-codeeditor"]').codeEditor()
|
||||
});
|
||||
|
||||
// FIX EMMET HTML WHEN SYNTAX IS TWIG
|
||||
// ==================================
|
||||
|
||||
+function (exports) {
|
||||
if (exports.ace && typeof exports.ace.require == 'function') {
|
||||
var emmetExt = exports.ace.require('ace/ext/emmet')
|
||||
|
||||
if (emmetExt && emmetExt.AceEmmetEditor && emmetExt.AceEmmetEditor.prototype.getSyntax) {
|
||||
var coreGetSyntax = emmetExt.AceEmmetEditor.prototype.getSyntax
|
||||
|
||||
emmetExt.AceEmmetEditor.prototype.getSyntax = function () {
|
||||
var $syntax = $.proxy(coreGetSyntax, this)()
|
||||
return $syntax == 'twig' ? 'html' : $syntax
|
||||
};
|
||||
}
|
||||
}
|
||||
}(window)
|
||||
|
||||
}(window.jQuery);
|
||||
19069
modules/backend/assets/vendor/ace/ace.js
vendored
Executable file
1223
modules/backend/assets/vendor/ace/ext-emmet.js
vendored
Executable file
1946
modules/backend/assets/vendor/ace/ext-language_tools.js
vendored
Normal file
417
modules/backend/assets/vendor/ace/ext-searchbox.js
vendored
Executable file
@@ -0,0 +1,417 @@
|
||||
ace.define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var dom = require("../lib/dom");
|
||||
var lang = require("../lib/lang");
|
||||
var event = require("../lib/event");
|
||||
var searchboxCss = "\
|
||||
.ace_search {\
|
||||
background-color: #ddd;\
|
||||
border: 1px solid #cbcbcb;\
|
||||
border-top: 0 none;\
|
||||
max-width: 325px;\
|
||||
overflow: hidden;\
|
||||
margin: 0;\
|
||||
padding: 4px;\
|
||||
padding-right: 6px;\
|
||||
padding-bottom: 0;\
|
||||
position: absolute;\
|
||||
top: 0px;\
|
||||
z-index: 99;\
|
||||
white-space: normal;\
|
||||
}\
|
||||
.ace_search.left {\
|
||||
border-left: 0 none;\
|
||||
border-radius: 0px 0px 5px 0px;\
|
||||
left: 0;\
|
||||
}\
|
||||
.ace_search.right {\
|
||||
border-radius: 0px 0px 0px 5px;\
|
||||
border-right: 0 none;\
|
||||
right: 0;\
|
||||
}\
|
||||
.ace_search_form, .ace_replace_form {\
|
||||
border-radius: 3px;\
|
||||
border: 1px solid #cbcbcb;\
|
||||
float: left;\
|
||||
margin-bottom: 4px;\
|
||||
overflow: hidden;\
|
||||
}\
|
||||
.ace_search_form.ace_nomatch {\
|
||||
outline: 1px solid red;\
|
||||
}\
|
||||
.ace_search_field {\
|
||||
background-color: white;\
|
||||
color: black;\
|
||||
border-right: 1px solid #cbcbcb;\
|
||||
border: 0 none;\
|
||||
-webkit-box-sizing: border-box;\
|
||||
-moz-box-sizing: border-box;\
|
||||
box-sizing: border-box;\
|
||||
float: left;\
|
||||
height: 22px;\
|
||||
outline: 0;\
|
||||
padding: 0 7px;\
|
||||
width: 214px;\
|
||||
margin: 0;\
|
||||
}\
|
||||
.ace_searchbtn,\
|
||||
.ace_replacebtn {\
|
||||
background: #fff;\
|
||||
border: 0 none;\
|
||||
border-left: 1px solid #dcdcdc;\
|
||||
cursor: pointer;\
|
||||
float: left;\
|
||||
height: 22px;\
|
||||
margin: 0;\
|
||||
position: relative;\
|
||||
}\
|
||||
.ace_searchbtn:last-child,\
|
||||
.ace_replacebtn:last-child {\
|
||||
border-top-right-radius: 3px;\
|
||||
border-bottom-right-radius: 3px;\
|
||||
}\
|
||||
.ace_searchbtn:disabled {\
|
||||
background: none;\
|
||||
cursor: default;\
|
||||
}\
|
||||
.ace_searchbtn {\
|
||||
background-position: 50% 50%;\
|
||||
background-repeat: no-repeat;\
|
||||
width: 27px;\
|
||||
}\
|
||||
.ace_searchbtn.prev {\
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); \
|
||||
}\
|
||||
.ace_searchbtn.next {\
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); \
|
||||
}\
|
||||
.ace_searchbtn_close {\
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\
|
||||
border-radius: 50%;\
|
||||
border: 0 none;\
|
||||
color: #656565;\
|
||||
cursor: pointer;\
|
||||
float: right;\
|
||||
font: 16px/16px Arial;\
|
||||
height: 14px;\
|
||||
margin: 5px 1px 9px 5px;\
|
||||
padding: 0;\
|
||||
text-align: center;\
|
||||
width: 14px;\
|
||||
}\
|
||||
.ace_searchbtn_close:hover {\
|
||||
background-color: #656565;\
|
||||
background-position: 50% 100%;\
|
||||
color: white;\
|
||||
}\
|
||||
.ace_replacebtn.prev {\
|
||||
width: 54px\
|
||||
}\
|
||||
.ace_replacebtn.next {\
|
||||
width: 27px\
|
||||
}\
|
||||
.ace_button {\
|
||||
margin-left: 2px;\
|
||||
cursor: pointer;\
|
||||
-webkit-user-select: none;\
|
||||
-moz-user-select: none;\
|
||||
-o-user-select: none;\
|
||||
-ms-user-select: none;\
|
||||
user-select: none;\
|
||||
overflow: hidden;\
|
||||
opacity: 0.7;\
|
||||
border: 1px solid rgba(100,100,100,0.23);\
|
||||
padding: 1px;\
|
||||
-moz-box-sizing: border-box;\
|
||||
box-sizing: border-box;\
|
||||
color: black;\
|
||||
}\
|
||||
.ace_button:hover {\
|
||||
background-color: #eee;\
|
||||
opacity:1;\
|
||||
}\
|
||||
.ace_button:active {\
|
||||
background-color: #ddd;\
|
||||
}\
|
||||
.ace_button.checked {\
|
||||
border-color: #3399ff;\
|
||||
opacity:1;\
|
||||
}\
|
||||
.ace_search_options{\
|
||||
margin-bottom: 3px;\
|
||||
text-align: right;\
|
||||
-webkit-user-select: none;\
|
||||
-moz-user-select: none;\
|
||||
-o-user-select: none;\
|
||||
-ms-user-select: none;\
|
||||
user-select: none;\
|
||||
}";
|
||||
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
||||
var keyUtil = require("../lib/keys");
|
||||
|
||||
dom.importCssString(searchboxCss, "ace_searchbox");
|
||||
|
||||
var html = '<div class="ace_search right">\
|
||||
<button type="button" action="hide" class="ace_searchbtn_close"></button>\
|
||||
<div class="ace_search_form">\
|
||||
<input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>\
|
||||
<button type="button" action="findNext" class="ace_searchbtn next"></button>\
|
||||
<button type="button" action="findPrev" class="ace_searchbtn prev"></button>\
|
||||
<button type="button" action="findAll" class="ace_searchbtn" title="Alt-Enter">All</button>\
|
||||
</div>\
|
||||
<div class="ace_replace_form">\
|
||||
<input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\
|
||||
<button type="button" action="replaceAndFindNext" class="ace_replacebtn">Replace</button>\
|
||||
<button type="button" action="replaceAll" class="ace_replacebtn">All</button>\
|
||||
</div>\
|
||||
<div class="ace_search_options">\
|
||||
<span action="toggleRegexpMode" class="ace_button" title="RegExp Search">.*</span>\
|
||||
<span action="toggleCaseSensitive" class="ace_button" title="CaseSensitive Search">Aa</span>\
|
||||
<span action="toggleWholeWords" class="ace_button" title="Whole Word Search">\\b</span>\
|
||||
</div>\
|
||||
</div>'.replace(/>\s+/g, ">");
|
||||
|
||||
var SearchBox = function(editor, range, showReplaceForm) {
|
||||
var div = dom.createElement("div");
|
||||
div.innerHTML = html;
|
||||
this.element = div.firstChild;
|
||||
|
||||
this.$init();
|
||||
this.setEditor(editor);
|
||||
};
|
||||
|
||||
(function() {
|
||||
this.setEditor = function(editor) {
|
||||
editor.searchBox = this;
|
||||
editor.container.appendChild(this.element);
|
||||
this.editor = editor;
|
||||
};
|
||||
|
||||
this.$initElements = function(sb) {
|
||||
this.searchBox = sb.querySelector(".ace_search_form");
|
||||
this.replaceBox = sb.querySelector(".ace_replace_form");
|
||||
this.searchOptions = sb.querySelector(".ace_search_options");
|
||||
this.regExpOption = sb.querySelector("[action=toggleRegexpMode]");
|
||||
this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]");
|
||||
this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]");
|
||||
this.searchInput = this.searchBox.querySelector(".ace_search_field");
|
||||
this.replaceInput = this.replaceBox.querySelector(".ace_search_field");
|
||||
};
|
||||
|
||||
this.$init = function() {
|
||||
var sb = this.element;
|
||||
|
||||
this.$initElements(sb);
|
||||
|
||||
var _this = this;
|
||||
event.addListener(sb, "mousedown", function(e) {
|
||||
setTimeout(function(){
|
||||
_this.activeInput.focus();
|
||||
}, 0);
|
||||
event.stopPropagation(e);
|
||||
});
|
||||
event.addListener(sb, "click", function(e) {
|
||||
var t = e.target || e.srcElement;
|
||||
var action = t.getAttribute("action");
|
||||
if (action && _this[action])
|
||||
_this[action]();
|
||||
else if (_this.$searchBarKb.commands[action])
|
||||
_this.$searchBarKb.commands[action].exec(_this);
|
||||
event.stopPropagation(e);
|
||||
});
|
||||
|
||||
event.addCommandKeyListener(sb, function(e, hashId, keyCode) {
|
||||
var keyString = keyUtil.keyCodeToString(keyCode);
|
||||
var command = _this.$searchBarKb.findKeyCommand(hashId, keyString);
|
||||
if (command && command.exec) {
|
||||
command.exec(_this);
|
||||
event.stopEvent(e);
|
||||
}
|
||||
});
|
||||
|
||||
this.$onChange = lang.delayedCall(function() {
|
||||
_this.find(false, false);
|
||||
});
|
||||
|
||||
event.addListener(this.searchInput, "input", function() {
|
||||
_this.$onChange.schedule(20);
|
||||
});
|
||||
event.addListener(this.searchInput, "focus", function() {
|
||||
_this.activeInput = _this.searchInput;
|
||||
_this.searchInput.value && _this.highlight();
|
||||
});
|
||||
event.addListener(this.replaceInput, "focus", function() {
|
||||
_this.activeInput = _this.replaceInput;
|
||||
_this.searchInput.value && _this.highlight();
|
||||
});
|
||||
};
|
||||
this.$closeSearchBarKb = new HashHandler([{
|
||||
bindKey: "Esc",
|
||||
name: "closeSearchBar",
|
||||
exec: function(editor) {
|
||||
editor.searchBox.hide();
|
||||
}
|
||||
}]);
|
||||
this.$searchBarKb = new HashHandler();
|
||||
this.$searchBarKb.bindKeys({
|
||||
"Ctrl-f|Command-f": function(sb) {
|
||||
var isReplace = sb.isReplace = !sb.isReplace;
|
||||
sb.replaceBox.style.display = isReplace ? "" : "none";
|
||||
sb.searchInput.focus();
|
||||
},
|
||||
"Ctrl-H|Command-Option-F": function(sb) {
|
||||
sb.replaceBox.style.display = "";
|
||||
sb.replaceInput.focus();
|
||||
},
|
||||
"Ctrl-G|Command-G": function(sb) {
|
||||
sb.findNext();
|
||||
},
|
||||
"Ctrl-Shift-G|Command-Shift-G": function(sb) {
|
||||
sb.findPrev();
|
||||
},
|
||||
"esc": function(sb) {
|
||||
setTimeout(function() { sb.hide();});
|
||||
},
|
||||
"Return": function(sb) {
|
||||
if (sb.activeInput == sb.replaceInput)
|
||||
sb.replace();
|
||||
sb.findNext();
|
||||
},
|
||||
"Shift-Return": function(sb) {
|
||||
if (sb.activeInput == sb.replaceInput)
|
||||
sb.replace();
|
||||
sb.findPrev();
|
||||
},
|
||||
"Alt-Return": function(sb) {
|
||||
if (sb.activeInput == sb.replaceInput)
|
||||
sb.replaceAll();
|
||||
sb.findAll();
|
||||
},
|
||||
"Tab": function(sb) {
|
||||
(sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
|
||||
}
|
||||
});
|
||||
|
||||
this.$searchBarKb.addCommands([{
|
||||
name: "toggleRegexpMode",
|
||||
bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"},
|
||||
exec: function(sb) {
|
||||
sb.regExpOption.checked = !sb.regExpOption.checked;
|
||||
sb.$syncOptions();
|
||||
}
|
||||
}, {
|
||||
name: "toggleCaseSensitive",
|
||||
bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"},
|
||||
exec: function(sb) {
|
||||
sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
|
||||
sb.$syncOptions();
|
||||
}
|
||||
}, {
|
||||
name: "toggleWholeWords",
|
||||
bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"},
|
||||
exec: function(sb) {
|
||||
sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
|
||||
sb.$syncOptions();
|
||||
}
|
||||
}]);
|
||||
|
||||
this.$syncOptions = function() {
|
||||
dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
|
||||
dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
|
||||
dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
|
||||
this.find(false, false);
|
||||
};
|
||||
|
||||
this.highlight = function(re) {
|
||||
this.editor.session.highlight(re || this.editor.$search.$options.re);
|
||||
this.editor.renderer.updateBackMarkers()
|
||||
};
|
||||
this.find = function(skipCurrent, backwards, preventScroll) {
|
||||
var range = this.editor.find(this.searchInput.value, {
|
||||
skipCurrent: skipCurrent,
|
||||
backwards: backwards,
|
||||
wrap: true,
|
||||
regExp: this.regExpOption.checked,
|
||||
caseSensitive: this.caseSensitiveOption.checked,
|
||||
wholeWord: this.wholeWordOption.checked,
|
||||
preventScroll: preventScroll
|
||||
});
|
||||
var noMatch = !range && this.searchInput.value;
|
||||
dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
|
||||
this.editor._emit("findSearchBox", { match: !noMatch });
|
||||
this.highlight();
|
||||
};
|
||||
this.findNext = function() {
|
||||
this.find(true, false);
|
||||
};
|
||||
this.findPrev = function() {
|
||||
this.find(true, true);
|
||||
};
|
||||
this.findAll = function(){
|
||||
var range = this.editor.findAll(this.searchInput.value, {
|
||||
regExp: this.regExpOption.checked,
|
||||
caseSensitive: this.caseSensitiveOption.checked,
|
||||
wholeWord: this.wholeWordOption.checked
|
||||
});
|
||||
var noMatch = !range && this.searchInput.value;
|
||||
dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
|
||||
this.editor._emit("findSearchBox", { match: !noMatch });
|
||||
this.highlight();
|
||||
this.hide();
|
||||
};
|
||||
this.replace = function() {
|
||||
if (!this.editor.getReadOnly())
|
||||
this.editor.replace(this.replaceInput.value);
|
||||
};
|
||||
this.replaceAndFindNext = function() {
|
||||
if (!this.editor.getReadOnly()) {
|
||||
this.editor.replace(this.replaceInput.value);
|
||||
this.findNext()
|
||||
}
|
||||
};
|
||||
this.replaceAll = function() {
|
||||
if (!this.editor.getReadOnly())
|
||||
this.editor.replaceAll(this.replaceInput.value);
|
||||
};
|
||||
|
||||
this.hide = function() {
|
||||
this.element.style.display = "none";
|
||||
this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
|
||||
this.editor.focus();
|
||||
};
|
||||
this.show = function(value, isReplace) {
|
||||
this.element.style.display = "";
|
||||
this.replaceBox.style.display = isReplace ? "" : "none";
|
||||
|
||||
this.isReplace = isReplace;
|
||||
|
||||
if (value)
|
||||
this.searchInput.value = value;
|
||||
|
||||
this.find(false, false, true);
|
||||
|
||||
this.searchInput.focus();
|
||||
this.searchInput.select();
|
||||
|
||||
this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
|
||||
};
|
||||
|
||||
this.isFocused = function() {
|
||||
var el = document.activeElement;
|
||||
return el == this.searchInput || el == this.replaceInput;
|
||||
}
|
||||
}).call(SearchBox.prototype);
|
||||
|
||||
exports.SearchBox = SearchBox;
|
||||
|
||||
exports.Search = function(editor, isReplace) {
|
||||
var sb = editor.searchBox || new SearchBox(editor);
|
||||
sb.show(editor.session.getTextRange(), isReplace);
|
||||
};
|
||||
|
||||
});
|
||||
(function() {
|
||||
ace.require(["ace/ext/searchbox"], function() {});
|
||||
})();
|
||||
|
||||
651
modules/backend/assets/vendor/ace/mode-css.js
vendored
Executable file
@@ -0,0 +1,651 @@
|
||||
ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|min-height|min-width|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index";
|
||||
var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
|
||||
var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
|
||||
var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
|
||||
var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
|
||||
|
||||
var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||
var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||
var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||
|
||||
var CssHighlightRules = function() {
|
||||
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"support.function": supportFunction,
|
||||
"support.constant": supportConstant,
|
||||
"support.type": supportType,
|
||||
"support.constant.color": supportConstantColor,
|
||||
"support.constant.fonts": supportConstantFonts
|
||||
}, "text", true);
|
||||
|
||||
this.$rules = {
|
||||
"start" : [{
|
||||
token : "comment", // multi line comment
|
||||
regex : "\\/\\*",
|
||||
push : "comment"
|
||||
}, {
|
||||
token: "paren.lparen",
|
||||
regex: "\\{",
|
||||
push: "ruleset"
|
||||
}, {
|
||||
token: "string",
|
||||
regex: "@.*?{",
|
||||
push: "media"
|
||||
}, {
|
||||
token: "keyword",
|
||||
regex: "#[a-z0-9-_]+"
|
||||
}, {
|
||||
token: "variable",
|
||||
regex: "\\.[a-z0-9-_]+"
|
||||
}, {
|
||||
token: "string",
|
||||
regex: ":[a-z0-9-_]+"
|
||||
}, {
|
||||
token: "constant",
|
||||
regex: "[a-z0-9-_]+"
|
||||
}, {
|
||||
caseInsensitive: true
|
||||
}],
|
||||
|
||||
"media" : [{
|
||||
token : "comment", // multi line comment
|
||||
regex : "\\/\\*",
|
||||
push : "comment"
|
||||
}, {
|
||||
token: "paren.lparen",
|
||||
regex: "\\{",
|
||||
push: "ruleset"
|
||||
}, {
|
||||
token: "string",
|
||||
regex: "\\}",
|
||||
next: "pop"
|
||||
}, {
|
||||
token: "keyword",
|
||||
regex: "#[a-z0-9-_]+"
|
||||
}, {
|
||||
token: "variable",
|
||||
regex: "\\.[a-z0-9-_]+"
|
||||
}, {
|
||||
token: "string",
|
||||
regex: ":[a-z0-9-_]+"
|
||||
}, {
|
||||
token: "constant",
|
||||
regex: "[a-z0-9-_]+"
|
||||
}, {
|
||||
caseInsensitive: true
|
||||
}],
|
||||
|
||||
"comment" : [{
|
||||
token : "comment",
|
||||
regex : "\\*\\/",
|
||||
next : "pop"
|
||||
}, {
|
||||
defaultToken : "comment"
|
||||
}],
|
||||
|
||||
"ruleset" : [
|
||||
{
|
||||
token : "paren.rparen",
|
||||
regex : "\\}",
|
||||
next: "pop"
|
||||
}, {
|
||||
token : "comment", // multi line comment
|
||||
regex : "\\/\\*",
|
||||
push : "comment"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||
}, {
|
||||
token : ["constant.numeric", "keyword"],
|
||||
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||
}, {
|
||||
token : "constant.numeric",
|
||||
regex : numRe
|
||||
}, {
|
||||
token : "constant.numeric", // hex6 color
|
||||
regex : "#[a-f0-9]{6}"
|
||||
}, {
|
||||
token : "constant.numeric", // hex3 color
|
||||
regex : "#[a-f0-9]{3}"
|
||||
}, {
|
||||
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||
regex : pseudoElements
|
||||
}, {
|
||||
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||
regex : pseudoClasses
|
||||
}, {
|
||||
token : ["support.function", "string", "support.function"],
|
||||
regex : "(url\\()(.*)(\\))"
|
||||
}, {
|
||||
token : keywordMapper,
|
||||
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
|
||||
}, {
|
||||
caseInsensitive: true
|
||||
}]
|
||||
};
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
oop.inherits(CssHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.CssHighlightRules = CssHighlightRules;
|
||||
|
||||
});
|
||||
|
||||
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var MatchingBraceOutdent = function() {};
|
||||
|
||||
(function() {
|
||||
|
||||
this.checkOutdent = function(line, input) {
|
||||
if (! /^\s+$/.test(line))
|
||||
return false;
|
||||
|
||||
return /^\s*\}/.test(input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(doc, row) {
|
||||
var line = doc.getLine(row);
|
||||
var match = line.match(/^(\s*\})/);
|
||||
|
||||
if (!match) return 0;
|
||||
|
||||
var column = match[1].length;
|
||||
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||
|
||||
if (!openBracePos || openBracePos.row == row) return 0;
|
||||
|
||||
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||
};
|
||||
|
||||
this.$getIndent = function(line) {
|
||||
return line.match(/^\s*/)[0];
|
||||
};
|
||||
|
||||
}).call(MatchingBraceOutdent.prototype);
|
||||
|
||||
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||
});
|
||||
|
||||
ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var propertyMap = {
|
||||
"background": {"#$0": 1},
|
||||
"background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
|
||||
"background-image": {"url('/$0')": 1},
|
||||
"background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
|
||||
"background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
|
||||
"background-attachment": {"scroll": 1, "fixed": 1},
|
||||
"background-size": {"cover": 1, "contain": 1},
|
||||
"background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
|
||||
"background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
|
||||
"border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
|
||||
"border-color": {"#$0": 1},
|
||||
"border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
|
||||
"border-collapse": {"collapse": 1, "separate": 1},
|
||||
"bottom": {"px": 1, "em": 1, "%": 1},
|
||||
"clear": {"left": 1, "right": 1, "both": 1, "none": 1},
|
||||
"color": {"#$0": 1, "rgb(#$00,0,0)": 1},
|
||||
"cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1},
|
||||
"display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
|
||||
"empty-cells": {"show": 1, "hide": 1},
|
||||
"float": {"left": 1, "right": 1, "none": 1},
|
||||
"font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1},
|
||||
"font-size": {"px": 1, "em": 1, "%": 1},
|
||||
"font-weight": {"bold": 1, "normal": 1},
|
||||
"font-style": {"italic": 1, "normal": 1},
|
||||
"font-variant": {"normal": 1, "small-caps": 1},
|
||||
"height": {"px": 1, "em": 1, "%": 1},
|
||||
"left": {"px": 1, "em": 1, "%": 1},
|
||||
"letter-spacing": {"normal": 1},
|
||||
"line-height": {"normal": 1},
|
||||
"list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1},
|
||||
"margin": {"px": 1, "em": 1, "%": 1},
|
||||
"margin-right": {"px": 1, "em": 1, "%": 1},
|
||||
"margin-left": {"px": 1, "em": 1, "%": 1},
|
||||
"margin-top": {"px": 1, "em": 1, "%": 1},
|
||||
"margin-bottom": {"px": 1, "em": 1, "%": 1},
|
||||
"max-height": {"px": 1, "em": 1, "%": 1},
|
||||
"max-width": {"px": 1, "em": 1, "%": 1},
|
||||
"min-height": {"px": 1, "em": 1, "%": 1},
|
||||
"min-width": {"px": 1, "em": 1, "%": 1},
|
||||
"overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
|
||||
"overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
|
||||
"overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
|
||||
"padding": {"px": 1, "em": 1, "%": 1},
|
||||
"padding-top": {"px": 1, "em": 1, "%": 1},
|
||||
"padding-right": {"px": 1, "em": 1, "%": 1},
|
||||
"padding-bottom": {"px": 1, "em": 1, "%": 1},
|
||||
"padding-left": {"px": 1, "em": 1, "%": 1},
|
||||
"page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
|
||||
"page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
|
||||
"position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
|
||||
"right": {"px": 1, "em": 1, "%": 1},
|
||||
"table-layout": {"fixed": 1, "auto": 1},
|
||||
"text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
|
||||
"text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
|
||||
"text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
|
||||
"top": {"px": 1, "em": 1, "%": 1},
|
||||
"vertical-align": {"top": 1, "bottom": 1},
|
||||
"visibility": {"hidden": 1, "visible": 1},
|
||||
"white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
|
||||
"width": {"px": 1, "em": 1, "%": 1},
|
||||
"word-spacing": {"normal": 1},
|
||||
"filter": {"alpha(opacity=$0100)": 1},
|
||||
|
||||
"text-shadow": {"$02px 2px 2px #777": 1},
|
||||
"text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
|
||||
"-moz-border-radius": 1,
|
||||
"-moz-border-radius-topright": 1,
|
||||
"-moz-border-radius-bottomright": 1,
|
||||
"-moz-border-radius-topleft": 1,
|
||||
"-moz-border-radius-bottomleft": 1,
|
||||
"-webkit-border-radius": 1,
|
||||
"-webkit-border-top-right-radius": 1,
|
||||
"-webkit-border-top-left-radius": 1,
|
||||
"-webkit-border-bottom-right-radius": 1,
|
||||
"-webkit-border-bottom-left-radius": 1,
|
||||
"-moz-box-shadow": 1,
|
||||
"-webkit-box-shadow": 1,
|
||||
"transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
|
||||
"-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
|
||||
"-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
|
||||
};
|
||||
|
||||
var CssCompletions = function() {
|
||||
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
this.completionsDefined = false;
|
||||
|
||||
this.defineCompletions = function() {
|
||||
if (document) {
|
||||
var style = document.createElement('c').style;
|
||||
|
||||
for (var i in style) {
|
||||
if (typeof style[i] !== 'string')
|
||||
continue;
|
||||
|
||||
var name = i.replace(/[A-Z]/g, function(x) {
|
||||
return '-' + x.toLowerCase();
|
||||
});
|
||||
|
||||
if (!propertyMap.hasOwnProperty(name))
|
||||
propertyMap[name] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
this.completionsDefined = true;
|
||||
}
|
||||
|
||||
this.getCompletions = function(state, session, pos, prefix) {
|
||||
if (!this.completionsDefined) {
|
||||
this.defineCompletions();
|
||||
}
|
||||
|
||||
var token = session.getTokenAt(pos.row, pos.column);
|
||||
|
||||
if (!token)
|
||||
return [];
|
||||
if (state==='ruleset'){
|
||||
var line = session.getLine(pos.row).substr(0, pos.column);
|
||||
if (/:[^;]+$/.test(line)) {
|
||||
/([\w\-]+):[^:]*$/.test(line);
|
||||
|
||||
return this.getPropertyValueCompletions(state, session, pos, prefix);
|
||||
} else {
|
||||
return this.getPropertyCompletions(state, session, pos, prefix);
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
};
|
||||
|
||||
this.getPropertyCompletions = function(state, session, pos, prefix) {
|
||||
var properties = Object.keys(propertyMap);
|
||||
return properties.map(function(property){
|
||||
return {
|
||||
caption: property,
|
||||
snippet: property + ': $0',
|
||||
meta: "property",
|
||||
score: Number.MAX_VALUE
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
this.getPropertyValueCompletions = function(state, session, pos, prefix) {
|
||||
var line = session.getLine(pos.row).substr(0, pos.column);
|
||||
var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
|
||||
|
||||
if (!property)
|
||||
return [];
|
||||
var values = [];
|
||||
if (property in propertyMap && typeof propertyMap[property] === "object") {
|
||||
values = Object.keys(propertyMap[property]);
|
||||
}
|
||||
return values.map(function(value){
|
||||
return {
|
||||
caption: value,
|
||||
snippet: value,
|
||||
meta: "property value",
|
||||
score: Number.MAX_VALUE
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
}).call(CssCompletions.prototype);
|
||||
|
||||
exports.CssCompletions = CssCompletions;
|
||||
});
|
||||
|
||||
ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var Behaviour = require("../behaviour").Behaviour;
|
||||
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
|
||||
var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||
|
||||
var CssBehaviour = function () {
|
||||
|
||||
this.inherit(CstyleBehaviour);
|
||||
|
||||
this.add("colon", "insertion", function (state, action, editor, session, text) {
|
||||
if (text === ':') {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||
var token = iterator.getCurrentToken();
|
||||
if (token && token.value.match(/\s+/)) {
|
||||
token = iterator.stepBackward();
|
||||
}
|
||||
if (token && token.type === 'support.type') {
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
if (rightChar === ':') {
|
||||
return {
|
||||
text: '',
|
||||
selection: [1, 1]
|
||||
}
|
||||
}
|
||||
if (!line.substring(cursor.column).match(/^\s*;/)) {
|
||||
return {
|
||||
text: ':;',
|
||||
selection: [1, 1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("colon", "deletion", function (state, action, editor, session, range) {
|
||||
var selected = session.doc.getTextRange(range);
|
||||
if (!range.isMultiLine() && selected === ':') {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
||||
var token = iterator.getCurrentToken();
|
||||
if (token && token.value.match(/\s+/)) {
|
||||
token = iterator.stepBackward();
|
||||
}
|
||||
if (token && token.type === 'support.type') {
|
||||
var line = session.doc.getLine(range.start.row);
|
||||
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
||||
if (rightChar === ';') {
|
||||
range.end.column ++;
|
||||
return range;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.add("semicolon", "insertion", function (state, action, editor, session, text) {
|
||||
if (text === ';') {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
if (rightChar === ';') {
|
||||
return {
|
||||
text: '',
|
||||
selection: [1, 1]
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
oop.inherits(CssBehaviour, CstyleBehaviour);
|
||||
|
||||
exports.CssBehaviour = CssBehaviour;
|
||||
});
|
||||
|
||||
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var Range = require("../../range").Range;
|
||||
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||
|
||||
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||
if (commentRegex) {
|
||||
this.foldingStartMarker = new RegExp(
|
||||
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||
);
|
||||
this.foldingStopMarker = new RegExp(
|
||||
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||
);
|
||||
}
|
||||
};
|
||||
oop.inherits(FoldMode, BaseFoldMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
||||
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
||||
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
|
||||
this._getFoldWidgetBase = this.getFoldWidget;
|
||||
this.getFoldWidget = function(session, foldStyle, row) {
|
||||
var line = session.getLine(row);
|
||||
|
||||
if (this.singleLineBlockCommentRe.test(line)) {
|
||||
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
||||
return "";
|
||||
}
|
||||
|
||||
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
||||
|
||||
if (!fw && this.startRegionRe.test(line))
|
||||
return "start"; // lineCommentRegionStart
|
||||
|
||||
return fw;
|
||||
};
|
||||
|
||||
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||
var line = session.getLine(row);
|
||||
|
||||
if (this.startRegionRe.test(line))
|
||||
return this.getCommentRegionBlock(session, line, row);
|
||||
|
||||
var match = line.match(this.foldingStartMarker);
|
||||
if (match) {
|
||||
var i = match.index;
|
||||
|
||||
if (match[1])
|
||||
return this.openingBracketBlock(session, match[1], row, i);
|
||||
|
||||
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||
|
||||
if (range && !range.isMultiLine()) {
|
||||
if (forceMultiline) {
|
||||
range = this.getSectionRange(session, row);
|
||||
} else if (foldStyle != "all")
|
||||
range = null;
|
||||
}
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
if (foldStyle === "markbegin")
|
||||
return;
|
||||
|
||||
var match = line.match(this.foldingStopMarker);
|
||||
if (match) {
|
||||
var i = match.index + match[0].length;
|
||||
|
||||
if (match[1])
|
||||
return this.closingBracketBlock(session, match[1], row, i);
|
||||
|
||||
return session.getCommentFoldRange(row, i, -1);
|
||||
}
|
||||
};
|
||||
|
||||
this.getSectionRange = function(session, row) {
|
||||
var line = session.getLine(row);
|
||||
var startIndent = line.search(/\S/);
|
||||
var startRow = row;
|
||||
var startColumn = line.length;
|
||||
row = row + 1;
|
||||
var endRow = row;
|
||||
var maxRow = session.getLength();
|
||||
while (++row < maxRow) {
|
||||
line = session.getLine(row);
|
||||
var indent = line.search(/\S/);
|
||||
if (indent === -1)
|
||||
continue;
|
||||
if (startIndent > indent)
|
||||
break;
|
||||
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||
|
||||
if (subRange) {
|
||||
if (subRange.start.row <= startRow) {
|
||||
break;
|
||||
} else if (subRange.isMultiLine()) {
|
||||
row = subRange.end.row;
|
||||
} else if (startIndent == indent) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
endRow = row;
|
||||
}
|
||||
|
||||
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||
};
|
||||
this.getCommentRegionBlock = function(session, line, row) {
|
||||
var startColumn = line.search(/\s*$/);
|
||||
var maxRow = session.getLength();
|
||||
var startRow = row;
|
||||
|
||||
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
|
||||
var depth = 1;
|
||||
while (++row < maxRow) {
|
||||
line = session.getLine(row);
|
||||
var m = re.exec(line);
|
||||
if (!m) continue;
|
||||
if (m[1]) depth--;
|
||||
else depth++;
|
||||
|
||||
if (!depth) break;
|
||||
}
|
||||
|
||||
var endRow = row;
|
||||
if (endRow > startRow) {
|
||||
return new Range(startRow, startColumn, endRow, line.length);
|
||||
}
|
||||
};
|
||||
|
||||
}).call(FoldMode.prototype);
|
||||
|
||||
});
|
||||
|
||||
ace.define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||
var CssCompletions = require("./css_completions").CssCompletions;
|
||||
var CssBehaviour = require("./behaviour/css").CssBehaviour;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = CssHighlightRules;
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.$behaviour = new CssBehaviour();
|
||||
this.$completer = new CssCompletions();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.foldingRules = "cStyle";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
}
|
||||
|
||||
var match = line.match(/^.*\{\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
|
||||
return indent;
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.getCompletions = function(state, session, pos, prefix) {
|
||||
return this.$completer.getCompletions(state, session, pos, prefix);
|
||||
};
|
||||
|
||||
this.createWorker = function(session) {
|
||||
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("annotate", function(e) {
|
||||
session.setAnnotations(e.data);
|
||||
});
|
||||
|
||||
worker.on("terminate", function() {
|
||||
session.clearAnnotations();
|
||||
});
|
||||
|
||||
return worker;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/css";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
||||
});
|
||||
2426
modules/backend/assets/vendor/ace/mode-html.js
vendored
Executable file
782
modules/backend/assets/vendor/ace/mode-javascript.js
vendored
Executable file
@@ -0,0 +1,782 @@
|
||||
ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var DocCommentHighlightRules = function() {
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "comment.doc.tag",
|
||||
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||
},
|
||||
DocCommentHighlightRules.getTagRule(),
|
||||
{
|
||||
defaultToken : "comment.doc",
|
||||
caseInsensitive: true
|
||||
}]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
DocCommentHighlightRules.getTagRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc.tag.storage.type",
|
||||
regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
|
||||
};
|
||||
}
|
||||
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
});
|
||||
|
||||
ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
|
||||
|
||||
var JavaScriptHighlightRules = function(options) {
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"variable.language":
|
||||
"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
|
||||
"Namespace|QName|XML|XMLList|" + // E4X
|
||||
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
|
||||
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
|
||||
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
|
||||
"SyntaxError|TypeError|URIError|" +
|
||||
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
|
||||
"isNaN|parseFloat|parseInt|" +
|
||||
"JSON|Math|" + // Other
|
||||
"this|arguments|prototype|window|document" , // Pseudo
|
||||
"keyword":
|
||||
"const|yield|import|get|set|async|await|" +
|
||||
"break|case|catch|continue|default|delete|do|else|finally|for|function|" +
|
||||
"if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
|
||||
"__parent__|__count__|escape|unescape|with|__proto__|" +
|
||||
"class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
|
||||
"storage.type":
|
||||
"const|let|var|function",
|
||||
"constant.language":
|
||||
"null|Infinity|NaN|undefined",
|
||||
"support.function":
|
||||
"alert",
|
||||
"constant.language.boolean": "true|false"
|
||||
}, "identifier");
|
||||
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
|
||||
|
||||
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
|
||||
"u[0-9a-fA-F]{4}|" + // unicode
|
||||
"u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
|
||||
"[0-2][0-7]{0,2}|" + // oct
|
||||
"3[0-7][0-7]?|" + // oct
|
||||
"[4-7][0-7]?|" + //oct
|
||||
".)";
|
||||
|
||||
this.$rules = {
|
||||
"no_regex" : [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
comments("no_regex"),
|
||||
{
|
||||
token : "string",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : /0(?:[xX][0-9a-fA-F]+|[bB][01]+)\b/
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||
}, {
|
||||
token : [
|
||||
"storage.type", "punctuation.operator", "support.function",
|
||||
"punctuation.operator", "entity.name.function", "text","keyword.operator"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : [
|
||||
"storage.type", "punctuation.operator", "entity.name.function", "text",
|
||||
"keyword.operator", "text", "storage.type", "text", "paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : [
|
||||
"entity.name.function", "text", "keyword.operator", "text", "storage.type",
|
||||
"text", "paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : [
|
||||
"storage.type", "punctuation.operator", "entity.name.function", "text",
|
||||
"keyword.operator", "text",
|
||||
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : [
|
||||
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : [
|
||||
"entity.name.function", "text", "punctuation.operator",
|
||||
"text", "storage.type", "text", "paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : [
|
||||
"text", "text", "storage.type", "text", "paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "keyword",
|
||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||
next : "start"
|
||||
}, {
|
||||
token : ["support.constant"],
|
||||
regex : /that\b/
|
||||
}, {
|
||||
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||
regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
|
||||
}, {
|
||||
token : keywordMapper,
|
||||
regex : identifierRe
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : /[.](?![.])/,
|
||||
next : "property"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
|
||||
next : "start"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : /[?:,;.]/,
|
||||
next : "start"
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : /[\[({]/,
|
||||
next : "start"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : /[\])}]/
|
||||
}, {
|
||||
token: "comment",
|
||||
regex: /^#!.*$/
|
||||
}
|
||||
],
|
||||
property: [{
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}, {
|
||||
token : [
|
||||
"storage.type", "punctuation.operator", "entity.name.function", "text",
|
||||
"keyword.operator", "text",
|
||||
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : /[.](?![.])/
|
||||
}, {
|
||||
token : "support.function",
|
||||
regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||
}, {
|
||||
token : "support.function.dom",
|
||||
regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||
}, {
|
||||
token : "support.constant",
|
||||
regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||
}, {
|
||||
token : "identifier",
|
||||
regex : identifierRe
|
||||
}, {
|
||||
regex: "",
|
||||
token: "empty",
|
||||
next: "no_regex"
|
||||
}
|
||||
],
|
||||
"start": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
comments("start"),
|
||||
{
|
||||
token: "string.regexp",
|
||||
regex: "\\/",
|
||||
next: "regex"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+|^$",
|
||||
next : "start"
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "no_regex"
|
||||
}
|
||||
],
|
||||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "/[sxngimy]*",
|
||||
next: "no_regex"
|
||||
}, {
|
||||
token : "invalid",
|
||||
regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
|
||||
}, {
|
||||
token : "constant.language.escape",
|
||||
regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
|
||||
}, {
|
||||
token : "constant.language.delimiter",
|
||||
regex: /\|/
|
||||
}, {
|
||||
token: "constant.language.escape",
|
||||
regex: /\[\^?/,
|
||||
next: "regex_character_class"
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "$",
|
||||
next: "no_regex"
|
||||
}, {
|
||||
defaultToken: "string.regexp"
|
||||
}
|
||||
],
|
||||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.charclass.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "constant.language.escape",
|
||||
regex: "]",
|
||||
next: "regex"
|
||||
}, {
|
||||
token: "constant.language.escape",
|
||||
regex: "-"
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "$",
|
||||
next: "no_regex"
|
||||
}, {
|
||||
defaultToken: "string.regexp.charachterclass"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+"
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$"
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "no_regex"
|
||||
}
|
||||
],
|
||||
"qqstring" : [
|
||||
{
|
||||
token : "constant.language.escape",
|
||||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "\\\\$",
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "no_regex"
|
||||
}, {
|
||||
defaultToken: "string"
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
{
|
||||
token : "constant.language.escape",
|
||||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "\\\\$",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "no_regex"
|
||||
}, {
|
||||
defaultToken: "string"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
if (!options || !options.noES6) {
|
||||
this.$rules.no_regex.unshift({
|
||||
regex: "[{}]", onMatch: function(val, state, stack) {
|
||||
this.next = val == "{" ? this.nextState : "";
|
||||
if (val == "{" && stack.length) {
|
||||
stack.unshift("start", state);
|
||||
}
|
||||
else if (val == "}" && stack.length) {
|
||||
stack.shift();
|
||||
this.next = stack.shift();
|
||||
if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
|
||||
return "paren.quasi.end";
|
||||
}
|
||||
return val == "{" ? "paren.lparen" : "paren.rparen";
|
||||
},
|
||||
nextState: "start"
|
||||
}, {
|
||||
token : "string.quasi.start",
|
||||
regex : /`/,
|
||||
push : [{
|
||||
token : "constant.language.escape",
|
||||
regex : escapedRe
|
||||
}, {
|
||||
token : "paren.quasi.start",
|
||||
regex : /\${/,
|
||||
push : "start"
|
||||
}, {
|
||||
token : "string.quasi.end",
|
||||
regex : /`/,
|
||||
next : "pop"
|
||||
}, {
|
||||
defaultToken: "string.quasi"
|
||||
}]
|
||||
});
|
||||
|
||||
if (!options || options.jsx != false)
|
||||
JSX.call(this);
|
||||
}
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ DocCommentHighlightRules.getEndRule("no_regex") ]);
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
||||
function JSX() {
|
||||
var tagRegex = identifierRe.replace("\\d", "\\d\\-");
|
||||
var jsxTag = {
|
||||
onMatch : function(val, state, stack) {
|
||||
var offset = val.charAt(1) == "/" ? 2 : 1;
|
||||
if (offset == 1) {
|
||||
if (state != this.nextState)
|
||||
stack.unshift(this.next, this.nextState, 0);
|
||||
else
|
||||
stack.unshift(this.next);
|
||||
stack[2]++;
|
||||
} else if (offset == 2) {
|
||||
if (state == this.nextState) {
|
||||
stack[1]--;
|
||||
if (!stack[1] || stack[1] < 0) {
|
||||
stack.shift();
|
||||
stack.shift();
|
||||
}
|
||||
}
|
||||
}
|
||||
return [{
|
||||
type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
|
||||
value: val.slice(0, offset)
|
||||
}, {
|
||||
type: "meta.tag.tag-name.xml",
|
||||
value: val.substr(offset)
|
||||
}];
|
||||
},
|
||||
regex : "</?" + tagRegex + "",
|
||||
next: "jsxAttributes",
|
||||
nextState: "jsx"
|
||||
};
|
||||
this.$rules.start.unshift(jsxTag);
|
||||
var jsxJsRule = {
|
||||
regex: "{",
|
||||
token: "paren.quasi.start",
|
||||
push: "start"
|
||||
};
|
||||
this.$rules.jsx = [
|
||||
jsxJsRule,
|
||||
jsxTag,
|
||||
{include : "reference"},
|
||||
{defaultToken: "string"}
|
||||
];
|
||||
this.$rules.jsxAttributes = [{
|
||||
token : "meta.tag.punctuation.tag-close.xml",
|
||||
regex : "/?>",
|
||||
onMatch : function(value, currentState, stack) {
|
||||
if (currentState == stack[0])
|
||||
stack.shift();
|
||||
if (value.length == 2) {
|
||||
if (stack[0] == this.nextState)
|
||||
stack[1]--;
|
||||
if (!stack[1] || stack[1] < 0) {
|
||||
stack.splice(0, 2);
|
||||
}
|
||||
}
|
||||
this.next = stack[0] || "start";
|
||||
return [{type: this.token, value: value}];
|
||||
},
|
||||
nextState: "jsx"
|
||||
},
|
||||
jsxJsRule,
|
||||
comments("jsxAttributes"),
|
||||
{
|
||||
token : "entity.other.attribute-name.xml",
|
||||
regex : tagRegex
|
||||
}, {
|
||||
token : "keyword.operator.attribute-equals.xml",
|
||||
regex : "="
|
||||
}, {
|
||||
token : "text.tag-whitespace.xml",
|
||||
regex : "\\s+"
|
||||
}, {
|
||||
token : "string.attribute-value.xml",
|
||||
regex : "'",
|
||||
stateName : "jsx_attr_q",
|
||||
push : [
|
||||
{token : "string.attribute-value.xml", regex: "'", next: "pop"},
|
||||
{include : "reference"},
|
||||
{defaultToken : "string.attribute-value.xml"}
|
||||
]
|
||||
}, {
|
||||
token : "string.attribute-value.xml",
|
||||
regex : '"',
|
||||
stateName : "jsx_attr_qq",
|
||||
push : [
|
||||
{token : "string.attribute-value.xml", regex: '"', next: "pop"},
|
||||
{include : "reference"},
|
||||
{defaultToken : "string.attribute-value.xml"}
|
||||
]
|
||||
},
|
||||
jsxTag
|
||||
];
|
||||
this.$rules.reference = [{
|
||||
token : "constant.language.escape.reference.xml",
|
||||
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||
}];
|
||||
}
|
||||
|
||||
function comments(next) {
|
||||
return [
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
regex : /\/\*/,
|
||||
next: [
|
||||
DocCommentHighlightRules.getTagRule(),
|
||||
{token : "comment", regex : "\\*\\/", next : next || "pop"},
|
||||
{defaultToken : "comment", caseInsensitive: true}
|
||||
]
|
||||
}, {
|
||||
token : "comment",
|
||||
regex : "\\/\\/",
|
||||
next: [
|
||||
DocCommentHighlightRules.getTagRule(),
|
||||
{token : "comment", regex : "$|^", next : next || "pop"},
|
||||
{defaultToken : "comment", caseInsensitive: true}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
|
||||
});
|
||||
|
||||
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var MatchingBraceOutdent = function() {};
|
||||
|
||||
(function() {
|
||||
|
||||
this.checkOutdent = function(line, input) {
|
||||
if (! /^\s+$/.test(line))
|
||||
return false;
|
||||
|
||||
return /^\s*\}/.test(input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(doc, row) {
|
||||
var line = doc.getLine(row);
|
||||
var match = line.match(/^(\s*\})/);
|
||||
|
||||
if (!match) return 0;
|
||||
|
||||
var column = match[1].length;
|
||||
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||
|
||||
if (!openBracePos || openBracePos.row == row) return 0;
|
||||
|
||||
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||
};
|
||||
|
||||
this.$getIndent = function(line) {
|
||||
return line.match(/^\s*/)[0];
|
||||
};
|
||||
|
||||
}).call(MatchingBraceOutdent.prototype);
|
||||
|
||||
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||
});
|
||||
|
||||
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var Range = require("../../range").Range;
|
||||
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||
|
||||
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||
if (commentRegex) {
|
||||
this.foldingStartMarker = new RegExp(
|
||||
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||
);
|
||||
this.foldingStopMarker = new RegExp(
|
||||
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||
);
|
||||
}
|
||||
};
|
||||
oop.inherits(FoldMode, BaseFoldMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
||||
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
||||
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
|
||||
this._getFoldWidgetBase = this.getFoldWidget;
|
||||
this.getFoldWidget = function(session, foldStyle, row) {
|
||||
var line = session.getLine(row);
|
||||
|
||||
if (this.singleLineBlockCommentRe.test(line)) {
|
||||
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
||||
return "";
|
||||
}
|
||||
|
||||
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
||||
|
||||
if (!fw && this.startRegionRe.test(line))
|
||||
return "start"; // lineCommentRegionStart
|
||||
|
||||
return fw;
|
||||
};
|
||||
|
||||
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||
var line = session.getLine(row);
|
||||
|
||||
if (this.startRegionRe.test(line))
|
||||
return this.getCommentRegionBlock(session, line, row);
|
||||
|
||||
var match = line.match(this.foldingStartMarker);
|
||||
if (match) {
|
||||
var i = match.index;
|
||||
|
||||
if (match[1])
|
||||
return this.openingBracketBlock(session, match[1], row, i);
|
||||
|
||||
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||
|
||||
if (range && !range.isMultiLine()) {
|
||||
if (forceMultiline) {
|
||||
range = this.getSectionRange(session, row);
|
||||
} else if (foldStyle != "all")
|
||||
range = null;
|
||||
}
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
if (foldStyle === "markbegin")
|
||||
return;
|
||||
|
||||
var match = line.match(this.foldingStopMarker);
|
||||
if (match) {
|
||||
var i = match.index + match[0].length;
|
||||
|
||||
if (match[1])
|
||||
return this.closingBracketBlock(session, match[1], row, i);
|
||||
|
||||
return session.getCommentFoldRange(row, i, -1);
|
||||
}
|
||||
};
|
||||
|
||||
this.getSectionRange = function(session, row) {
|
||||
var line = session.getLine(row);
|
||||
var startIndent = line.search(/\S/);
|
||||
var startRow = row;
|
||||
var startColumn = line.length;
|
||||
row = row + 1;
|
||||
var endRow = row;
|
||||
var maxRow = session.getLength();
|
||||
while (++row < maxRow) {
|
||||
line = session.getLine(row);
|
||||
var indent = line.search(/\S/);
|
||||
if (indent === -1)
|
||||
continue;
|
||||
if (startIndent > indent)
|
||||
break;
|
||||
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||
|
||||
if (subRange) {
|
||||
if (subRange.start.row <= startRow) {
|
||||
break;
|
||||
} else if (subRange.isMultiLine()) {
|
||||
row = subRange.end.row;
|
||||
} else if (startIndent == indent) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
endRow = row;
|
||||
}
|
||||
|
||||
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||
};
|
||||
this.getCommentRegionBlock = function(session, line, row) {
|
||||
var startColumn = line.search(/\s*$/);
|
||||
var maxRow = session.getLength();
|
||||
var startRow = row;
|
||||
|
||||
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
|
||||
var depth = 1;
|
||||
while (++row < maxRow) {
|
||||
line = session.getLine(row);
|
||||
var m = re.exec(line);
|
||||
if (!m) continue;
|
||||
if (m[1]) depth--;
|
||||
else depth++;
|
||||
|
||||
if (!depth) break;
|
||||
}
|
||||
|
||||
var endRow = row;
|
||||
if (endRow > startRow) {
|
||||
return new Range(startRow, startColumn, endRow, line.length);
|
||||
}
|
||||
};
|
||||
|
||||
}).call(FoldMode.prototype);
|
||||
|
||||
});
|
||||
|
||||
ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = JavaScriptHighlightRules;
|
||||
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.$behaviour = new CstyleBehaviour();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
var endState = tokenizedLine.state;
|
||||
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
}
|
||||
|
||||
if (state == "start" || state == "no_regex") {
|
||||
var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
} else if (state == "doc-start") {
|
||||
if (endState == "start" || endState == "no_regex") {
|
||||
return "";
|
||||
}
|
||||
var match = line.match(/^\s*(\/?)\*/);
|
||||
if (match) {
|
||||
if (match[1]) {
|
||||
indent += " ";
|
||||
}
|
||||
indent += "* ";
|
||||
}
|
||||
}
|
||||
|
||||
return indent;
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.createWorker = function(session) {
|
||||
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("annotate", function(results) {
|
||||
session.setAnnotations(results.data);
|
||||
});
|
||||
|
||||
worker.on("terminate", function() {
|
||||
session.clearAnnotations();
|
||||
});
|
||||
|
||||
return worker;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/javascript";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||