Initial commit - Typo3 11.5.41
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) sgalinski Internet Services (https://www.sgalinski.de)
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
/**
|
||||
* Indicates if untranslated languages are hidden.
|
||||
* @type {boolean}
|
||||
*/
|
||||
var untranslatedAreHidden = false;
|
||||
|
||||
/**
|
||||
* Index of column which contains state of languages.
|
||||
* @type {number}
|
||||
*/
|
||||
var STATE_COLUMN_INDEX = 1;
|
||||
|
||||
/**
|
||||
* Index of span element which contains number of translated constants.
|
||||
* @type {number}
|
||||
*/
|
||||
var TRANSLATED_SPAN_INDEX = 1;
|
||||
|
||||
/**
|
||||
* Gets list of table rows.
|
||||
* @returns {NodeList|*}
|
||||
*/
|
||||
function getTableRowElements() {
|
||||
var tableElement = document.getElementById('tx-lfeditor-table');
|
||||
var tableBodyElement = tableElement ? tableElement.getElementsByTagName('tbody')[0] : null;
|
||||
var tableRowElements = tableBodyElement ? tableBodyElement.getElementsByTagName('tr') : null;
|
||||
return tableRowElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function hides table rows which contain untranslated languages.
|
||||
* @returns boolean
|
||||
*/
|
||||
var hideUntranslatedLanguagesInTable = function() {
|
||||
var thereAreHiddenElements = false;
|
||||
var tableRowElements = getTableRowElements();
|
||||
if (tableRowElements === null) {
|
||||
return thereAreHiddenElements;
|
||||
}
|
||||
|
||||
for (var tableRowIndex = tableRowElements.length; tableRowIndex--;) {
|
||||
var tableDataElements = tableRowElements[tableRowIndex].getElementsByTagName('td');
|
||||
if (tableDataElements === null) {
|
||||
return thereAreHiddenElements;
|
||||
}
|
||||
var tableDataSpanElements = tableDataElements[STATE_COLUMN_INDEX].getElementsByTagName('span');
|
||||
if (!tableDataSpanElements || !tableDataSpanElements[TRANSLATED_SPAN_INDEX]) {
|
||||
return thereAreHiddenElements;
|
||||
}
|
||||
var numberTranslated = tableDataSpanElements[TRANSLATED_SPAN_INDEX].innerText.trim();
|
||||
if (numberTranslated !== '0') {
|
||||
continue;
|
||||
}
|
||||
tableRowElements[tableRowIndex].style.display = 'none';
|
||||
untranslatedAreHidden = true;
|
||||
thereAreHiddenElements = true;
|
||||
}
|
||||
return thereAreHiddenElements;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reveals hidden table rows.
|
||||
* @returns void
|
||||
*/
|
||||
function showUntranslatedLanguagesInTable() {
|
||||
var tableRowElements = getTableRowElements();
|
||||
if (tableRowElements === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var tableRowIndex = tableRowElements.length; tableRowIndex--;) {
|
||||
if (tableRowElements[tableRowIndex].style.display === 'none') {
|
||||
tableRowElements[tableRowIndex].style.display = '';
|
||||
}
|
||||
}
|
||||
untranslatedAreHidden = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides or un hides rows of table which contain untranslated languages.
|
||||
* @returns void
|
||||
*/
|
||||
function hideShowUntranslatedLanguagesInTable() {
|
||||
if (untranslatedAreHidden) {
|
||||
showUntranslatedLanguagesInTable();
|
||||
} else {
|
||||
hideUntranslatedLanguagesInTable();
|
||||
}
|
||||
}
|
||||
|
||||
var initHideShowFunctionality = function() {
|
||||
var thereAreHiddenElements = hideUntranslatedLanguagesInTable();
|
||||
if (!thereAreHiddenElements) {
|
||||
var hideShowLinkElement = document.getElementById('hideShowUntranslatedLanguagesInTableId');
|
||||
hideShowLinkElement.style.display = 'none';
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', initHideShowFunctionality);
|
||||
185
typo3conf/ext/lfeditor/Resources/Public/JavaScript/Lfeditor.js
Normal file
185
typo3conf/ext/lfeditor/Resources/Public/JavaScript/Lfeditor.js
Normal file
@@ -0,0 +1,185 @@
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) sgalinski Internet Services (https://www.sgalinski.de)
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'TYPO3/CMS/Backend/Modal',
|
||||
'TYPO3/CMS/Backend/Severity'
|
||||
], function($, Modal, Severity) {
|
||||
'use strict';
|
||||
|
||||
var lfEditor = {
|
||||
hideAll: null,
|
||||
init: function() {
|
||||
document.onkeydown = this.saveOnKeyDown;
|
||||
|
||||
$(document).ready(function() {
|
||||
$.get(TYPO3.settings.ajaxUrls['lfeditor::ajaxPing']);
|
||||
});
|
||||
},
|
||||
submitLanguageFileEdit: function(buttonType) {
|
||||
var $form = $(document.forms.contentForm);
|
||||
$form.find("[name$='[buttonType]']").val(buttonType);
|
||||
$form.submit();
|
||||
},
|
||||
/**
|
||||
* Renders confirmation dialog for cancel button.
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
confirmCancelFileEdit: function() {
|
||||
Modal.confirm(
|
||||
TYPO3.lang['function.langfile.confirmCancel.title'],
|
||||
TYPO3.lang['function.langfile.confirmCancel']
|
||||
).on('confirm.button.ok', function() {
|
||||
Modal.dismiss();
|
||||
TYPO3.lfEditor.submitLanguageFileEdit(-1);
|
||||
}).on('confirm.button.cancel', function() {
|
||||
Modal.dismiss();
|
||||
});
|
||||
return false;
|
||||
},
|
||||
|
||||
/** args -- fieldID(id), picID(id), bottom(boolean) */
|
||||
openCloseTreeEntry: function(prefix, args) {
|
||||
var length = arguments.length;
|
||||
var pic, curTreeHide;
|
||||
|
||||
for (var i = 1; i < length; i += 3) {
|
||||
curTreeHide = 0;
|
||||
if (!document.getElementById(arguments[i]).style.display) {
|
||||
curTreeHide = 1;
|
||||
}
|
||||
|
||||
if (curTreeHide) {
|
||||
document.getElementById(arguments[i]).style.display = 'none';
|
||||
pic = 'Plus';
|
||||
} else {
|
||||
document.getElementById(arguments[i]).style.display = '';
|
||||
pic = 'Minus';
|
||||
}
|
||||
|
||||
if (arguments[i + 2]) {
|
||||
pic = pic + 'Bottom';
|
||||
}
|
||||
|
||||
document.getElementById(arguments[i + 1]).src = prefix + '/tree' + pic + '.png';
|
||||
document.getElementById(arguments[i + 1]).alt = 'tree' + pic + '.png';
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Folds and un folds all constants in tree, on tree view.
|
||||
*/
|
||||
hideUnHideAll: function() {
|
||||
if (this.hideAll === null) {
|
||||
this.hideAll = document.getElementById('ul-Root').style.display !== 'none';
|
||||
}
|
||||
|
||||
var ulIdRegex = /^ul-/;
|
||||
var treeUlElements = [];
|
||||
var allUl = document.getElementsByTagName('ul');
|
||||
for (var iterator = allUl.length; iterator--;) {
|
||||
if (ulIdRegex.test(allUl[iterator].id)) {
|
||||
treeUlElements.push(allUl[iterator]);
|
||||
}
|
||||
}
|
||||
|
||||
var imageIdRegex = /^icon-/;
|
||||
var imageMinusSrcRegex = /treeMinus/;
|
||||
var imagePlusSrcRegex = /treePlus/;
|
||||
var treeImgMinusElements = [];
|
||||
var treeImgPlusElements = [];
|
||||
var allImg = document.getElementsByTagName('img');
|
||||
for (var iterator = allImg.length; iterator--;) {
|
||||
if (imageIdRegex.test(allImg[iterator].id)) {
|
||||
if (imageMinusSrcRegex.test(allImg[iterator].src)) {
|
||||
treeImgMinusElements.push(allImg[iterator]);
|
||||
} else if (imagePlusSrcRegex.test(allImg[iterator].src)) {
|
||||
treeImgPlusElements.push(allImg[iterator]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hideAll) {
|
||||
for (var iterator = treeUlElements.length; iterator--;) {
|
||||
treeUlElements[iterator].style.display = 'none';
|
||||
}
|
||||
for (var iterator = treeImgMinusElements.length; iterator--;) {
|
||||
treeImgMinusElements[iterator].src = treeImgMinusElements[iterator].src.replace(imageMinusSrcRegex, 'treePlus');
|
||||
}
|
||||
this.hideAll = false;
|
||||
} else {
|
||||
for (var iterator = treeUlElements.length; iterator--;) {
|
||||
treeUlElements[iterator].style.display = '';
|
||||
}
|
||||
for (var iterator = treeImgPlusElements.length; iterator--;) {
|
||||
treeImgPlusElements[iterator].src = treeImgPlusElements[iterator].src.replace(imagePlusSrcRegex, 'treeMinus');
|
||||
}
|
||||
this.hideAll = true;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Triggers click on button with id = 'tx-lfeditor-button-submit' when user presses Ctrl + Enter.
|
||||
*
|
||||
* @param eventParameter
|
||||
* @returns void
|
||||
*/
|
||||
saveOnKeyDown: function(eventParameter) {
|
||||
var eventObject = window.event ? event : eventParameter;
|
||||
if (eventObject.keyCode == 13 && eventObject.ctrlKey) {
|
||||
document.getElementById('contentForm').submit();
|
||||
}
|
||||
},
|
||||
changeForm: function(id) {
|
||||
Modal.confirm(
|
||||
TYPO3.lang['function.langfile.confirmChange.title'],
|
||||
TYPO3.lang['function.langfile.confirmChange']
|
||||
).on('confirm.button.ok', function() {
|
||||
Modal.dismiss();
|
||||
document.getElementById(id).submit();
|
||||
}).on('confirm.button.cancel', function() {
|
||||
Modal.dismiss();
|
||||
});
|
||||
return false;
|
||||
},
|
||||
jump: function(select) {
|
||||
Modal.confirm(
|
||||
TYPO3.lang['function.langfile.confirmChange.title'],
|
||||
TYPO3.lang['function.langfile.confirmChange']
|
||||
).on('confirm.button.ok', function() {
|
||||
Modal.dismiss();
|
||||
window.location.href = select.options[select.selectedIndex].value;
|
||||
}).on('confirm.button.cancel', function() {
|
||||
Modal.dismiss();
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
TYPO3.lfEditor = lfEditor;
|
||||
|
||||
lfEditor.init();
|
||||
|
||||
return lfEditor;
|
||||
});
|
||||
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
* TextAreaResizer script by Jason Johnston (jj@lojjic.net)
|
||||
* Created August 2003. Use freely, but give me credit.
|
||||
*
|
||||
* This script adds a handle below textareas that the user
|
||||
* can drag with the mouse to resize the textarea.
|
||||
************************************************************
|
||||
* Modified by John Ha 2005, 2006 (ink@bur.st)
|
||||
*
|
||||
* Modified by Peter Klein/Stefan Galinski for special needs in LFEditor
|
||||
*/
|
||||
|
||||
function TextAreaResizer(elt) {
|
||||
this.element = elt;
|
||||
this.create();
|
||||
}
|
||||
|
||||
TextAreaResizer.prototype = {
|
||||
// create hr element (+class, +title tooltip)
|
||||
create: function() {
|
||||
var elt = this.element;
|
||||
if (elt.title != 'true') {
|
||||
var thisRef = this; // for usage in events definition
|
||||
var h = this.handle = document.createElement("hr");
|
||||
h.className = 'handle-normal';
|
||||
|
||||
// tooltip dont work in every browser correct (eg. firefox no page break)
|
||||
if (typeof tooltip != 'undefined') {
|
||||
h.title = '<ul><li>Click & drag to resize</li><li>Double-left-click to' +
|
||||
'minimize/maximize</li><li>Right-click best-fit to window</li></ul>';
|
||||
} else if (checkIt('opera')) {
|
||||
h.title = '- Click & drag to resize \n- Double-left-click to minimize/maximize \n';
|
||||
} else {
|
||||
h.title = '- Click & drag to resize \n- Double-left-click to minimize/maximize \n' +
|
||||
'- Right-click best-fit to window';
|
||||
}
|
||||
|
||||
// double click resizing
|
||||
addEvent(h, 'dblclick', function() {
|
||||
thisRef.max(1);
|
||||
}, false);
|
||||
|
||||
// onclick optimal resizing
|
||||
addEvent(h, 'mousedown', function(evt) {
|
||||
if (!checkIt('opera')) {
|
||||
if (evt.button == 2) {
|
||||
thisRef.max(2);
|
||||
} else {
|
||||
thisRef.dragStart(evt);
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
// class changing mechanism
|
||||
addEvent(h, 'mouseover', function() {
|
||||
h.className = 'handle-highlight';
|
||||
}, false);
|
||||
addEvent(h, 'mouseout', this.handleHigh = function() {
|
||||
h.className = 'handle-normal';
|
||||
}, false);
|
||||
|
||||
// deactivate context menu
|
||||
addEvent(h, 'contextmenu', function() {
|
||||
return false;
|
||||
}, false);
|
||||
|
||||
// insert now into document
|
||||
elt.parentNode.insertBefore(h, elt.nextSibling);
|
||||
}
|
||||
},
|
||||
|
||||
dragStart: function(evt) {
|
||||
var thisRef = this;
|
||||
|
||||
// lock cursor shape
|
||||
document.getElementsByTagName('body')[0].style.cursor = 's-resize';
|
||||
|
||||
if (typeof (this.handle.mouseoverHandler) == 'function' &&
|
||||
typeof (this.handle.mouseoutHandler) == 'function') {
|
||||
// save mouseover handler from dom-tooltips
|
||||
this.mouseoverHandler = this.handle.mouseoverHandler;
|
||||
|
||||
// disable mouseover for tooltips - tooltips should be "off" while dragging
|
||||
removeEvent(this.handle, 'mouseover', this.handle.mouseoverHandler, false);
|
||||
|
||||
// turn off tooltip
|
||||
this.handle.mouseoutHandler();
|
||||
}
|
||||
|
||||
// highlight should remain on
|
||||
removeEvent(this.handle, 'mouseout', this.handleHigh, false);
|
||||
|
||||
this.dragStartY = evt.clientY + 8;
|
||||
this.dragStartH = this.element.offsetHeight;
|
||||
|
||||
addEvent(document, 'mousemove', this.dragMoveHdlr = function(evt) {
|
||||
thisRef.dragMove(evt);
|
||||
}, false);
|
||||
addEvent(document, 'mouseup', this.dragStopHdlr = function() {
|
||||
thisRef.dragStop();
|
||||
|
||||
// restore default cursor shape
|
||||
document.getElementsByTagName('body')[0].style.cursor = 'default';
|
||||
|
||||
// restore mouseover for tooltips after drag stop
|
||||
if (typeof (thisRef.mouseoverHandler) == 'function') {
|
||||
addEvent(thisRef.handle, 'mouseover', thisRef.mouseoverHandler, false);
|
||||
}
|
||||
|
||||
// restore highlight handler
|
||||
thisRef.handle.className = 'handle-normal';
|
||||
addEvent(thisRef.handle, 'mouseout', thisRef.handleHigh =
|
||||
function() {
|
||||
thisRef.handle.className = 'handle-normal';
|
||||
}, false);
|
||||
}, false);
|
||||
},
|
||||
|
||||
dragMove: function(evt) {
|
||||
var height = this.dragStartH + evt.clientY - this.dragStartY;
|
||||
this.element.style.height = (height > 0 ? height : 0) + 'px';
|
||||
},
|
||||
|
||||
dragStop: function() {
|
||||
//this.element.style.borderStyle = 'solid';
|
||||
removeEvent(document, 'mousemove', this.dragMoveHdlr, false);
|
||||
removeEvent(document, 'mouseup', this.dragStopHdlr, false);
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
var elt = this.element;
|
||||
elt.parentNode.removeChild(this.handle);
|
||||
elt.style.height = '';
|
||||
},
|
||||
|
||||
max: function(mode) {
|
||||
if (!this.defHeight) {
|
||||
this.defHeight = this.element.offsetHeight;
|
||||
}
|
||||
if (!this.defWidth) {
|
||||
this.defWidth = this.handle.offsetWidth;
|
||||
}
|
||||
|
||||
if (this.element.style.height == '1px') {
|
||||
this.element.style.height = this.defHeight + 'px';
|
||||
} else {
|
||||
this.element.style.height = '1px';
|
||||
}
|
||||
|
||||
if (mode == 2) {
|
||||
var str = '';
|
||||
for (var i = 0; i < parseInt(this.element.scrollWidth / 10); i++) {
|
||||
str += ' ';
|
||||
}
|
||||
this.element.value += str;
|
||||
|
||||
// IE Bug? Need to retrieve scrollWidth first to init it!
|
||||
var dummy = this.element.scrollWidth,
|
||||
wrap = 0;
|
||||
if (this.element.scrollWidth == this.element.clientWidth) {
|
||||
wrap = 1;
|
||||
}
|
||||
this.element.value = this.element.value.replace(str, '');
|
||||
|
||||
// IE Bug? Need to retrieve scrollHeight first to init it!
|
||||
dummy = this.element.scrollHeight;
|
||||
var maxHeight = this.element.scrollHeight +
|
||||
(checkIt('msie') ? wrap ? -6 : 9 : wrap ? 0 : this.element.scrollWidth > this.element.clientWidth ? 20 : 0);
|
||||
|
||||
if (maxHeight > winSize()[1]) {
|
||||
maxHeight = winSize()[1] - (checkIt('msie') ? 60 : 90);
|
||||
}
|
||||
// For some reason Netscape won't accept style.height greater than 10000px
|
||||
this.element.style.height = maxHeight - (checkIt('msie') ? 8 : 0) + 'px';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function winSize() {
|
||||
var myWidth = 0, myHeight = 0;
|
||||
if (typeof (window.innerWidth) == 'number') {
|
||||
//Non-IE
|
||||
myWidth = window.innerWidth - 16;
|
||||
myHeight = window.innerHeight - 16;
|
||||
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
|
||||
//IE 6+ in 'standards compliant mode'
|
||||
myWidth = document.documentElement.clientWidth - 20;
|
||||
myHeight = document.documentElement.clientHeight - 20;
|
||||
} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
|
||||
//IE 4 compatible
|
||||
myWidth = document.body.clientWidth - 20;
|
||||
myHeight = document.body.clientHeight - 20;
|
||||
}
|
||||
return new Array(myWidth, myHeight);
|
||||
}
|
||||
|
||||
// safari, omniweb, opera, webtv, icab, msie
|
||||
function checkIt(string) {
|
||||
return navigator.userAgent.toLowerCase().indexOf(string) + 1;
|
||||
}
|
||||
|
||||
function LFEtextarea_init() {
|
||||
var textareas = document.getElementsByTagName('textarea');
|
||||
// Somehow var i was being corrupted.
|
||||
// Only when max(3) or max(2) called.
|
||||
// Using z instead. Weird.
|
||||
for (var z = 0; z < textareas.length; z++) {
|
||||
new TextAreaResizer(textareas[z]);
|
||||
}
|
||||
// Re-init dom-tooltips (if available), so tooltips are shown for handles
|
||||
typeof tooltip != 'undefined' ? tooltip.init(new Array('hr', 'a')) : 0;
|
||||
}
|
||||
|
||||
if (typeof schedule != 'function') {
|
||||
function addEvent(obj, evType, fn, useCapture) {
|
||||
if (obj.addEventListener) {
|
||||
obj.addEventListener(evType, fn, useCapture);
|
||||
return true;
|
||||
} else if (obj.attachEvent) {
|
||||
return obj.attachEvent("on" + evType, fn);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function removeEvent(obj, evType, fn, useCapture) {
|
||||
if (obj.removeEventListener) {
|
||||
obj.removeEventListener(evType, fn, useCapture);
|
||||
return true;
|
||||
} else if (obj.detachEvent) {
|
||||
return obj.detachEvent('on' + evType, fn);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
addEvent(window, 'load', function() {
|
||||
LFEtextarea_init();
|
||||
}, false);
|
||||
} else {
|
||||
schedule('textarea_init()');
|
||||
}
|
||||
Reference in New Issue
Block a user