Changed JS to use single quotes instead of double quotes

This commit is contained in:
Bot 2018-08-11 22:16:57 +02:00 committed by Igor Scheller
parent 3d245660c5
commit 28349b69a8
10 changed files with 57 additions and 57 deletions

View File

@ -2,10 +2,10 @@
* Sets all checkboxes to the wanted state * Sets all checkboxes to the wanted state
* *
* @param {string} id Id of the element containing all the checkboxes * @param {string} id Id of the element containing all the checkboxes
* @param {bool} checked True if the checkboxes should be checked * @param {boolean} checked True if the checkboxes should be checked
*/ */
global.checkAll = (id, checked) => { global.checkAll = (id, checked) => {
$("#" + id + " input[type='checkbox']").each(function () { $('#' + id + ' input[type="checkbox"]').each(function () {
this.checked = checked; this.checked = checked;
}); });
} }
@ -17,7 +17,7 @@ global.checkAll = (id, checked) => {
* @param {list} shifts_list A list of numbers * @param {list} shifts_list A list of numbers
*/ */
global.checkOwnTypes = (id, shifts_list) => { global.checkOwnTypes = (id, shifts_list) => {
$("#" + id + " input[type='checkbox']").each(function () { $('#' + id + ' input[type="checkbox"]').each(function () {
this.checked = $.inArray(parseInt(this.value), shifts_list) != -1; this.checked = $.inArray(parseInt(this.value), shifts_list) != -1;
}); });
} }
@ -26,14 +26,14 @@ global.checkOwnTypes = (id, shifts_list) => {
* @param {moment} date * @param {moment} date
*/ */
global.formatDay = (date) => { global.formatDay = (date) => {
return date.format("YYYY-MM-DD"); return date.format('YYYY-MM-DD');
} }
/** /**
* @param {moment} date * @param {moment} date
*/ */
global.formatTime = (date) => { global.formatTime = (date) => {
return date.format("HH:mm"); return date.format('HH:mm');
} }
/** /**
@ -41,7 +41,7 @@ global.formatTime = (date) => {
* @param {moment} to * @param {moment} to
*/ */
global.setInput = (from, to) => { global.setInput = (from, to) => {
var fromDay = $("#start_day"), fromTime = $("#start_time"), toDay = $("#end_day"), toTime = $("#end_time"); var fromDay = $('#start_day'), fromTime = $('#start_time'), toDay = $('#end_day'), toTime = $('#end_time');
fromDay.val(formatDay(from)); fromDay.val(formatDay(from));
fromTime.val(formatTime(from)); fromTime.val(formatTime(from));
@ -56,7 +56,7 @@ global.setDay = (days) => {
var from = moment(); var from = moment();
from.hours(0).minutes(0).seconds(0); from.hours(0).minutes(0).seconds(0);
from.add(days, "d"); from.add(days, 'd');
var to = from.clone(); var to = from.clone();
to.hours(23).minutes(59); to.hours(23).minutes(59);
@ -70,7 +70,7 @@ global.setHours = (hours) => {
var from = moment(); var from = moment();
var to = from.clone(); var to = from.clone();
to.add(hours, "h"); to.add(hours, 'h');
if (to < from) { if (to < from) {
setInput(to, from); setInput(to, from);
return; return;
@ -83,12 +83,12 @@ $(function () {
/** /**
* Disable every submit button after clicking (to prevent double-clicking) * Disable every submit button after clicking (to prevent double-clicking)
*/ */
$("form").submit(function (ev) { $('form').submit(function (ev) {
$("input[type='submit']").prop("readonly", true).addClass("disabled"); $('input[type="submit"]').prop('readonly', true).addClass('disabled');
return true; return true;
}); });
$(".dropdown-menu").css("max-height", function () { $('.dropdown-menu').css('max-height', function () {
return ($(window).height() - 50) + "px"; return ($(window).height() - 50) + 'px';
}).css("overflow-y", "scroll"); }).css('overflow-y', 'scroll');
}); });

View File

@ -1,18 +1,18 @@
/* /*
* Initialize all moment countdowns on the page. A moment countdown has the * Initialize all moment countdowns on the page. A moment countdown has the
* class "moment-countdown" and the attribute "data-timestamp" which defines the * class 'moment-countdown' and the attribute 'data-timestamp' which defines the
* countdown's time goal. * countdown's time goal.
*/ */
$(document).ready(function () { $(document).ready(function () {
if (typeof moment !== "undefined") { if (typeof moment !== 'undefined') {
$.each($(".moment-countdown"), function (i, e) { $.each($('.moment-countdown'), function (i, e) {
var span = $(e); var span = $(e);
var text = span.html(); var text = span.html();
/* global moment */ /* global moment */
var timestamp = moment(parseInt(span.attr("data-timestamp") * 1000)); var timestamp = moment(parseInt(span.attr('data-timestamp') * 1000));
span.html(text.replace("%c", timestamp.fromNow())); span.html(text.replace('%c', timestamp.fromNow()));
setInterval(function () { setInterval(function () {
span.html(text.replace("%c", timestamp.fromNow())); span.html(text.replace('%c', timestamp.fromNow()));
}, 1000); }, 1000);
}); });
} }

View File

@ -2,29 +2,29 @@
* Enables the fixed headers and time lane for the shift-calendar and datatables * Enables the fixed headers and time lane for the shift-calendar and datatables
*/ */
$(document).ready(function () { $(document).ready(function () {
if ($(".shift-calendar").length) { if ($('.shift-calendar').length) {
var timeLanes = $(".shift-calendar .time"); var timeLanes = $('.shift-calendar .time');
var headers = $(".shift-calendar .header"); var headers = $('.shift-calendar .header');
var topReference = $(".container-fluid .row"); var topReference = $('.container-fluid .row');
timeLanes.css({ timeLanes.css({
"position": "relative", 'position': 'relative',
"z-index": 999 'z-index': 999
}); });
headers.css({ headers.css({
"position": "relative", 'position': 'relative',
"z-index": 900 'z-index': 900
}); });
$(window).scroll( $(window).scroll(
function () { function () {
var top = headers.parent().offset().top; var top = headers.parent().offset().top;
var left = 15; var left = 15;
timeLanes.css({ timeLanes.css({
"left": Math.max(0, $(window).scrollLeft() - left) + "px" 'left': Math.max(0, $(window).scrollLeft() - left) + 'px'
}); });
headers.css({ headers.css({
"top": Math.max(0, $(window).scrollTop() - top 'top': Math.max(0, $(window).scrollTop() - top
+ topReference.offset().top) + topReference.offset().top)
+ "px" + 'px'
}); });
}); });
} }

View File

@ -12,5 +12,5 @@ require('./sticky-headers');
require('./moment-countdown'); require('./moment-countdown');
$(function () { $(function () {
moment.locale("%locale%"); moment.locale($('html').attr('lang'));
}); });

View File

@ -33,7 +33,7 @@ function bargraph($dom_id, $key, $row_names, $colors, $data)
return '<canvas id="' . $dom_id . '" style="width: 100%; height: 300px;"></canvas> return '<canvas id="' . $dom_id . '" style="width: 100%; height: 300px;"></canvas>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
var ctx = $("#' . $dom_id . '").get(0).getContext("2d"); var ctx = $(\'#' . $dom_id . '\').get(0).getContext(\'2d\');
var chart = new Chart(ctx).Bar(' . json_encode([ var chart = new Chart(ctx).Bar(' . json_encode([
'labels' => $labels, 'labels' => $labels,
'datasets' => $datasets 'datasets' => $datasets

View File

@ -38,12 +38,12 @@ function form_spinner($name, $label, $value)
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$("#spinner-' . $name . '-down").click(function() { $(\'#spinner-' . $name . '-down\').click(function() {
var spinner = $("#spinner-' . $name . '"); var spinner = $(\'#spinner-' . $name . '\');
spinner.val(parseInt(spinner.val()) - 1); spinner.val(parseInt(spinner.val()) - 1);
}); });
$("#spinner-' . $name . '-up").click(function() { $(\'#spinner-' . $name . '-up\').click(function() {
var spinner = $("#spinner-' . $name . '"); var spinner = $(\'#spinner-' . $name . '\');
spinner.val(parseInt(spinner.val()) + 1); spinner.val(parseInt(spinner.val()) + 1);
}); });
</script> </script>
@ -73,13 +73,13 @@ function form_date($name, $label, $value, $start_date = '', $end_date = '')
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$("#' . $dom_id . '").datepicker({ $(\'#' . $dom_id . '\').datepicker({
language: "' . locale_short() . '", language: \'' . locale_short() . '\',
todayBtn: "linked", todayBtn: \'linked\',
format: "yyyy-mm-dd", format: \'yyyy-mm-dd\',
startDate: "' . $start_date . '", startDate: \'' . $start_date . '\',
endDate: "' . $end_date . '", endDate: \'' . $end_date . '\',
orientation: "bottom" orientation: \'bottom\'
}); });
}); });
</script> </script>

View File

@ -231,12 +231,12 @@ function toolbar_popover($glyphicon, $label, $content, $class = '')
. ' <span class="caret"></span></a> . ' <span class="caret"></span></a>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$("#' . $dom_id . '").popover({ $(\'#' . $dom_id . '\').popover({
trigger: "focus", trigger: \'focus\',
html: true, html: true,
content: "' . addslashes(join('', $content)) . '", content: \'' . addslashes(join('', $content)) . '\',
placement: "bottom", placement: \'bottom\',
container: "#navbar-collapse-1" container: \'#navbar-collapse-1\'
}) })
}); });
</script></li>'; </script></li>';

View File

@ -53,18 +53,18 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
]), ]),
'<script type="text/javascript"> '<script type="text/javascript">
$(function() { $(function() {
var checkbox = $("#wants_to_drive"); var checkbox = $(\'#wants_to_drive\');
if(checkbox.is(":checked")) if(checkbox.is(\':checked\'))
$("#driving_license").show(); $(\'#driving_license\').show();
else else
$("#driving_license").hide(); $(\'#driving_license\').hide();
checkbox.click( checkbox.click(
function() { function() {
if($("#wants_to_drive").is(":checked")) if($(\'#wants_to_drive\').is(\':checked\'))
$("#driving_license").show(); $(\'#driving_license\').show();
else else
$("#driving_license").hide(); $(\'#driving_license\').hide();
} }
); );
}); });

View File

@ -247,6 +247,6 @@ echo view(__DIR__ . '/../templates/layout.html', [
'header_toolbar' => header_toolbar(), 'header_toolbar' => header_toolbar(),
'faq_url' => config('faq_url'), 'faq_url' => config('faq_url'),
'contact_email' => config('contact_email'), 'contact_email' => config('contact_email'),
'locale' => locale(), 'locale' => locale_short(),
'event_info' => EventConfig_info($event_config) . ' <br />' 'event_info' => EventConfig_info($event_config) . ' <br />'
]); ]);

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="%locale%">
<head> <head>
<title>%title% - Engelsystem</title> <title>%title% - Engelsystem</title>
<meta charset="UTF-8"/> <meta charset="UTF-8"/>