Skip to content
Snippets Groups Projects
Commit baf328e4 authored by Frank Naegler's avatar Frank Naegler Committed by Daniel Goerz
Browse files

[TASK] Migrate TYPO3/CMS/Linkvalidator/* to TypeScript

Resolves: #87920
Releases: master
Change-Id: Ibb3d28e85b6beddfd4bacca8303cca51c46ac6b3
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60255


Tested-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarDaniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: default avatarDaniel Goerz <daniel.goerz@posteo.de>
parent 2df8bdce
Branches
Tags
No related merge requests found
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import * as $ from 'jquery';
import Notification = require('TYPO3/CMS/Backend/Notification');
/**
* Module: TYPO3/CMS/Linkvalidator/Linkvalidator
*/
class Linkvalidator {
constructor() {
this.initializeEvents();
}
public toggleActionButton(prefix: string): void {
let buttonDisable = true;
$('.' + prefix).each((index: number, element: HTMLInputElement): void => {
if ($(element).prop('checked')) {
buttonDisable = false;
}
});
if (prefix === 'check') {
$('#updateLinkList').prop('disabled', buttonDisable);
} else {
$('#refreshLinkList').prop('disabled', buttonDisable);
}
}
/**
* Registers listeners
*/
protected initializeEvents(): void {
$('.refresh').on('click', (): void => {
this.toggleActionButton('refresh');
});
$('.check').on('click', (): void => {
this.toggleActionButton('check');
});
$('.t3js-update-button').on('click', (e: JQueryEventObject): void => {
const $element = $(e.currentTarget);
const name = $element.attr('name');
let message = 'Event triggered';
if (name === 'refreshLinkList' || name === 'updateLinkList') {
message = $element.data('notification-message');
}
Notification.success(message);
});
}
}
export = new Linkvalidator();
......@@ -10,63 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Module: TYPO3/CMS/Linkvalidator/Linkvalidator
*/
define(['jquery'], function($) {
'use strict';
/**
*
* @type {{}}
* @exports TYPO3/CMS/Linkvalidator/Linkvalidator
*/
var Linkvalidator = {};
/**
*
* @param {String} prefix
*/
Linkvalidator.toggleActionButton = function(prefix) {
var buttonDisable = true;
$('.' + prefix).each(function() {
if ($(this).prop('checked')) {
buttonDisable = false;
}
});
if (prefix === 'check') {
$('#updateLinkList').prop('disabled', buttonDisable);
} else {
$('#refreshLinkList').prop('disabled', buttonDisable);
}
};
/**
* Registers listeners
*/
Linkvalidator.initializeEvents = function() {
$('.refresh').on('click', function() {
Linkvalidator.toggleActionButton('refresh');
});
$('.check').on('click', function() {
Linkvalidator.toggleActionButton('check');
});
$('.t3js-update-button').on('click', function() {
var $element = $(this);
var name = $element.attr('name');
var message = 'Event triggered';
if (name === 'refreshLinkList' || name === 'updateLinkList') {
message = $element.data('notification-message');
}
top.TYPO3.Notification.success(message);
});
};
$(Linkvalidator.initializeEvents);
return Linkvalidator;
});
define(["require","exports","jquery","TYPO3/CMS/Backend/Notification"],function(t,e,n,i){"use strict";return new(function(){function t(){this.initializeEvents()}return t.prototype.toggleActionButton=function(t){var e=!0;n("."+t).each(function(t,i){n(i).prop("checked")&&(e=!1)}),"check"===t?n("#updateLinkList").prop("disabled",e):n("#refreshLinkList").prop("disabled",e)},t.prototype.initializeEvents=function(){var t=this;n(".refresh").on("click",function(){t.toggleActionButton("refresh")}),n(".check").on("click",function(){t.toggleActionButton("check")}),n(".t3js-update-button").on("click",function(t){var e=n(t.currentTarget),c=e.attr("name"),o="Event triggered";"refreshLinkList"!==c&&"updateLinkList"!==c||(o=e.data("notification-message")),i.success(o)})},t}())});
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment