v4.1.9: Начальная производственная версия
- Полный backend на Hono + TypeScript - SQLite база данных с 38 записями - 3 пользователя: admin, aknaproff, kasutaja - Модальное окно reportModal (4 шага) - Docker конфигурация для Synology ARM - Все миграции (0001-0017) - Frontend: vanilla HTML/JS (original.html)
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Handle Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
<IfModule mod_headers.c>
|
||||
Header set Access-Control-Allow-Origin 'origin-list'
|
||||
</IfModule>
|
||||
9
public/AKNAPROFF Tootmine_files/all.min.css
vendored
Executable file
9
public/AKNAPROFF Tootmine_files/all.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
2259
public/AKNAPROFF Tootmine_files/app.js
Executable file
2259
public/AKNAPROFF Tootmine_files/app.js
Executable file
File diff suppressed because it is too large
Load Diff
2
public/AKNAPROFF Tootmine_files/axios.min.js
vendored
Executable file
2
public/AKNAPROFF Tootmine_files/axios.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
83
public/AKNAPROFF Tootmine_files/saved_resource.js
Executable file
83
public/AKNAPROFF Tootmine_files/saved_resource.js
Executable file
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.3 KiB |
1224
public/index.html
Executable file
1224
public/index.html
Executable file
File diff suppressed because one or more lines are too long
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Contracts\Http\Kernel;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Check If The Application Is Under Maintenance
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If the application is in maintenance / demo mode via the "down" command
|
||||
| we will load this file so that any pre-rendered content can be shown
|
||||
| instead of starting the framework, which could cause an exception.
|
||||
|
|
||||
*/
|
||||
|
||||
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
|
||||
require $maintenance;
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register The Auto Loader
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Composer provides a convenient, automatically generated class loader for
|
||||
| this application. We just need to utilize it! We'll simply require it
|
||||
| into the script here so we don't need to manually load our classes.
|
||||
|
|
||||
*/
|
||||
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Once we have the application, we can handle the incoming request using
|
||||
| the application's HTTP kernel. Then, we will send the response back
|
||||
| to this client's browser, allowing them to enjoy our application.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
$kernel = $app->make(Kernel::class);
|
||||
|
||||
$response = $kernel->handle(
|
||||
$request = Request::capture()
|
||||
)->send();
|
||||
|
||||
$kernel->terminate($request, $response);
|
||||
@@ -1,233 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<link rel="icon" href="../../favicon.ico">
|
||||
|
||||
<title>Doing some pre-installation checkup...</title>
|
||||
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<br/>
|
||||
<div class="jumbotron">
|
||||
|
||||
<center>
|
||||
<h2>Doing some pre-installation checkup...</h2><br/>
|
||||
</center>
|
||||
|
||||
<?php
|
||||
$all_ok = true;
|
||||
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http')."://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||
if (strpos($actual_link, 'install/index.php') !== false) {
|
||||
$install_link = str_replace('install/index.php', 'install-start', $actual_link);
|
||||
$alternative_link = str_replace('install/index.php', 'index.php/install-start', $actual_link);
|
||||
} else {
|
||||
$install_link = str_replace('install/', 'install-start', $actual_link);
|
||||
$alternative_link = str_replace('install/', 'index.php/install-start', $actual_link);
|
||||
}
|
||||
|
||||
//Check for php version
|
||||
$checks = [];
|
||||
$checks['php'] = (PHP_MAJOR_VERSION >= 8 && PHP_MINOR_VERSION >= 1) ? true : false;
|
||||
$checks['php_version'] = PHP_VERSION;
|
||||
|
||||
//Check for php extensions
|
||||
$checks['openssl'] = extension_loaded('openssl') ? true : false;
|
||||
$checks['pdo'] = extension_loaded('pdo') ? true : false;
|
||||
$checks['mbstring'] = extension_loaded('mbstring') ? true : false;
|
||||
$checks['tokenizer'] = extension_loaded('tokenizer') ? true : false;
|
||||
$checks['xml'] = extension_loaded('xml') ? true : false;
|
||||
$checks['curl'] = extension_loaded('curl') ? true : false;
|
||||
$checks['zip'] = extension_loaded('zip') ? true : false;
|
||||
$checks['gd'] = extension_loaded('gd') ? true : false;
|
||||
?>
|
||||
|
||||
<div>
|
||||
<table class="table">
|
||||
|
||||
<tr>
|
||||
<td>PHP >= 8.1</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($checks['php']) {
|
||||
echo "<i class='glyphicon glyphicon-ok text-success' aria-hidden='true'></i>";
|
||||
} else {
|
||||
echo "<i class='glyphicon glyphicon-remove text-danger' aria-hidden='true'></i>";
|
||||
$all_ok = false;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OpenSSL PHP Extension</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($checks['openssl']) {
|
||||
echo "<i class='glyphicon glyphicon-ok text-success' aria-hidden='true'></i>";
|
||||
} else {
|
||||
echo "<i class='glyphicon glyphicon-remove text-danger' aria-hidden='true'></i>";
|
||||
$all_ok = false;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PDO PHP Extension</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($checks['pdo']) {
|
||||
echo "<i class='glyphicon glyphicon-ok text-success' aria-hidden='true'></i>";
|
||||
} else {
|
||||
echo "<i class='glyphicon glyphicon-remove text-danger' aria-hidden='true'></i>";
|
||||
$all_ok = false;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mbstring PHP Extension</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($checks['mbstring']) {
|
||||
echo "<i class='glyphicon glyphicon-ok text-success' aria-hidden='true'></i>";
|
||||
} else {
|
||||
echo "<i class='glyphicon glyphicon-remove text-danger' aria-hidden='true'></i>";
|
||||
$all_ok = false;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Tokenizer PHP Extension</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($checks['tokenizer']) {
|
||||
echo "<i class='glyphicon glyphicon-ok text-success' aria-hidden='true'></i>";
|
||||
} else {
|
||||
echo "<i class='glyphicon glyphicon-remove text-danger' aria-hidden='true'></i>";
|
||||
$all_ok = false;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>XML PHP Extension</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($checks['xml']) {
|
||||
echo "<i class='glyphicon glyphicon-ok text-success' aria-hidden='true'></i>";
|
||||
} else {
|
||||
echo "<i class='glyphicon glyphicon-remove text-danger' aria-hidden='true'></i>";
|
||||
$all_ok = false;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cURL PHP Extension</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($checks['curl']) {
|
||||
echo "<i class='glyphicon glyphicon-ok text-success' aria-hidden='true'></i>";
|
||||
} else {
|
||||
echo "<i class='glyphicon glyphicon-remove text-danger' aria-hidden='true'></i>";
|
||||
$all_ok = false;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>zip PHP Extension</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($checks['zip']) {
|
||||
echo "<i class='glyphicon glyphicon-ok text-success' aria-hidden='true'></i>";
|
||||
} else {
|
||||
echo "<i class='glyphicon glyphicon-remove text-danger' aria-hidden='true'></i>";
|
||||
$all_ok = false;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>gd PHP Extension</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($checks['gd']) {
|
||||
echo "<i class='glyphicon glyphicon-ok text-success' aria-hidden='true'></i>";
|
||||
} else {
|
||||
echo "<i class='glyphicon glyphicon-remove text-danger' aria-hidden='true'></i>";
|
||||
$all_ok = false;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-6">
|
||||
<?php
|
||||
$storage_path = realpath(__DIR__.'/../../storage/');
|
||||
$log_path = realpath(__DIR__.'/../../storage/logs/');
|
||||
$framework = realpath(__DIR__.'/../../storage/framework/');
|
||||
$is_writable_storage = is_writable($storage_path) && is_writable($log_path) && is_writable($framework);
|
||||
|
||||
$cache_path = realpath(__DIR__.'/../../bootstrap/cache');
|
||||
$is_writable_cache = is_writable($cache_path)
|
||||
?>
|
||||
Directories are writable?
|
||||
</td>
|
||||
<td class="col-md-6">
|
||||
<?php
|
||||
if ($is_writable_storage && $is_writable_cache) {
|
||||
echo "<i class='glyphicon glyphicon-ok text-success' aria-hidden='true'></i>";
|
||||
} else {
|
||||
echo "<i class='glyphicon glyphicon-remove text-danger' aria-hidden='true'></i>";
|
||||
|
||||
if (! $is_writable_storage) {
|
||||
echo "<br/>- The application is not able to write, Please provide writable(recursive) permission to <code>$storage_path</code>";
|
||||
}
|
||||
|
||||
if (! $is_writable_cache) {
|
||||
echo "<br/>- Please provide writable permission to <code>$cache_path</code>";
|
||||
}
|
||||
|
||||
$all_ok = false;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<center>
|
||||
<br/><br/><br/>
|
||||
<p>
|
||||
<?php
|
||||
if ($all_ok) {
|
||||
echo "<span class='text-success'>All setting looks correct. Go to <a target='_blank' href=$install_link>next step</a></span>";
|
||||
echo "<br/><br/>";
|
||||
echo "<span class=''>Next step alternative url if above link don't work. <a target='_blank' href=$alternative_link>Alternative Link</a></span>";
|
||||
} else {
|
||||
echo "<span class='text-danger'>Some setting are incorrect. Correct it and then refresh this page</span>";
|
||||
}
|
||||
|
||||
echo "<br/><br/><br/>";
|
||||
echo "<strong class=''>💫 Book Installation Service <a target='_blank' href='https://ultimatefosters.com/product/installation-update-service/'>Installation Service</a></strong><br/><small><i>👉 Get installed by expert engineer within 24 hours</i><small>";
|
||||
|
||||
?>
|
||||
</p>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,116 +0,0 @@
|
||||
/*! CountdownTimer for jQuery @version2.0.0 (https://harshen.github.io/jQuery-countdownTimer/).
|
||||
* Written by Harshen Pandey (https://remote.com/harshen) January 2014.
|
||||
* @license MIT (https://github.com/harshen/jQuery-countdownTimer/blob/master/LICENSE.md)
|
||||
* and GPLv3 (https://github.com/harshen/jQuery-countdownTimer/blob/master/LICENSE-GPL.md).
|
||||
* @release - 27/10/2017
|
||||
* Copyright (c) 2017 - 2020 Harshen Pandey
|
||||
* Please attribute the author if you use it.
|
||||
*/
|
||||
/* jQuery.countdownTimer.css*/
|
||||
|
||||
.style {
|
||||
width: 100%;
|
||||
font-family: sans-serif;
|
||||
font-weight: bold;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.colorDefinition {
|
||||
background: #000000;
|
||||
color : #FFFFFF;
|
||||
border-color: #F0068E;
|
||||
}
|
||||
|
||||
.size_xl {
|
||||
font-size:50px;
|
||||
border-width: 8px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.size_lg {
|
||||
font-size:40px;
|
||||
border-width: 7px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.size_md {
|
||||
font-size:30px;
|
||||
border-width: 5px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.size_sm {
|
||||
font-size:20px;
|
||||
border-width: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.size_xs {
|
||||
font-size:15px;
|
||||
border-width: 2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.lang-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.displaySection {
|
||||
display: block;
|
||||
float: left;
|
||||
font-size: 75%;
|
||||
text-align: center;
|
||||
border-right: 5px solid #F0068E;
|
||||
}
|
||||
|
||||
.timerDisplay > span.displaySection:last-child {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.label6 .displaySection {
|
||||
width: 15%;
|
||||
}
|
||||
|
||||
.label5 .displaySection {
|
||||
width: 18%;
|
||||
}
|
||||
|
||||
.label4 .displaySection {
|
||||
width: 23.5%;
|
||||
}
|
||||
|
||||
.label3 .displaySection {
|
||||
width: 31.8%;
|
||||
}
|
||||
|
||||
.label2 .displaySection {
|
||||
width: 48.6%;
|
||||
}
|
||||
|
||||
.label1 .displaySection {
|
||||
width: 98%;
|
||||
}
|
||||
|
||||
.numberDisplay {
|
||||
font-size: 200%;
|
||||
}
|
||||
|
||||
.periodDisplay {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.timerDisplay {
|
||||
clear: both;
|
||||
width: 100%;
|
||||
padding: 8px 4px;
|
||||
text-align: center;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.labelformat {
|
||||
float: left;
|
||||
width: 350px;
|
||||
font-size: 15px;
|
||||
border-width: 7px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
@@ -1,728 +0,0 @@
|
||||
/*! CountdownTimer for jQuery @version2.0.0 (https://harshen.github.io/jQuery-countdownTimer/).
|
||||
* Written by Harshen Pandey (https://remote.com/harshen) January 2014.
|
||||
* @license MIT (https://github.com/harshen/jQuery-countdownTimer/blob/master/LICENSE.md)
|
||||
* and GPLv3 (https://github.com/harshen/jQuery-countdownTimer/blob/master/LICENSE-GPL.md).
|
||||
* @release - 27/10/2017
|
||||
* Copyright (c) 2017 - 2020 Harshen Pandey
|
||||
* Please attribute the author if you use it.
|
||||
*/
|
||||
/* jQuery.countdownTimer.js*/
|
||||
|
||||
(function($) {
|
||||
"use strict";
|
||||
|
||||
var methods = {
|
||||
init: function(options) {
|
||||
return this.each(function() {
|
||||
countdown($(this), options);
|
||||
});
|
||||
},
|
||||
destroy: function() {
|
||||
this.data('countdowntimer', $.extend(true, {}, $.fn.countdowntimer.defaults, {
|
||||
destroy: true
|
||||
}));
|
||||
},
|
||||
pause: function(options) {
|
||||
this.data('countdowntimer', $.extend(true, {}, $.fn.countdowntimer.defaults, {
|
||||
pause: options
|
||||
}));
|
||||
pauseTimer($(this), $(this).data('typefunc').type, $(this).data('opts').opts, $(this).data('typefunc').func);
|
||||
},
|
||||
stop: function(options) {
|
||||
this.data('countdowntimer', $.extend(true, {}, $.fn.countdowntimer.defaults, {
|
||||
stop: options
|
||||
}));
|
||||
stopTimer($(this), $(this).data('typefunc').type, $(this).data('opts').opts, $(this).data('typefunc').func);
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.countdowntimer = function(methodOrOptions) {
|
||||
if (methods[methodOrOptions]) {
|
||||
return methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
} else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
|
||||
this.data('countdowntimer', $.extend(true, {}, $.fn.countdowntimer.defaults, methodOrOptions));
|
||||
return methods.init.apply(this, arguments);
|
||||
} else {
|
||||
$.error('Method ' + methodOrOptions + ' does not exist on jQuery.countdownTimer');
|
||||
}
|
||||
};
|
||||
|
||||
//Definition of private function countdown.
|
||||
function countdown($this, options) {
|
||||
var opts = $.extend({}, $.fn.countdowntimer.defaults, options);
|
||||
$.extend(true, opts, $.fn.countdowntimer.regionalOptions, options);
|
||||
$this.data('opts', {
|
||||
opts: opts
|
||||
});
|
||||
$this.addClass("style");
|
||||
var size = opts.size;
|
||||
var borderColor = opts.borderColor;
|
||||
var fontColor = opts.fontColor;
|
||||
var backgroundColor = opts.backgroundColor;
|
||||
if (options.regexpMatchFormat !== undefined && options.regexpReplaceWith !== undefined && options.timeSeparator === undefined && options.labelsFormat === undefined) {
|
||||
window['regexpMatchFormat_' + $this.attr('id')] = options.regexpMatchFormat;
|
||||
window['regexpReplaceWith_' + $this.attr('id')] = options.regexpReplaceWith;
|
||||
}
|
||||
if (options.displayFormat !== undefined) {
|
||||
var format = [];
|
||||
format[0] = (opts.displayFormat.match('Y') ? '!' : '#');
|
||||
format[1] = (opts.displayFormat.match('O') ? '!' : '#');
|
||||
format[2] = (opts.displayFormat.match('D') ? '!' : '#');
|
||||
format[3] = (opts.displayFormat.match('H') ? '!' : '#');
|
||||
format[4] = (opts.displayFormat.match('M') ? '!' : '#');
|
||||
format[5] = (opts.displayFormat.match('S') ? '!' : '#');
|
||||
opts.displayFormat = format.join('');
|
||||
} else {
|
||||
opts.displayFormat = "###!!!";
|
||||
}
|
||||
if (options.borderColor !== undefined || options.fontColor !== undefined || options.backgroundColor !== undefined) {
|
||||
var customStyle = {
|
||||
"background": backgroundColor,
|
||||
"color": fontColor,
|
||||
"border-color": borderColor
|
||||
};
|
||||
$this.css(customStyle);
|
||||
} else {
|
||||
$this.addClass("colorDefinition");
|
||||
}
|
||||
if (opts.labelsFormat === false) {
|
||||
if (options.size !== undefined) {
|
||||
switch (size) {
|
||||
case "xl":
|
||||
$this.addClass("size_xl");
|
||||
break;
|
||||
case "lg":
|
||||
$this.addClass("size_lg");
|
||||
break;
|
||||
case "md":
|
||||
$this.addClass("size_md");
|
||||
break;
|
||||
case "sm":
|
||||
$this.addClass("size_sm");
|
||||
break;
|
||||
case "xs":
|
||||
$this.addClass("size_xs");
|
||||
break;
|
||||
}
|
||||
} else if (size === "sm") {
|
||||
$this.addClass("size_sm");
|
||||
}
|
||||
}
|
||||
if (opts.isRTL === true) {
|
||||
$this.addClass("lang-rtl");
|
||||
}
|
||||
if (options.startDate === undefined && options.dateAndTime === undefined && options.currentTime === undefined && (options.hours !== undefined || options.minutes !== undefined || options.seconds !== undefined)) {
|
||||
if (options.hours !== undefined && options.minutes === undefined && options.seconds === undefined) {
|
||||
setTimerInterval($this, "H", opts, onlyHours, options);
|
||||
} else if (options.hours === undefined && options.minutes !== undefined && options.seconds === undefined) {
|
||||
setTimerInterval($this, "M", opts, onlyMinutes, options);
|
||||
} else if (options.hours === undefined && options.minutes === undefined && options.seconds !== undefined) {
|
||||
setTimerInterval($this, "S", opts, onlySeconds, options);
|
||||
} else if (options.hours !== undefined && options.minutes !== undefined && options.seconds === undefined) {
|
||||
setTimerInterval($this, "HM", opts, hoursMinutes, options);
|
||||
} else if (options.hours === undefined && options.minutes !== undefined && options.seconds !== undefined) {
|
||||
setTimerInterval($this, "MS", opts, minutesSeconds, options);
|
||||
} else if (options.hours !== undefined && options.minutes === undefined && options.seconds !== undefined) {
|
||||
setTimerInterval($this, "HS", opts, hoursSeconds, options);
|
||||
} else if (options.hours !== undefined && options.minutes !== undefined && options.seconds !== undefined) {
|
||||
setTimerInterval($this, "HMS", opts, hoursMinutesSeconds, options);
|
||||
}
|
||||
} else if (options.startDate !== undefined && options.dateAndTime !== undefined && options.currentTime === undefined) {
|
||||
window['startDate' + $this.attr('id')] = new Date(opts.startDate);
|
||||
window['endDate' + $this.attr('id')] = (opts.timeZone !== null ? setTimezone(new Date(opts.dateAndTime), opts.timeZone) : new Date(opts.dateAndTime));
|
||||
var typeStart = "withStart";
|
||||
if (options.beforeExpiryTime !== undefined) {
|
||||
window['beforeExpiry_' + typeStart + $this.attr('id')] = opts.beforeExpiryTime;
|
||||
}
|
||||
givenDate($this, opts, typeStart);
|
||||
window['timer_startDate' + $this.attr('id')] = setInterval(function() {
|
||||
givenDate($this, opts, typeStart);
|
||||
}, opts.tickInterval * 1000);
|
||||
} else if (options.startDate === undefined && options.dateAndTime !== undefined && options.currentTime === undefined) {
|
||||
var hour = opts.startDate.getHours();
|
||||
var minutes = opts.startDate.getMinutes();
|
||||
var seconds = opts.startDate.getSeconds();
|
||||
var month = (opts.startDate.getMonth() + 1);
|
||||
var date = opts.startDate.getDate();
|
||||
var year = opts.startDate.getFullYear();
|
||||
var timeStart = new Date(year + '/' + month + '/' + date + ' ' + hour + ':' + minutes + ':' + seconds);
|
||||
window['startTime' + $this.attr('id')] = timeStart;
|
||||
window['dateTime' + $this.attr('id')] = (opts.timeZone !== null ? setTimezone(new Date(opts.dateAndTime), opts.timeZone) : new Date(opts.dateAndTime));
|
||||
var typeNostart = "withnoStart";
|
||||
if (options.beforeExpiryTime !== undefined) {
|
||||
window['beforeExpiry_' + typeNostart + $this.attr('id')] = opts.beforeExpiryTime;
|
||||
}
|
||||
givenDate($this, opts, typeNostart);
|
||||
window['timer_givenDate' + $this.attr('id')] = setInterval(function() {
|
||||
givenDate($this, opts, typeNostart);
|
||||
}, opts.tickInterval * 1000);
|
||||
} else if (options.currentTime !== undefined && opts.currentTime === true) {
|
||||
currentDate($this, opts);
|
||||
window['timer_currentDate' + $this.attr('id')] = setInterval(function() {
|
||||
currentDate($this, opts);
|
||||
}, opts.tickInterval * 1000);
|
||||
} else {
|
||||
window['countSeconds' + $this.attr('id')] = opts.seconds;
|
||||
secondsTimer($this, opts);
|
||||
window['timer_secondsTimer' + $this.attr('id')] = setInterval(function() {
|
||||
secondsTimer($this, opts);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function setTimerInterval($this, timerType, opts, funcName, options) {
|
||||
$this.data('typefunc', {
|
||||
type: timerType,
|
||||
func: funcName
|
||||
});
|
||||
window['hours_' + timerType + $this.attr('id')] = opts.hours;
|
||||
window['minutes_' + timerType + $this.attr('id')] = opts.minutes;
|
||||
window['seconds_' + timerType + $this.attr('id')] = opts.seconds;
|
||||
if (options.beforeExpiryTime !== undefined) {
|
||||
window['beforeExpiry_' + timerType + $this.attr('id')] = opts.beforeExpiryTime;
|
||||
}
|
||||
if (options.pauseButton !== undefined) {
|
||||
pauseTimer($this, timerType, opts, funcName);
|
||||
}
|
||||
if (options.stopButton !== undefined) {
|
||||
stopTimer($this, timerType, opts, funcName);
|
||||
}
|
||||
funcName($this, opts);
|
||||
window['timer_' + timerType + $this.attr('id')] = setInterval(function() {
|
||||
funcName($this, opts);
|
||||
}, opts.tickInterval * 1000);
|
||||
}
|
||||
|
||||
function setTimezone(datetime, offset) {
|
||||
var newTime = (new Date((datetime.getTime() + (datetime.getTimezoneOffset() * 60000)) + (60000 * (Math.abs(offset) < 30 ? offset * 60 : offset))));
|
||||
return newTime;
|
||||
}
|
||||
|
||||
//Function for only hours are set when invoking plugin.
|
||||
function onlyHours($this, opts) {
|
||||
var id = $this.attr('id');
|
||||
var time = "";
|
||||
if (window['minutes_H' + id] === opts.minutes && window['seconds_H' + id] === opts.seconds && window['hours_H' + id] === opts.hours) {
|
||||
time = prepareTime($this, opts, 0, 0, 0, window['hours_H' + id], 0, 0);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_H' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'H');
|
||||
}
|
||||
window['seconds_H' + id] = 60 - opts.tickInterval;
|
||||
window['minutes_H' + id] = 59;
|
||||
if (window['hours_H' + id] !== 0) {
|
||||
window['hours_H' + id]--;
|
||||
} else {
|
||||
clearTimerInterval($this, "H", opts);
|
||||
}
|
||||
if ($this.data('countdowntimer').destroy === true) clearTimerInterval($this, "H", opts);
|
||||
} else {
|
||||
time = prepareTime($this, opts, 0, 0, 0, window['hours_H' + id], window['minutes_H' + id], window['seconds_H' + id]);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_H' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'H');
|
||||
}
|
||||
window['seconds_H' + id] -= opts.tickInterval;
|
||||
if (window['minutes_H' + id] !== 0 && window['seconds_H' + id] < 0) {
|
||||
window['minutes_H' + id]--;
|
||||
window['seconds_H' + id] = 60 - opts.tickInterval;
|
||||
}
|
||||
if (window['minutes_H' + id] === 0 && window['seconds_H' + id] < 0 && window['hours_H' + id] !== 0) {
|
||||
window['hours_H' + id]--;
|
||||
window['minutes_H' + id] = 59;
|
||||
window['seconds_H' + id] = 60 - opts.tickInterval;
|
||||
}
|
||||
if ((window['minutes_H' + id] === 0 && window['seconds_H' + id] < 0 && window['hours_H' + id] === 0) || $this.data('countdowntimer').destroy === true) {
|
||||
clearTimerInterval($this, "H", opts);
|
||||
}
|
||||
}
|
||||
id = null;
|
||||
}
|
||||
|
||||
//Function for only minutes are set when invoking plugin.
|
||||
function onlyMinutes($this, opts) {
|
||||
var id = $this.attr('id');
|
||||
var time = "";
|
||||
if (window['minutes_M' + id] === opts.minutes && window['seconds_M' + id] === opts.seconds) {
|
||||
time = prepareTime($this, opts, 0, 0, 0, 0, window['minutes_M' + id], 0);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_M' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'M');
|
||||
}
|
||||
window['seconds_M' + id] = 60 - opts.tickInterval;
|
||||
if (window['minutes_M' + id] !== 0) {
|
||||
window['minutes_M' + id]--;
|
||||
} else {
|
||||
clearTimerInterval($this, "M", opts);
|
||||
}
|
||||
if ($this.data('countdowntimer').destroy === true) clearTimerInterval($this, "M", opts);
|
||||
} else {
|
||||
time = prepareTime($this, opts, 0, 0, 0, 0, window['minutes_M' + id], window['seconds_M' + id]);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_M' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'M');
|
||||
}
|
||||
window['seconds_M' + id] -= opts.tickInterval;
|
||||
if (window['minutes_M' + id] !== 0 && window['seconds_M' + id] < 0) {
|
||||
window['minutes_M' + id]--;
|
||||
window['seconds_M' + id] = 60 - opts.tickInterval;
|
||||
}
|
||||
if ((window['minutes_M' + id] === 0 && window['seconds_M' + id] < 0) || $this.data('countdowntimer').destroy === true) {
|
||||
clearTimerInterval($this, "M", opts);
|
||||
}
|
||||
}
|
||||
id = null;
|
||||
}
|
||||
|
||||
//Function for only seconds are set when invoking plugin.
|
||||
function onlySeconds($this, opts) {
|
||||
var id = $this.attr('id');
|
||||
var time = "";
|
||||
time = prepareTime($this, opts, 0, 0, 0, 0, 0, window['seconds_S' + id]);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_S' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'S');
|
||||
}
|
||||
window['seconds_S' + id] -= opts.tickInterval;
|
||||
if ((window['seconds_S' + id] < 0) || ($this.data('countdowntimer').destroy === true)) {
|
||||
clearTimerInterval($this, "S", opts);
|
||||
}
|
||||
id = null;
|
||||
}
|
||||
|
||||
//Function for hours and minutes are set when invoking plugin.
|
||||
function hoursMinutes($this, opts) {
|
||||
var id = $this.attr('id');
|
||||
var time = "";
|
||||
if (window['minutes_HM' + id] === opts.minutes && window['hours_HM' + id] === opts.hours) {
|
||||
time = prepareTime($this, opts, 0, 0, 0, window['hours_HM' + id], window['minutes_HM' + id], 0);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_HM' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'HM');
|
||||
}
|
||||
if (window['hours_HM' + id] !== 0 && window['minutes_HM' + id] === 0) {
|
||||
window['hours_HM' + id]--;
|
||||
window['minutes_HM' + id] = 59;
|
||||
window['seconds_HM' + id] = 60 - opts.tickInterval;
|
||||
} else if (window['hours_HM' + id] === 0 && window['minutes_HM' + id] !== 0) {
|
||||
window['seconds_HM' + id] = 60 - opts.tickInterval;
|
||||
window['minutes_HM' + id]--;
|
||||
} else {
|
||||
window['seconds_HM' + id] = 60 - opts.tickInterval;
|
||||
window['minutes_HM' + id]--;
|
||||
}
|
||||
if (window['hours_HM' + id] === 0 && window['minutes_HM' + id] === 0 && window['seconds_HM' + id] == 60) {
|
||||
clearTimerInterval($this, "HM", opts);
|
||||
}
|
||||
if ($this.data('countdowntimer').destroy === true) clearTimerInterval($this, "HM", opts);
|
||||
} else {
|
||||
time = prepareTime($this, opts, 0, 0, 0, window['hours_HM' + id], window['minutes_HM' + id], window['seconds_HM' + id]);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_HM' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'HM');
|
||||
}
|
||||
window['seconds_HM' + id] -= opts.tickInterval;
|
||||
if (window['minutes_HM' + id] !== 0 && window['seconds_HM' + id] < 0) {
|
||||
window['minutes_HM' + id]--;
|
||||
window['seconds_HM' + id] = 60 - opts.tickInterval;
|
||||
}
|
||||
if (window['minutes_HM' + id] === 0 && window['seconds_HM' + id] < 0 && window['hours_HM' + id] !== 0) {
|
||||
window['hours_HM' + id]--;
|
||||
window['minutes_HM' + id] = 59;
|
||||
window['seconds_HM' + id] = 60 - opts.tickInterval;
|
||||
}
|
||||
if ((window['minutes_HM' + id] === 0 && window['seconds_HM' + id] < 0 && window['hours_HM' + id] === 0) || $this.data('countdowntimer').destroy === true) {
|
||||
clearTimerInterval($this, "HM", opts);
|
||||
}
|
||||
}
|
||||
id = null;
|
||||
}
|
||||
|
||||
//Function for minutes and seconds are set when invoking plugin.
|
||||
function minutesSeconds($this, opts) {
|
||||
var id = $this.attr('id');
|
||||
var time = "";
|
||||
if (window['minutes_MS' + id] === opts.minutes && window['seconds_MS' + id] === opts.seconds) {
|
||||
time = prepareTime($this, opts, 0, 0, 0, 0, window['minutes_MS' + id], window['seconds_MS' + id]);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_MS' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'MS');
|
||||
}
|
||||
if (window['minutes_MS' + id] !== 0 && window['seconds_MS' + id] === 0) {
|
||||
window['minutes_MS' + id]--;
|
||||
window['seconds_MS' + id] = 60 - opts.tickInterval;
|
||||
} else if (window['minutes_MS' + id] === 0 && window['seconds_MS' + id] === 0) {
|
||||
clearTimerInterval($this, "MS", opts);
|
||||
} else {
|
||||
window['seconds_MS' + id] -= opts.tickInterval;
|
||||
}
|
||||
if ($this.data('countdowntimer').destroy === true) clearTimerInterval($this, "MS", opts);
|
||||
} else {
|
||||
time = prepareTime($this, opts, 0, 0, 0, 0, window['minutes_MS' + id], window['seconds_MS' + id]);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_MS' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'MS');
|
||||
}
|
||||
window['seconds_MS' + id] -= opts.tickInterval;
|
||||
if (window['minutes_MS' + id] !== 0 && window['seconds_MS' + id] < 0) {
|
||||
window['minutes_MS' + id]--;
|
||||
window['seconds_MS' + id] = 60 - opts.tickInterval;
|
||||
}
|
||||
if ((window['minutes_MS' + id] === 0 && window['seconds_MS' + id] < 0) || $this.data('countdowntimer').destroy === true) {
|
||||
clearTimerInterval($this, "MS", opts);
|
||||
}
|
||||
}
|
||||
id = null;
|
||||
}
|
||||
|
||||
//Function for hours and seconds are set when invoking plugin.
|
||||
function hoursSeconds($this, opts) {
|
||||
var id = $this.attr('id');
|
||||
var time = "";
|
||||
if (window['seconds_HS' + id] === opts.seconds && window['hours_HS' + id] === opts.hours) {
|
||||
time = prepareTime($this, opts, 0, 0, 0, window['hours_HS' + id], 0, window['seconds_HS' + id]);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_HS' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'HS');
|
||||
}
|
||||
if (window['hours_HS' + id] === 0 && window['seconds_HS' + id] === 0) {
|
||||
clearTimerInterval($this, "HS", opts);
|
||||
} else if (window['hours_HS' + id] !== 0 && window['seconds_HS' + id] === 0) {
|
||||
window['hours_HS' + id]--;
|
||||
window['minutes_HS' + id] = 59;
|
||||
window['seconds_HS' + id] = 60 - opts.tickInterval;
|
||||
} else {
|
||||
window['seconds_HS' + id] -= opts.tickInterval;
|
||||
}
|
||||
if ($this.data('countdowntimer').destroy === true) clearTimerInterval($this, "HS", opts);
|
||||
} else {
|
||||
time = prepareTime($this, opts, 0, 0, 0, window['hours_HS' + id], window['minutes_HS' + id], window['seconds_HS' + id]);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_HS' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'HS');
|
||||
}
|
||||
window['seconds_HS' + id] -= opts.tickInterval;
|
||||
if (window['minutes_HS' + id] !== 0 && window['seconds_HS' + id] < 0) {
|
||||
window['minutes_HS' + id]--;
|
||||
window['seconds_HS' + id] = 60 - opts.tickInterval;
|
||||
}
|
||||
if (window['minutes_HS' + id] === 0 && window['seconds_HS' + id] < 0 && window['hours_HS' + id] !== 0) {
|
||||
window['hours_HS' + id]--;
|
||||
window['minutes_HS' + id] = 59;
|
||||
window['seconds_HS' + id] = 60 - opts.tickInterval;
|
||||
}
|
||||
if ((window['minutes_HS' + id] === 0 && window['seconds_HS' + id] < 0 && window['hours_HS' + id] === 0) || $this.data('countdowntimer').destroy === true) {
|
||||
clearTimerInterval($this, "HS", opts);
|
||||
}
|
||||
}
|
||||
id = null;
|
||||
}
|
||||
|
||||
//Function for hours, minutes and seconds are set when invoking plugin.
|
||||
function hoursMinutesSeconds($this, opts) {
|
||||
var id = $this.attr('id');
|
||||
var time = "";
|
||||
if (window['minutes_HMS' + id] === opts.minutes && window['seconds_HMS' + id] === opts.seconds && window['hours_HMS' + id] === opts.hours) {
|
||||
time = prepareTime($this, opts, 0, 0, 0, window['hours_HMS' + id], window['minutes_HMS' + id], window['seconds_HMS' + id]);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_HMS' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'HMS');
|
||||
}
|
||||
if (window['hours_HMS' + id] === 0 && window['minutes_HMS' + id] === 0 && window['seconds_HMS' + id] === 0) {
|
||||
clearTimerInterval($this, "HMS", opts);
|
||||
} else if (window['hours_HMS' + id] !== 0 && window['minutes_HMS' + id] === 0 && window['seconds_HMS' + id] === 0) {
|
||||
window['hours_HMS' + id]--;
|
||||
window['minutes_HMS' + id] = 59;
|
||||
window['seconds_HMS' + id] = 60 - opts.tickInterval;
|
||||
} else if (window['hours_HMS' + id] === 0 && window['minutes_HMS' + id] !== 0 && window['seconds_HMS' + id] === 0) {
|
||||
window['minutes_HMS' + id]--;
|
||||
window['seconds_HMS' + id] = 60 - opts.tickInterval;
|
||||
} else if (window['hours_HMS' + id] !== 0 && window['minutes_HMS' + id] !== 0 && window['seconds_HMS' + id] === 0) {
|
||||
window['minutes_HMS' + id]--;
|
||||
window['seconds_HMS' + id] = 60 - opts.tickInterval;
|
||||
} else {
|
||||
window['seconds_HMS' + id] -= opts.tickInterval;
|
||||
}
|
||||
if ($this.data('countdowntimer').destroy === true) clearTimerInterval($this, "HMS", opts);
|
||||
} else {
|
||||
time = prepareTime($this, opts, 0, 0, 0, window['hours_HMS' + id], window['minutes_HMS' + id], window['seconds_HMS' + id]);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_HMS' + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, 'HMS');
|
||||
}
|
||||
window['seconds_HMS' + id] -= opts.tickInterval;
|
||||
if (window['minutes_HMS' + id] !== 0 && window['seconds_HMS' + id] < 0) {
|
||||
window['minutes_HMS' + id]--;
|
||||
window['seconds_HMS' + id] = 60 - opts.tickInterval;
|
||||
}
|
||||
if (window['minutes_HMS' + id] === 0 && window['seconds_HMS' + id] < 0 && window['hours_HMS' + id] !== 0) {
|
||||
window['hours_HMS' + id]--;
|
||||
window['minutes_HMS' + id] = 59;
|
||||
window['seconds_HMS' + id] = 60 - opts.tickInterval;
|
||||
}
|
||||
if ((window['minutes_HMS' + id] === 0 && window['seconds_HMS' + id] < 0 && window['hours_HMS' + id] === 0) || $this.data('countdowntimer').destroy === true) {
|
||||
clearTimerInterval($this, "HMS", opts);
|
||||
}
|
||||
}
|
||||
id = null;
|
||||
}
|
||||
|
||||
//Function for reverse timer to given date.
|
||||
function givenDate($this, opts, type) {
|
||||
var id = $this.attr('id');
|
||||
var endDate = (type === "withnoStart") ? window['dateTime' + id] : window['endDate' + id];
|
||||
var startDate = (type === "withnoStart") ? window['startTime' + id] : window['startDate' + id];
|
||||
var totalSeconds = ((endDate - startDate) / 1000);
|
||||
var time = "";
|
||||
if ((endDate - startDate) > 0) {
|
||||
if (type === "withStart" && (startDate > (new Date()))) {
|
||||
time = prepareTime($this, opts, 0, 0, 0, 0, 0, 0);
|
||||
html($this, time, opts);
|
||||
} else {
|
||||
time = prepareTime($this, opts, 0, 0, 0, 0, 0, totalSeconds);
|
||||
html($this, time, opts);
|
||||
if (typeof window['beforeExpiry_' + type + id] !== 'undefined') {
|
||||
beforeExpiryTime($this, opts, time, type);
|
||||
}
|
||||
var setSecondsInterval = ((type == "withnoStart") ? (window['startTime' + id].setSeconds(window['startTime' + id].getSeconds() + opts.tickInterval)) : (window['startDate' + id].setSeconds(window['startDate' + id].getSeconds() + opts.tickInterval)));
|
||||
}
|
||||
if ($this.data('countdowntimer').destroy === true) clearTimerInterval($this, type, opts);
|
||||
} else {
|
||||
time = prepareTime($this, opts, 0, 0, 0, 0, 0, 0);
|
||||
html($this, time, opts);
|
||||
clearTimerInterval($this, type, opts);
|
||||
}
|
||||
id = null;
|
||||
}
|
||||
|
||||
//Function for displaying current time.
|
||||
function currentDate($this, opts) {
|
||||
var time = "";
|
||||
var today = (opts.timeZone !== null ? setTimezone(new Date(), opts.timeZone) : new Date());
|
||||
var hours = today.getHours();
|
||||
var minutes = today.getMinutes();
|
||||
var seconds = today.getSeconds();
|
||||
time = prepareTime($this, opts, 0, 0, 0, hours, minutes, seconds);
|
||||
html($this, time, opts);
|
||||
}
|
||||
|
||||
//Default function called when no options are set.
|
||||
function secondsTimer($this, opts) {
|
||||
var id = $this.attr('id');
|
||||
if (window['countSeconds' + id].toString().length < 2) {
|
||||
window['countSeconds' + id] = "0" + window['countSeconds' + id];
|
||||
}
|
||||
$this.html(window['countSeconds' + id] + " " + "sec");
|
||||
window['countSeconds' + id]--;
|
||||
if (window['countSeconds' + id] == -1) {
|
||||
delete window['countSeconds' + id];
|
||||
clearInterval(window['timer_secondsTimer' + id]);
|
||||
}
|
||||
id = null;
|
||||
}
|
||||
|
||||
//Function for calling the given function name when time is expired.
|
||||
function timeUp($this, opts) {
|
||||
if (opts.timeUp !== null) {
|
||||
if ($.isFunction(opts.timeUp) === true) {
|
||||
opts.timeUp.apply($this, []);
|
||||
}
|
||||
}
|
||||
if (opts.expiryUrl !== null) {
|
||||
window.location = opts.expiryUrl;
|
||||
}
|
||||
}
|
||||
|
||||
//Function for calling the given function name before expiry time.
|
||||
function beforeExpiryTime($this, opts, time, type) {
|
||||
var id = $this.attr('id');
|
||||
var bforeExpTime = window['beforeExpiry_' + type + id];
|
||||
bforeExpTime = bforeExpTime.split(":");
|
||||
time = time.split(opts.timeSeparator);
|
||||
if (time[0] === "0" && time[1] === "0") {
|
||||
for (var m = 0; m < (time.length - 2); m++) {
|
||||
time[m] = (time[m + 2] < 10 ? "0" + time[m + 2] : time[m + 2]);
|
||||
}
|
||||
time.splice(4, 2);
|
||||
if (bforeExpTime[0] === time[0] && bforeExpTime[1] === time[1] && bforeExpTime[2] === time[2] && bforeExpTime[3] === time[3]) {
|
||||
if (opts.beforeExpiryTimeFunction !== null) {
|
||||
if ($.isFunction(opts.beforeExpiryTimeFunction) === true) {
|
||||
opts.beforeExpiryTimeFunction.apply($this, []);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function prepareTime($this, opts, years, months, days, hours, minutes, seconds) {
|
||||
if (typeof(years) === 'undefined') years = 0;
|
||||
if (typeof(months) === 'undefined') months = 0;
|
||||
if (typeof(days) === 'undefined') days = 0;
|
||||
if (typeof(hours) === 'undefined') hours = 0;
|
||||
if (typeof(minutes) === 'undefined') minutes = 0;
|
||||
if (typeof(seconds) === 'undefined') seconds = 0;
|
||||
var s = (Math.round(years * 31536000 * 100) / 100) + (Math.round(months * 2628000 * 100) / 100) + (Math.round(days * 86400 * 100) / 100) + (Math.round(hours * 3600 * 100) / 100) + (Math.round(minutes * 60 * 100) / 100) + (Math.round(seconds * 100) / 100);
|
||||
var format = opts.displayFormat.split('');
|
||||
var yearsFormat = (format[0] === "!" ? (Math.floor(s / 31536000)) : 0);
|
||||
var monthsFormat = (format[1] === "!" ? (Math.round(Math.floor((s / 2628000) - ((yearsFormat * 31536000) / 2628000)))) : 0);
|
||||
var daysFormat = (format[2] === "!" ? (Math.round(Math.floor((s / 86400) - ((monthsFormat * 2628000) / 86400) - ((yearsFormat * 31536000) / 86400)))) : 0);
|
||||
var hoursFormat = (format[3] === "!" ? (Math.round(Math.floor((s / 3600) - ((monthsFormat * 2628000) / 3600) - ((yearsFormat * 31536000) / 3600) - ((daysFormat * 86400) / 3600)))) : 0);
|
||||
var minutesFormat = (format[4] === "!" ? (Math.round(Math.floor((s / 60) - ((hoursFormat * 3600) / 60) - ((daysFormat * 86400) / 60) - ((monthsFormat * 2628000) / 60) - ((yearsFormat * 31536000) / 60)))) : 0);
|
||||
var secondsFormat = (format[5] === "!" ? (Math.round(Math.floor(s - (minutesFormat * 60) - (hoursFormat * 3600) - (daysFormat * 86400) - (monthsFormat * 2628000) - (yearsFormat * 31536000)))) : 0);
|
||||
var time = yearsFormat + opts.timeSeparator + monthsFormat + opts.timeSeparator + daysFormat + opts.timeSeparator + hoursFormat + opts.timeSeparator + minutesFormat + opts.timeSeparator + secondsFormat;
|
||||
return time;
|
||||
}
|
||||
|
||||
//Function for displaying the timer.
|
||||
function html($this, time, opts) {
|
||||
var format = opts.displayFormat.split('');
|
||||
time = time.split(opts.timeSeparator);
|
||||
time = $.grep([time[0], time[1], time[2], time[3], time[4], time[5]], function(arr, i) {
|
||||
return (arr >= 0 && format[i] === "!");
|
||||
}).join(opts.timeSeparator);
|
||||
time = time.split(opts.timeSeparator);
|
||||
for (var i = 0; i < time.length; i++) {
|
||||
if (time[i].toString().length < 2 && opts.padZeroes === true) {
|
||||
time[i] = "0" + time[i];
|
||||
}
|
||||
}
|
||||
time = time.join(opts.timeSeparator).toString();
|
||||
for (var k = 0; k < 10; k++) {
|
||||
var replace = k.toString();
|
||||
var re = new RegExp(replace, "g");
|
||||
time = time.replace(re, opts.digits[k]);
|
||||
}
|
||||
if (opts.labelsFormat === true && typeof window['regexpMatchFormat_' + $this.attr('id')] === 'undefined' &&
|
||||
typeof window['regexpReplaceWith_' + $this.attr('id')] === 'undefined') {
|
||||
$this.addClass("labelformat");
|
||||
time = time.split(opts.timeSeparator);
|
||||
var labelTime = "<span class='timerDisplay label" + time.length + "'>";
|
||||
var labelarr = [];
|
||||
for (var j = 0; j < 6; j++) {
|
||||
if (format[j] === "!")
|
||||
labelarr.push(opts.labels[j]);
|
||||
}
|
||||
for (var a = time.length; a > 0; a--) {
|
||||
var itr = time.length - a;
|
||||
labelTime += "<span class='displaySection'><span class='numberDisplay'>" + time[itr] + "</span><span class='periodDisplay'>" + labelarr[itr] + "</span></span>";
|
||||
}
|
||||
time = labelTime += "</span>";
|
||||
} else if (opts.labelsFormat === false && typeof window['regexpMatchFormat_' + $this.attr('id')] !== 'undefined' &&
|
||||
typeof window['regexpReplaceWith_' + $this.attr('id')] !== 'undefined') {
|
||||
var regexp = new RegExp(window['regexpMatchFormat_' + $this.attr('id')]);
|
||||
time = time.replace(regexp,
|
||||
window['regexpReplaceWith_' + $this.attr('id')]);
|
||||
}
|
||||
$this.html(time);
|
||||
}
|
||||
|
||||
//Function to Pause/Resume Timer.
|
||||
function pauseTimer($this, timerType, opts, func) {
|
||||
if ($this.data('countdowntimer').pause === 'pause') {
|
||||
clearInterval(window['timer_' + timerType + $this.attr('id')]);
|
||||
} else if ($this.data('countdowntimer').pause === 'resume') {
|
||||
window['timer_' + timerType + $this.attr('id')] = setInterval(function() {
|
||||
func($this, opts);
|
||||
}, opts.tickInterval * 1000);
|
||||
}
|
||||
$("#" + opts.pauseButton).click(function() {
|
||||
if ($(this).val() != "resume") {
|
||||
$("#" + opts.pauseButton).val("resume").text("Resume");
|
||||
clearInterval(window['timer_' + timerType + $this.attr('id')]);
|
||||
} else if ($(this).val() == "resume") {
|
||||
$("#" + opts.pauseButton).val("pause").text("Pause");
|
||||
window['timer_' + timerType + $this.attr('id')] = setInterval(function() {
|
||||
func($this, opts);
|
||||
}, opts.tickInterval * 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Function to Start/Stop Timer.
|
||||
function stopTimer($this, timerType, opts, func) {
|
||||
if ($this.data('countdowntimer').stop === 'stop') {
|
||||
clearInterval(window['timer_' + timerType + $this.attr('id')]);
|
||||
window['hours_' + timerType + $this.attr('id')] = opts.hours;
|
||||
window['minutes_' + timerType + $this.attr('id')] = opts.minutes;
|
||||
window['seconds_' + timerType + $this.attr('id')] = opts.seconds;
|
||||
func($this, opts);
|
||||
} else if ($this.data('countdowntimer').stop === 'start') {
|
||||
window['timer_' + timerType + $this.attr('id')] = setInterval(function() {
|
||||
func($this, opts);
|
||||
}, opts.tickInterval * 1000);
|
||||
}
|
||||
$("#" + opts.stopButton).click(function() {
|
||||
if ($(this).val() != "start") {
|
||||
$("#" + opts.stopButton).val("start").text("Start");
|
||||
clearInterval(window['timer_' + timerType + $this.attr('id')]);
|
||||
window['hours_' + timerType + $this.attr('id')] = opts.hours;
|
||||
window['minutes_' + timerType + $this.attr('id')] = opts.minutes;
|
||||
window['seconds_' + timerType + $this.attr('id')] = opts.seconds;
|
||||
func($this, opts);
|
||||
} else if ($(this).val() == "start") {
|
||||
$("#" + opts.stopButton).val("stop").text("Stop");
|
||||
window['timer_' + timerType + $this.attr('id')] = setInterval(function() {
|
||||
func($this, opts);
|
||||
}, opts.tickInterval * 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function clearTimerInterval($this, timerType, opts) {
|
||||
var id = $this.attr('id');
|
||||
if (timerType === "withnoStart") {
|
||||
delete window['dateTime' + id];
|
||||
delete window['startTime' + id];
|
||||
clearInterval(window['timer_givenDate' + id]);
|
||||
} else if (timerType === "withStart") {
|
||||
delete window['startDate' + id];
|
||||
delete window['endDate' + id];
|
||||
clearInterval(window['timer_startDate' + id]);
|
||||
} else {
|
||||
delete window['hours_' + timerType + id];
|
||||
delete window['minutes_' + timerType + id];
|
||||
delete window['seconds_' + timerType + id];
|
||||
clearInterval(window['timer_' + timerType + id]);
|
||||
}
|
||||
if ($this.data('countdowntimer').destroy === true) {
|
||||
$this.empty().removeClass();
|
||||
} else {
|
||||
timeUp($this, opts);
|
||||
}
|
||||
}
|
||||
|
||||
//Giving default value for options.
|
||||
$.fn.countdowntimer.defaults = {
|
||||
hours: 0,
|
||||
minutes: 0,
|
||||
seconds: 60,
|
||||
startDate: new Date(),
|
||||
dateAndTime: new Date("1970/01/01 00:00:00"),
|
||||
currentTime: false,
|
||||
size: "sm",
|
||||
borderColor: "#F0068E",
|
||||
fontColor: "#FFFFFF",
|
||||
backgroundColor: "#000000",
|
||||
timeSeparator: ":",
|
||||
tickInterval: 1,
|
||||
timeUp: null,
|
||||
expiryUrl: null,
|
||||
regexpMatchFormat: null,
|
||||
regexpReplaceWith: null,
|
||||
pauseButton: null,
|
||||
stopButton: null,
|
||||
beforeExpiryTime: null,
|
||||
beforeExpiryTimeFunction: null,
|
||||
padZeroes: true,
|
||||
displayFormat: "HMS",
|
||||
labelsFormat: false,
|
||||
timeZone: null
|
||||
};
|
||||
|
||||
$.fn.countdowntimer.regionalOptions = {
|
||||
digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
||||
labels: ['Years', 'Months', 'Days', 'Hours', 'Minutes', 'Seconds'],
|
||||
isRTL: false
|
||||
};
|
||||
|
||||
}(jQuery));
|
||||
File diff suppressed because one or more lines are too long
@@ -1,2 +0,0 @@
|
||||
User-agent: *
|
||||
Disallow:
|
||||
1
public/static/style.css
Executable file
1
public/static/style.css
Executable file
@@ -0,0 +1 @@
|
||||
h1 { font-family: Arial, Helvetica, sans-serif; }
|
||||
BIN
public/webfonts/fa-brands-400.woff2
Executable file
BIN
public/webfonts/fa-brands-400.woff2
Executable file
Binary file not shown.
BIN
public/webfonts/fa-regular-400.woff2
Executable file
BIN
public/webfonts/fa-regular-400.woff2
Executable file
Binary file not shown.
BIN
public/webfonts/fa-solid-900.woff2
Executable file
BIN
public/webfonts/fa-solid-900.woff2
Executable file
Binary file not shown.
Reference in New Issue
Block a user