diff --git a/.distignore b/.distignore index 564ff10..b0eca1a 100644 --- a/.distignore +++ b/.distignore @@ -9,7 +9,7 @@ /vendor/dealerdirect /vendor/phpcompatibility /vendor/php-parallel-lint - +/zip gulpfile.babel.js yarn.lock config.yml diff --git a/composer.json b/composer.json index 94401da..5261db1 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "linchpin/courier", + "name": "linchpin/courier-notices", "description": "Courier Notices, a highly extendable advanced front end notification plugin for WordPress", "homepage": "https://github.com/linchpin/courier-notices", "version": "1.4.6", @@ -9,7 +9,12 @@ "email": "sayhi@linchpin.com", "homepage": "https://linchpin.com", "role": "Developer" - } + }, + { + "name": "Aaron Ware", + "role": "Developer", + "email": "aaron@linchpin.com" + } ], "keywords": [ "WordPress", @@ -37,10 +42,11 @@ "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", "wp-coding-standards/wpcs": "^2.3.0", - "squizlabs/php_codesniffer": "^3.6.2", + "squizlabs/php_codesniffer": "^3.7.1", "phpcompatibility/php-compatibility": "^9.3.5", "php-parallel-lint/php-parallel-lint": "^v1.3.2", - "php-parallel-lint/php-console-highlighter": "^1.0.0" + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "saggre/phpdocumentor-markdown": "^0.1.3" }, "scripts" : { "lint": [ @@ -59,7 +65,8 @@ "@php ./vendor/phpunit/phpunit/phpunit" ], "lint-fix": "phpcbf .", - "php-cs-fixer": "./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix ./ --config=./.php-cs-fixer.dist.php" + "php-cs-fixer": "./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix ./ --config=./.php-cs-fixer.dist.php", + "create-wiki": "phpDocumentor --directory=application --target=wiki --template='vendor/saggre/phpdocumentor-markdown/themes/markdown'" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index 60c471d..39bbe10 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1f7bbcf593eb06b3c4bd1c68b421b1ca", + "content-hash": "611f6c6e7185981b5eae8ede7ceb566d", "packages": [ { "name": "erusev/parsedown", @@ -353,6 +353,56 @@ }, "time": "2019-12-27T09:44:58+00:00" }, + { + "name": "saggre/phpdocumentor-markdown", + "version": "0.1.3", + "source": { + "type": "git", + "url": "https://github.com/Saggre/phpDocumentor-markdown.git", + "reference": "35cf7221561ce75eba4301b770e329be45c6dba1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Saggre/phpDocumentor-markdown/zipball/35cf7221561ce75eba4301b770e329be45c6dba1", + "reference": "35cf7221561ce75eba4301b770e329be45c6dba1", + "shasum": "" + }, + "require-dev": { + "php": ">=7.4", + "phpunit/phpunit": "^9.5", + "twig/twig": "2.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpDocumentorMarkdown\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Saggre", + "email": "sakri.koskimies@hotmail.com" + } + ], + "description": "Markdown template for phpDocumentor3", + "keywords": [ + "documentation", + "github", + "gitlab", + "markdown", + "phpDocumentor", + "phpdoc" + ], + "support": { + "issues": "https://github.com/Saggre/phpDocumentor-markdown/issues", + "source": "https://github.com/Saggre/phpDocumentor-markdown/tree/0.1.3" + }, + "time": "2022-04-20T17:19:33+00:00" + }, { "name": "squizlabs/php_codesniffer", "version": "3.7.1", @@ -470,5 +520,5 @@ "php": ">=7.3" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/css/fonts/courier-admin.eot b/css/fonts/courier-admin.eot new file mode 100755 index 0000000..a788cac Binary files /dev/null and b/css/fonts/courier-admin.eot differ diff --git a/css/fonts/courier-admin.svg b/css/fonts/courier-admin.svg new file mode 100755 index 0000000..3cc7009 --- /dev/null +++ b/css/fonts/courier-admin.svg @@ -0,0 +1,12 @@ + + + +Generated by IcoMoon + + + + + + + + \ No newline at end of file diff --git a/css/fonts/courier-admin.ttf b/css/fonts/courier-admin.ttf new file mode 100755 index 0000000..f6f21e6 Binary files /dev/null and b/css/fonts/courier-admin.ttf differ diff --git a/css/fonts/courier-admin.woff b/css/fonts/courier-admin.woff new file mode 100755 index 0000000..9abd9bd Binary files /dev/null and b/css/fonts/courier-admin.woff differ diff --git a/css/fonts/courier-logo.svg b/css/fonts/courier-logo.svg new file mode 100644 index 0000000..2aac8b7 --- /dev/null +++ b/css/fonts/courier-logo.svg @@ -0,0 +1,15 @@ + + + + + diff --git a/css/fonts/courier.eot b/css/fonts/courier.eot new file mode 100644 index 0000000..0caaa69 Binary files /dev/null and b/css/fonts/courier.eot differ diff --git a/css/fonts/courier.svg b/css/fonts/courier.svg new file mode 100644 index 0000000..576608d --- /dev/null +++ b/css/fonts/courier.svg @@ -0,0 +1,23 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/css/fonts/courier.ttf b/css/fonts/courier.ttf new file mode 100644 index 0000000..2346ca5 Binary files /dev/null and b/css/fonts/courier.ttf differ diff --git a/css/fonts/courier.woff b/css/fonts/courier.woff new file mode 100644 index 0000000..84d94c6 Binary files /dev/null and b/css/fonts/courier.woff differ diff --git a/css/fonts/courier.woff2 b/css/fonts/courier.woff2 new file mode 100644 index 0000000..fc033af Binary files /dev/null and b/css/fonts/courier.woff2 differ diff --git a/gulpfile.babel.js b/gulpfile.babel.js index c5c012b..afcb1ee 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -1,254 +1,77 @@ 'use strict'; -let gulp = require('gulp'); -let plugins = require('gulp-load-plugins'); -let yargs = require('yargs'); -let rimraf = require('rimraf'); -let yaml = require('js-yaml'); -let fs = require('fs'); -let webpackStream = require('webpack-stream'); -let webpack2 = require('webpack'); -let named = require('vinyl-named'); -let autoprefixer = require('autoprefixer'); -let through2 = require('through2'); -let sass = require('gulp-sass')(require('node-sass')); -// Load all Gulp plugins into one variable -const $ = plugins(); +const yargs = require('yargs'); +const { task, src, series, parallel, watch, dest } = require( 'gulp' ); +const fs = require( 'fs-extra' ) +const webpack = require( 'webpack-stream' ); +const uglify = require( 'gulp-uglify' ); +const gif = require( 'gulp-if' ); +const log = require( 'fancy-log' ); +const autoprefixer = require( 'autoprefixer' ); +const sourcemaps = require( 'gulp-sourcemaps' ); +const sass = require( 'gulp-sass' )( require('node-sass') ); -let PRODUCTION = !!(yargs.argv.production); // Check for --production flag -let VERSION_BUMP = yargs.argv.release; // Check for --release (x.x.x semver version number) +let config = {}; +let isProduction = !!( yargs.argv.production ); // Check for --production flag /** - * Load in additional config files - */ -const loadConfig = () => { - let ymlFile = fs.readFileSync('config.yml', 'utf8'); - return yaml.load(ymlFile); - -} - -// Load settings from settings.yml -const {COMPATIBILITY, PORT, UNCSS_OPTIONS, PATHS, LOCAL_PATH} = loadConfig(); - -let sassConfig = { - mode: (PRODUCTION ? true : false) -}; - -// Define default webpack object -let webpackConfig = { - mode: (PRODUCTION ? 'production' : 'development'), - module: { - rules: [ - { - test: /\.js$/, - use: { - loader: 'babel-loader', - options: { - presets: ["@babel/preset-env"], - compact: false - } - } - } - ] - }, - externals: { - jquery: 'jQuery', - }, - devtool: !PRODUCTION && 'source-map', - output: { - chunkLoading: false, - wasmLoading: false - } -}; - - -/** - * Set production mode during the build process + * Load our configuration from package.json * - * @param done - */ -const setProductionMode = ( done ) => { - PRODUCTION = false; - webpackConfig.mode = 'production'; - webpackConfig.devtool = false; - sassConfig.production = true; - done(); - -} - -/** - * This happens every time a build starts - * @since 1.0 + * @since 1.5.0 Updated to load config from package.json instead of config.yml * - * @param done - */ -const clean = ( done ) => { - rimraf('css', done); - rimraf('js', done); - - done(); -} - - -/** - * Create a README.MD file for github from the WordPress.org readme + * @since 1.0.0 * - * @since 1.0 + * @param done */ -const readme = ( done ) => { - return gulp.src([PATHS.readme]) - .pipe($.readmeToMarkdown({ - details: false, - screenshot_ext: ['jpg', 'jpg', 'png'], - extract: { - 'Frequently Asked Questions': 'FAQ' - } - })) - .pipe(gulp.dest('./') - ); +const loadConfig = ( done ) => { + + fs.readJson( './package.json' ) + .then( packageObj => { + config = packageObj.buildconfig; + config.webpack.mode = ( isProduction ? 'production' : 'development' ); + config.webpack.devtool = ! isProduction && 'source-map' + config.webpack.module.rules[0].use.options.compact = ( isProduction ) ? true : false; + done(); + }) + .catch( err => { + log(err); + done(); + } ); } /** - * Bump the version number within the define method of our plugin file - * PHP Constant: example `define( 'COURIER_NOTICES_PRO_VERSION', '1.0.0' );` - * - * Bump the version number within our meta data of the plugin file - * - * Update the release date with today's date + * Define our sass configuration * * @since 1.0 * - * @return {*} + * @type {{mode: (boolean)}} */ -const bumpPluginFile = ( done ) => { - - let constant = 'COURIER_NOTICES_VERSION'; - let define_bump_obj = { - key: constant, - regex: new RegExp('([<|\'|"]?(' + constant + ')[>|\'|"]?[ ]*[:=,]?[ ]*[\'|"]?[a-z]?)(\\d+.\\d+.\\d+)(-[0-9A-Za-z.-]+)?(\\+[0-9A-Za-z\\.-]+)?([\'|"|<]?)', 'ig') - }; - - let bump_obj = { - key: 'Version', - }; - - if ( VERSION_BUMP ) { - bump_obj.version = VERSION_BUMP; - define_bump_obj.version = VERSION_BUMP; - } - - let today = getReleaseDate(); - - return gulp.src('./courier-notices.php') - .pipe($.bump(bump_obj)) - .pipe($.bump(define_bump_obj)) - .pipe($.replace(/(((0)[0-9])|((1)[0-2]))(\/)([0-2][0-9]|(3)[0-1])(\/)\d{4}/ig, today)) - .pipe(through2.obj(function (file, enc, cb) { - let date = new Date(); - file.stat.atime = date; - file.stat.mtime = date; - cb(null, file); - })) - .pipe(gulp.dest('./')); -} +let sassConfig = { + mode: (isProduction ? true : false) +}; /** - * Update the what's new template with the date of the release instead of having to manually update it every release - * - * @since 1.0.4 - * - * @return {*} + * This happens every time a build starts. + * Cleanup our javascript folder. */ -const getReleaseDate = () => { - let today = new Date(); - let dd = String(today.getDate()).padStart(2, '0'); - let mm = String(today.getMonth() + 1).padStart(2, '0'); - let yyyy = today.getFullYear(); - - return mm + '/' + dd + '/' + yyyy; +const clean = ( done ) => { + fs.remove( 'js', done ); } -/** - * Bump the composer.json - * - * @since 1.0.4 - * - * @return {*} - */ -const bumpComposerJson = () => { - - let bump_obj = { - key: 'version' - }; - - if (VERSION_BUMP) { - bump_obj.version = VERSION_BUMP; - } - - return gulp.src('./' + PATHS.composer) - .pipe($.bump(bump_obj)) - .pipe(through2.obj(function (file, enc, cb) { - let date = new Date(); - file.stat.atime = date; - file.stat.mtime = date; - cb(null, file); - })) - .pipe(gulp.dest('.')); -} /** - * bump readme file stable tag to our latest version - * - * @since 1.0.4 + * Set production mode during the build process * - * @return {*} + * @param done */ -const bumpReadmeStableTag = () => { - - let bump_obj = {key: "Stable tag"}; - - if (VERSION_BUMP) { - bump_obj.version = VERSION_BUMP; - } - - return gulp.src('./' + PATHS.readme ) - .pipe($.bump(bump_obj)) - .pipe(through2.obj(function (file, enc, cb) { - let date = new Date(); - file.stat.atime = date; - file.stat.mtime = date; - cb(null, file); - })) - .pipe(gulp.dest('./')); +const setProductionMode = ( done ) => { + isProduction = false; + config.webpack.mode = 'production'; + config.webpack.devtool = false; + sassConfig.production = true; + done(); } -/** - * Bump the package.json - * - * @since 1.1 - * - * @return {*} - */ -const bumpPackageJson = () => { - - let bump_obj = { - key: 'version' - }; - - if (VERSION_BUMP) { - bump_obj.version = VERSION_BUMP; - } - - return gulp.src( './' + PATHS.package) - .pipe($.bump(bump_obj)) - .pipe(through2.obj(function (file, enc, cb) { - let date = new Date(); - file.stat.atime = date; - file.stat.mtime = date; - cb(null, file); - })) - .pipe(gulp.dest('.')); -} /** * Copy files out of the assets folder @@ -259,24 +82,24 @@ const bumpPackageJson = () => { * @return {*} */ const copy = () => { - return gulp.src(PATHS.assets) - .pipe(gulp.dest('css/fonts')); + return src( config.gulp.fonts.assets ).pipe( dest( config.gulp.fonts.dest ) ); } /** - * In production, the CSS is compressed + * Build our Sass into css + * When in production mode, compress and do not use sourcemaps * * @since 1.0 * * @return {*} */ const buildSass = () => { - return gulp.src(PATHS.sass) - .pipe($.sourcemaps.init()) - .pipe(sass({ - includePaths: PATHS.sass - }).on('error', sass.logError)) - .pipe(gulp.dest('css')); + return src( config.gulp.sass.assets ) + .pipe( sourcemaps.init() ) + .pipe( sass({ + includePaths: config.gulp.sass.assets + }).on('error', sass.logError ) ) + .pipe( dest( config.gulp.sass.dest ) ); } /** @@ -287,80 +110,67 @@ const buildSass = () => { * @return {*} */ const javascript = () => { - return gulp.src(PATHS.entries) - .pipe(named()) - .pipe($.sourcemaps.init()) - .pipe(webpackStream(webpackConfig, webpack2)) - .pipe($.if(PRODUCTION, $.uglify() - .on('error', e => { - console.log(e); - }) - )) - .pipe($.if(!PRODUCTION, $.sourcemaps.write())) - .pipe(gulp.dest('js')); + return src( config.gulp.javascript.assets, { sourcemaps: isProduction } ) + .pipe( webpack( config.webpack ) ) + .pipe( + gif( + isProduction, + uglify().on( 'error', console.log ) + ) ) + .pipe( dest( config.gulp.javascript.dest ) ); + } + /** - * Watch for changes to static assets + * Watch for changes to assets * Sass * JavaScript - * readme.txt * - * @since 1.1 + * @since 1.5.0 */ -const watch = () => { - gulp.watch( PATHS.readme , readme ); - gulp.watch( PATHS.sass ).on('all', buildSass ); - gulp.watch( PATHS.js ).on('all', gulp.series( javascript ) ); - gulp.watch( PATHS.assets, copy ); + +const watchChanges = () => { + watch( config.gulp.javascript.assets ).on( + 'all', + series( javascript ) + ); + + watch( config.gulp.sass.assets ).on( + 'all', + series( buildSass ) + ); + } -// Generate the changelog.md from the readme.txt -gulp.task( - 'readme', - gulp.series( - readme, - copy - ) -); -// Build the site, run the server, and watch for file changes -gulp.task( +/** + * Build the plugin, and watch for file changes. + */ +task( 'default', - gulp.series( + series( + loadConfig, clean, javascript, buildSass, copy, - gulp.parallel(watch) + parallel( watchChanges ) ) ); -// Build the "dist" folder by running all of the below tasks -// Sass must be run later so UnCSS can search for used classes in the others assets. -gulp.task( - 'build:release', - gulp.series( - setProductionMode, - clean, - javascript, - buildSass, - bumpPluginFile, - bumpPackageJson, - bumpReadmeStableTag, - bumpComposerJson, - readme, - copy - ) -); -// Build the "dist" folder by running all of the below tasks -gulp.task( +/** + * Build the distributed version of the plugin. + */ +task( 'build', - gulp.series( + series( + loadConfig, setProductionMode, clean, javascript, buildSass, + copy ) ); \ No newline at end of file diff --git a/js/courier-notices-admin.js b/js/courier-notices-admin.js index a31e07a..7684f8b 100644 --- a/js/courier-notices-admin.js +++ b/js/courier-notices-admin.js @@ -1,2211 +1 @@ -/******/ (function() { // webpackBootstrap -/******/ "use strict"; -/******/ var __webpack_modules__ = ({ - -/***/ "./assets/js/admin/core.js": -/*!*********************************!*\ - !*** ./assets/js/admin/core.js ***! - \*********************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ core; } -/* harmony export */ }); -/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); -/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); -/*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20 - * http://trentrichardson.com/examples/timepicker - * Copyright (c) 2016 Trent Richardson; Licensed MIT */ -!function (a) { - "function" == typeof define && __webpack_require__.amdO ? define(["jquery", "jquery-ui"], a) : a((jquery__WEBPACK_IMPORTED_MODULE_0___default())); -}(function ($) { - if ($.ui.timepicker = $.ui.timepicker || {}, !$.ui.timepicker.version) { - $.extend($.ui, { - timepicker: { - version: "1.6.3" - } - }); - - var Timepicker = function () { - this.regional = [], this.regional[""] = { - currentText: "Now", - closeText: "Done", - amNames: ["AM", "A"], - pmNames: ["PM", "P"], - timeFormat: "HH:mm", - timeSuffix: "", - timeOnlyTitle: "Choose Time", - timeText: "Time", - hourText: "Hour", - minuteText: "Minute", - secondText: "Second", - millisecText: "Millisecond", - microsecText: "Microsecond", - timezoneText: "Time Zone", - isRTL: !1 - }, this._defaults = { - showButtonPanel: !0, - timeOnly: !1, - timeOnlyShowDate: !1, - showHour: null, - showMinute: null, - showSecond: null, - showMillisec: null, - showMicrosec: null, - showTimezone: null, - showTime: !0, - stepHour: 1, - stepMinute: 1, - stepSecond: 1, - stepMillisec: 1, - stepMicrosec: 1, - hour: 0, - minute: 0, - second: 0, - millisec: 0, - microsec: 0, - timezone: null, - hourMin: 0, - minuteMin: 0, - secondMin: 0, - millisecMin: 0, - microsecMin: 0, - hourMax: 23, - minuteMax: 59, - secondMax: 59, - millisecMax: 999, - microsecMax: 999, - minDateTime: null, - maxDateTime: null, - maxTime: null, - minTime: null, - onSelect: null, - hourGrid: 0, - minuteGrid: 0, - secondGrid: 0, - millisecGrid: 0, - microsecGrid: 0, - alwaysSetTime: !0, - separator: " ", - altFieldTimeOnly: !0, - altTimeFormat: null, - altSeparator: null, - altTimeSuffix: null, - altRedirectFocus: !0, - pickerTimeFormat: null, - pickerTimeSuffix: null, - showTimepicker: !0, - timezoneList: null, - addSliderAccess: !1, - sliderAccessArgs: null, - controlType: "slider", - oneLine: !1, - defaultValue: null, - parse: "strict", - afterInject: null - }, $.extend(this._defaults, this.regional[""]); - }; - - $.extend(Timepicker.prototype, { - $input: null, - $altInput: null, - $timeObj: null, - inst: null, - hour_slider: null, - minute_slider: null, - second_slider: null, - millisec_slider: null, - microsec_slider: null, - timezone_select: null, - maxTime: null, - minTime: null, - hour: 0, - minute: 0, - second: 0, - millisec: 0, - microsec: 0, - timezone: null, - hourMinOriginal: null, - minuteMinOriginal: null, - secondMinOriginal: null, - millisecMinOriginal: null, - microsecMinOriginal: null, - hourMaxOriginal: null, - minuteMaxOriginal: null, - secondMaxOriginal: null, - millisecMaxOriginal: null, - microsecMaxOriginal: null, - ampm: "", - formattedDate: "", - formattedTime: "", - formattedDateTime: "", - timezoneList: null, - units: ["hour", "minute", "second", "millisec", "microsec"], - support: {}, - control: null, - setDefaults: function (a) { - return extendRemove(this._defaults, a || {}), this; - }, - _newInst: function ($input, opts) { - var tp_inst = new Timepicker(), - inlineSettings = {}, - fns = {}, - overrides, - i; - - for (var attrName in this._defaults) if (this._defaults.hasOwnProperty(attrName)) { - var attrValue = $input.attr("time:" + attrName); - if (attrValue) try { - inlineSettings[attrName] = eval(attrValue); - } catch (err) { - inlineSettings[attrName] = attrValue; - } - } - - overrides = { - beforeShow: function (a, b) { - return $.isFunction(tp_inst._defaults.evnts.beforeShow) ? tp_inst._defaults.evnts.beforeShow.call($input[0], a, b, tp_inst) : void 0; - }, - onChangeMonthYear: function (a, b, c) { - $.isFunction(tp_inst._defaults.evnts.onChangeMonthYear) && tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], a, b, c, tp_inst); - }, - onClose: function (a, b) { - tp_inst.timeDefined === !0 && "" !== $input.val() && tp_inst._updateDateTime(b), $.isFunction(tp_inst._defaults.evnts.onClose) && tp_inst._defaults.evnts.onClose.call($input[0], a, b, tp_inst); - } - }; - - for (i in overrides) overrides.hasOwnProperty(i) && (fns[i] = opts[i] || this._defaults[i] || null); - - tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, { - evnts: fns, - timepicker: tp_inst - }), tp_inst.amNames = $.map(tp_inst._defaults.amNames, function (a) { - return a.toUpperCase(); - }), tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (a) { - return a.toUpperCase(); - }), tp_inst.support = detectSupport(tp_inst._defaults.timeFormat + (tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : "") + (tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : "")), "string" == typeof tp_inst._defaults.controlType ? ("slider" === tp_inst._defaults.controlType && "undefined" == typeof $.ui.slider && (tp_inst._defaults.controlType = "select"), tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType]) : tp_inst.control = tp_inst._defaults.controlType; - var timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60, 0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840]; - null !== tp_inst._defaults.timezoneList && (timezoneList = tp_inst._defaults.timezoneList); - var tzl = timezoneList.length, - tzi = 0, - tzv = null; - if (tzl > 0 && "object" != typeof timezoneList[0]) for (; tzl > tzi; tzi++) tzv = timezoneList[tzi], timezoneList[tzi] = { - value: tzv, - label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) - }; - return tp_inst._defaults.timezoneList = timezoneList, tp_inst.timezone = null !== tp_inst._defaults.timezone ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) : -1 * new Date().getTimezoneOffset(), tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin : tp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour, tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin : tp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute, tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin : tp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second, tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin : tp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec, tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin ? tp_inst._defaults.microsecMin : tp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec, tp_inst.ampm = "", tp_inst.$input = $input, tp_inst._defaults.altField && (tp_inst.$altInput = $(tp_inst._defaults.altField), tp_inst._defaults.altRedirectFocus === !0 && tp_inst.$altInput.css({ - cursor: "pointer" - }).focus(function () { - $input.trigger("focus"); - })), (0 === tp_inst._defaults.minDate || 0 === tp_inst._defaults.minDateTime) && (tp_inst._defaults.minDate = new Date()), (0 === tp_inst._defaults.maxDate || 0 === tp_inst._defaults.maxDateTime) && (tp_inst._defaults.maxDate = new Date()), void 0 !== tp_inst._defaults.minDate && tp_inst._defaults.minDate instanceof Date && (tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime())), void 0 !== tp_inst._defaults.minDateTime && tp_inst._defaults.minDateTime instanceof Date && (tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime())), void 0 !== tp_inst._defaults.maxDate && tp_inst._defaults.maxDate instanceof Date && (tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime())), void 0 !== tp_inst._defaults.maxDateTime && tp_inst._defaults.maxDateTime instanceof Date && (tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime())), tp_inst.$input.bind("focus", function () { - tp_inst._onFocus(); - }), tp_inst; - }, - _addTimePicker: function (a) { - var b = $.trim(this.$altInput && this._defaults.altFieldTimeOnly ? this.$input.val() + " " + this.$altInput.val() : this.$input.val()); - this.timeDefined = this._parseTime(b), this._limitMinMaxDateTime(a, !1), this._injectTimePicker(), this._afterInject(); - }, - _parseTime: function (a, b) { - if (this.inst || (this.inst = $.datepicker._getInst(this.$input[0])), b || !this._defaults.timeOnly) { - var c = $.datepicker._get(this.inst, "dateFormat"); - - try { - var d = parseDateTimeInternal(c, this._defaults.timeFormat, a, $.datepicker._getFormatConfig(this.inst), this._defaults); - if (!d.timeObj) return !1; - $.extend(this, d.timeObj); - } catch (e) { - return $.timepicker.log("Error parsing the date/time string: " + e + "\ndate/time string = " + a + "\ntimeFormat = " + this._defaults.timeFormat + "\ndateFormat = " + c), !1; - } - - return !0; - } - - var f = $.datepicker.parseTime(this._defaults.timeFormat, a, this._defaults); - return f ? ($.extend(this, f), !0) : !1; - }, - _afterInject: function () { - var a = this.inst.settings; - $.isFunction(a.afterInject) && a.afterInject.call(this); - }, - _injectTimePicker: function () { - var a = this.inst.dpDiv, - b = this.inst.settings, - c = this, - d = "", - e = "", - f = null, - g = {}, - h = {}, - i = null, - j = 0, - k = 0; - - if (0 === a.find("div.ui-timepicker-div").length && b.showTimepicker) { - var l = " ui_tpicker_unit_hide", - m = '
' + b.timeText + '
"; - - for (j = 0, k = this.units.length; k > j; j++) { - if (d = this.units[j], e = d.substr(0, 1).toUpperCase() + d.substr(1), f = null !== b["show" + e] ? b["show" + e] : this.support[d], g[d] = parseInt(b[d + "Max"] - (b[d + "Max"] - b[d + "Min"]) % b["step" + e], 10), h[d] = 0, m += '
' + b[d + "Text"] + '
', f && b[d + "Grid"] > 0) { - if (m += '
', "hour" === d) for (var n = b[d + "Min"]; n <= g[d]; n += parseInt(b[d + "Grid"], 10)) { - h[d]++; - var o = $.datepicker.formatTime(this.support.ampm ? "hht" : "HH", { - hour: n - }, b); - m += '"; - } else for (var p = b[d + "Min"]; p <= g[d]; p += parseInt(b[d + "Grid"], 10)) h[d]++, m += '"; - m += "
' + o + "' + (10 > p ? "0" : "") + p + "
"; - } - - m += "
"; - } - - var q = null !== b.showTimezone ? b.showTimezone : this.support.timezone; - m += '
' + b.timezoneText + "
", m += '
', m += "
"; - var r = $(m); - - for (b.timeOnly === !0 && (r.prepend('
' + b.timeOnlyTitle + "
"), a.find(".ui-datepicker-header, .ui-datepicker-calendar").hide()), j = 0, k = c.units.length; k > j; j++) d = c.units[j], e = d.substr(0, 1).toUpperCase() + d.substr(1), f = null !== b["show" + e] ? b["show" + e] : this.support[d], c[d + "_slider"] = c.control.create(c, r.find(".ui_tpicker_" + d + "_slider"), d, c[d], b[d + "Min"], g[d], b["step" + e]), f && b[d + "Grid"] > 0 && (i = 100 * h[d] * b[d + "Grid"] / (g[d] - b[d + "Min"]), r.find(".ui_tpicker_" + d + " table").css({ - width: i + "%", - marginLeft: b.isRTL ? "0" : i / (-2 * h[d]) + "%", - marginRight: b.isRTL ? i / (-2 * h[d]) + "%" : "0", - borderCollapse: "collapse" - }).find("td").click(function (a) { - var b = $(this), - e = b.html(), - f = parseInt(e.replace(/[^0-9]/g), 10), - g = e.replace(/[^apm]/gi), - h = b.data("for"); - "hour" === h && (-1 !== g.indexOf("p") && 12 > f ? f += 12 : -1 !== g.indexOf("a") && 12 === f && (f = 0)), c.control.value(c, c[h + "_slider"], d, f), c._onTimeChange(), c._onSelectHandler(); - }).css({ - cursor: "pointer", - width: 100 / h[d] + "%", - textAlign: "center", - overflow: "hidden" - })); - - if (this.timezone_select = r.find(".ui_tpicker_timezone").append("").find("select"), $.fn.append.apply(this.timezone_select, $.map(b.timezoneList, function (a, b) { - return $("