Refactoring: more deleted unused scripts and optimizations

This commit is contained in:
alexandervnuchkov 2018-10-05 11:52:35 +03:00
parent 82fc5224a1
commit f883f93eff
13 changed files with 32 additions and 638 deletions

View File

@ -1009,15 +1009,15 @@ html {
padding: 20px 0 10px;
line-height: 1.3em;
}
.block-editor {
.block-editor, .inpage-toggler {
min-height: 30px;
span.toggler {
left: 0;
right: auto;
top: 10px;
}
.contents {
padding-top: 40px;
.contents, .ipcontents {
padding: 40px 0 20px;
}
}
}
@ -2878,10 +2878,10 @@ iframe.tleditors {
top: 12px;
}
}
.block-editor {
.block-editor, .inpage-toggler {
position: relative;
}
span.toggler {
span.toggler, span.iptoggler {
border-bottom: 1px dotted @textColorLinkMain;
color: @textColorLinkMain;
cursor: pointer;
@ -3138,6 +3138,12 @@ table.table_parameters {
text-align: center;
width: 100%;
&.outdated_versions {
td {
width: auto;
}
}
&.talk_pages {
td {
width: auto;

File diff suppressed because one or more lines are too long

View File

@ -1,5 +0,0 @@
var clipboard = new Clipboard('.copy_code_btn', {
target: function () {
return document.querySelector('pre.prettyprint.source.linenums');
}
});

View File

@ -1 +0,0 @@
var clipboard=new Clipboard(".copy_code_btn",{target:function(){return document.querySelector("pre.prettyprint.source.linenums")}});

View File

@ -1,98 +0,0 @@
var ActionUrl = {
Upload: null,
Generate: null,
Create: null,
Download: null
};
var DocumentBuilder = (function () {
function init() {
setBindings();
}
function setBindings() {
var errorMsg = $("[id$=_ErrorHiddenField]").val();
if (errorMsg){
toastr.error(errorMsg, "An error has occurred");
$("[id$=_ErrorHiddenField]").val("");
}
$("[id$=_FileUpload]").on("change", function () {
var error = false;
$.each(this.files, function () {
if (!this.name) {
toastr.error("File name is empty.", "An error has occurred");
error = true;
return;
}
var parts = this.name.split(".");
var extension = parts[parts.length - 1];
if (!extension || extension.toLowerCase() != "docbuilder") {
toastr.error("The uploaded file is not valid. Please select another file and try again.", "An error has occurred");
error = true;
}
});
if (error) return;
$("[id$=_UploadButton]").click();
});
$("#GenerateBtn").on("click", function () {
if (!$("[id$=_PredefinedScript]").val().trim()) {
toastr.error("The script is empty.", "An error has occurred");
return;
}
$("[id$=_GenerateButton]").click();
});
$(".try-editor").on("click", function () {
var data = {
Type: $(this).attr("data-value").trim(),
Name: $("[id$=_NameText]").val().trim(),
Company: $("[id$=_CompanyText]").val().trim(),
Title: $("[id$=_TitleText]").val().trim()
};
if (!data.Type) {
toastr.error("Empty document type", "An error has occurred");
return;
} else {
$("[id$=_DocumentTypeHiddenField]").val(data.Type);
}
if (!data.Name) {
toastr.error("Empty name field", "An error has occurred");
return;
}
if (!data.Company) {
toastr.error("Empty company field", "An error has occurred");
return;
}
if (!data.Title) {
toastr.error("Empty title field", "An error has occurred");
return;
}
$("[id$=_CreateButton]").click();
});
}
return {
init: init
};
})();

View File

@ -1,415 +0,0 @@
/*
* Toastr
* Copyright 2012-2015
* Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
* All Rights Reserved.
* Use, reproduction, distribution, and modification of this code is subject to the terms and
* conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
*
* ARIA Support: Greta Krafsig
*
* Project: https://github.com/CodeSeven/toastr
*/
/* global define */
; (function (define) {
define(['jquery'], function ($) {
return (function () {
var $container;
var listener;
var toastId = 0;
var toastType = {
error: 'error',
info: 'info',
success: 'success',
warning: 'warning'
};
var toastr = {
clear: clear,
remove: remove,
error: error,
getContainer: getContainer,
info: info,
options: {},
subscribe: subscribe,
success: success,
version: '2.1.1',
warning: warning
};
var previousToast;
return toastr;
////////////////
function error(message, title, optionsOverride) {
return notify({
type: toastType.error,
iconClass: getOptions().iconClasses.error,
message: message,
optionsOverride: optionsOverride,
title: title
});
}
function getContainer(options, create) {
if (!options) { options = getOptions(); }
$container = $('#' + options.containerId);
if ($container.length) {
return $container;
}
if (create) {
$container = createContainer(options);
}
return $container;
}
function info(message, title, optionsOverride) {
return notify({
type: toastType.info,
iconClass: getOptions().iconClasses.info,
message: message,
optionsOverride: optionsOverride,
title: title
});
}
function subscribe(callback) {
listener = callback;
}
function success(message, title, optionsOverride) {
return notify({
type: toastType.success,
iconClass: getOptions().iconClasses.success,
message: message,
optionsOverride: optionsOverride,
title: title
});
}
function warning(message, title, optionsOverride) {
return notify({
type: toastType.warning,
iconClass: getOptions().iconClasses.warning,
message: message,
optionsOverride: optionsOverride,
title: title
});
}
function clear($toastElement, clearOptions) {
var options = getOptions();
if (!$container) { getContainer(options); }
if (!clearToast($toastElement, options, clearOptions)) {
clearContainer(options);
}
}
function remove($toastElement) {
var options = getOptions();
if (!$container) { getContainer(options); }
if ($toastElement && $(':focus', $toastElement).length === 0) {
removeToast($toastElement);
return;
}
if ($container.children().length) {
$container.remove();
}
}
// internal functions
function clearContainer (options) {
var toastsToClear = $container.children();
for (var i = toastsToClear.length - 1; i >= 0; i--) {
clearToast($(toastsToClear[i]), options);
}
}
function clearToast ($toastElement, options, clearOptions) {
var force = clearOptions && clearOptions.force ? clearOptions.force : false;
if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
$toastElement[options.hideMethod]({
duration: options.hideDuration,
easing: options.hideEasing,
complete: function () { removeToast($toastElement); }
});
return true;
}
return false;
}
function createContainer(options) {
$container = $('<div/>')
.attr('id', options.containerId)
.addClass(options.positionClass)
.attr('aria-live', 'polite')
.attr('role', 'alert');
$container.appendTo($(options.target));
return $container;
}
function getDefaults() {
return {
tapToDismiss: true,
toastClass: 'toast',
containerId: 'toast-container',
debug: false,
showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
showDuration: 300,
showEasing: 'swing', //swing and linear are built into jQuery
onShown: undefined,
hideMethod: 'fadeOut',
hideDuration: 1000,
hideEasing: 'swing',
onHidden: undefined,
extendedTimeOut: 1000,
iconClasses: {
error: 'toast-error',
info: 'toast-info',
success: 'toast-success',
warning: 'toast-warning'
},
iconClass: 'toast-info',
positionClass: 'toast-top-right',
timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
titleClass: 'toast-title',
messageClass: 'toast-message',
target: 'body',
closeHtml: '<button type="button">&times;</button>',
newestOnTop: true,
preventDuplicates: false,
progressBar: false
};
}
function publish(args) {
if (!listener) { return; }
listener(args);
}
function notify(map) {
var options = getOptions();
var iconClass = map.iconClass || options.iconClass;
if (typeof (map.optionsOverride) !== 'undefined') {
options = $.extend(options, map.optionsOverride);
iconClass = map.optionsOverride.iconClass || iconClass;
}
if (shouldExit(options, map)) { return; }
toastId++;
$container = getContainer(options, true);
var intervalId = null;
var $toastElement = $('<div/>');
var $titleElement = $('<div/>');
var $messageElement = $('<div/>');
var $progressElement = $('<div/>');
var $closeElement = $(options.closeHtml);
var progressBar = {
intervalId: null,
hideEta: null,
maxHideTime: null
};
var response = {
toastId: toastId,
state: 'visible',
startTime: new Date(),
options: options,
map: map
};
personalizeToast();
displayToast();
handleEvents();
publish(response);
if (options.debug && console) {
console.log(response);
}
return $toastElement;
function personalizeToast() {
setIcon();
setTitle();
setMessage();
setCloseButton();
setProgressBar();
setSequence();
}
function handleEvents() {
$toastElement.hover(stickAround, delayedHideToast);
if (!options.onclick && options.tapToDismiss) {
$toastElement.click(hideToast);
}
if (options.closeButton && $closeElement) {
$closeElement.click(function (event) {
if (event.stopPropagation) {
event.stopPropagation();
} else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
event.cancelBubble = true;
}
hideToast(true);
});
}
if (options.onclick) {
$toastElement.click(function () {
options.onclick();
hideToast();
});
}
}
function displayToast() {
$toastElement.hide();
$toastElement[options.showMethod](
{duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
);
if (options.timeOut > 0) {
intervalId = setTimeout(hideToast, options.timeOut);
progressBar.maxHideTime = parseFloat(options.timeOut);
progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
if (options.progressBar) {
progressBar.intervalId = setInterval(updateProgress, 10);
}
}
}
function setIcon() {
if (map.iconClass) {
$toastElement.addClass(options.toastClass).addClass(iconClass);
}
}
function setSequence() {
if (options.newestOnTop) {
$container.prepend($toastElement);
} else {
$container.append($toastElement);
}
}
function setTitle() {
if (map.title) {
$titleElement.append(map.title).addClass(options.titleClass);
$toastElement.append($titleElement);
}
}
function setMessage() {
if (map.message) {
$messageElement.append(map.message).addClass(options.messageClass);
$toastElement.append($messageElement);
}
}
function setCloseButton() {
if (options.closeButton) {
$closeElement.addClass('toast-close-button').attr('role', 'button');
$toastElement.prepend($closeElement);
}
}
function setProgressBar() {
if (options.progressBar) {
$progressElement.addClass('toast-progress');
$toastElement.prepend($progressElement);
}
}
function shouldExit(options, map) {
if (options.preventDuplicates) {
if (map.message === previousToast) {
return true;
} else {
previousToast = map.message;
}
}
return false;
}
function hideToast(override) {
if ($(':focus', $toastElement).length && !override) {
return;
}
clearTimeout(progressBar.intervalId);
return $toastElement[options.hideMethod]({
duration: options.hideDuration,
easing: options.hideEasing,
complete: function () {
removeToast($toastElement);
if (options.onHidden && response.state !== 'hidden') {
options.onHidden();
}
response.state = 'hidden';
response.endTime = new Date();
publish(response);
}
});
}
function delayedHideToast() {
if (options.timeOut > 0 || options.extendedTimeOut > 0) {
intervalId = setTimeout(hideToast, options.extendedTimeOut);
progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
}
}
function stickAround() {
clearTimeout(intervalId);
progressBar.hideEta = 0;
$toastElement.stop(true, true)[options.showMethod](
{duration: options.showDuration, easing: options.showEasing}
);
}
function updateProgress() {
var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
$progressElement.width(percentage + '%');
}
}
function getOptions() {
return $.extend({}, getDefaults(), toastr.options);
}
function removeToast($toastElement) {
if (!$container) { $container = getContainer(); }
if ($toastElement.is(':visible')) {
return;
}
$toastElement.remove();
$toastElement = null;
if ($container.children().length === 0) {
$container.remove();
previousToast = undefined;
}
}
})();
});
}(typeof define === 'function' && define.amd ? define : function (deps, factory) {
if (typeof module !== 'undefined' && module.exports) { //Node
module.exports = factory(require('jquery'));
} else {
window['toastr'] = factory(window['jQuery']);
}
}));

View File

@ -1,12 +0,0 @@
$(window).load(function() {
var pageTitleValue = $('h1.page-title').text();
if (pageTitleValue == '') {
return false;
} else {
$('.prettyprint.source.linenums li span').each(function (index) {
if ($(this).is(':contains(' + pageTitleValue + ')') && $(this).is(':not(:contains(".docx"))') && $(this).is(':not(:contains(".xlsx"))')) {
$(this).addClass('api_highlighted');
}
});
}
});

View File

@ -1,25 +0,0 @@
/*global document */
(function() {
var source = document.getElementsByClassName('prettyprint source linenums');
var i = 0;
var lineNumber = 0;
var lineId;
var lines;
var totalLines;
var anchorHash;
if (source && source[0]) {
anchorHash = document.location.hash.substring(1);
lines = source[0].getElementsByTagName('li');
totalLines = lines.length;
for (; i < totalLines; i++) {
lineNumber++;
lineId = 'line' + lineNumber;
lines[i].id = lineId;
if (lineId === anchorHash) {
lines[i].className += ' selected';
}
}
}
})();

View File

@ -1 +0,0 @@
!function(){var lineId,lines,totalLines,anchorHash,source=document.getElementsByClassName("prettyprint source linenums"),i=0,lineNumber=0;if(source&&source[0])for(anchorHash=document.location.hash.substring(1),lines=source[0].getElementsByTagName("li"),totalLines=lines.length;totalLines>i;i++)lineNumber++,lineId="line"+lineNumber,lines[i].id=lineId,lineId===anchorHash&&(lines[i].className+=" selected")}();

View File

@ -1,2 +0,0 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);

View File

@ -1,7 +0,0 @@
$(document).ready(function () {
var iframeSrcValue = $('iframe').attr('src');
if (iframeSrcValue == '') {
$('section article').append("<p class=\"iframe2b\">The resulting sample document will be available here with the nearest ONLYOFFICE Document Builder API documentation website update.</p>");
$('iframe').css('height', '10px');
}
});

View File

@ -143,68 +143,25 @@
//init Top Navigation Menu events
$.dropdownToggle({
dropdownID: "navitem_desktop_menu",
switcherSelector: "#navitem_desktop",
simpleToggle: true,
showFunction: function (switcherObj, dropdownItem) {
if (dropdownItem.is(":hidden")) {
switcherObj.addClass("active");
} else {
switcherObj.removeClass("active");
}
},
hideFunction: function () {
$("#navitem_desktop").removeClass("active");
}
});
$( "nav ul li a.menuitem" ).each(function( index ) {
var menuitemID = $(this).attr('id'),
menuitemDropDown = menuitemID + '_menu';
$.dropdownToggle({
dropdownID: "navitem_features_menu",
switcherSelector: "#navitem_features",
simpleToggle: true,
showFunction: function (switcherObj, dropdownItem) {
if (dropdownItem.is(":hidden")) {
switcherObj.addClass("active");
} else {
switcherObj.removeClass("active");
$.dropdownToggle({
dropdownID: menuitemDropDown,
switcherSelector: "#" + menuitemID,
simpleToggle: true,
showFunction: function (switcherObj, dropdownItem) {
if (dropdownItem.is(":hidden")) {
switcherObj.addClass("active");
} else {
switcherObj.removeClass("active");
}
},
hideFunction: function () {
$("#" + menuitemID).removeClass("active");
}
},
hideFunction: function () {
$("#navitem_features").removeClass("active");
}
});
$.dropdownToggle({
dropdownID: "navitem_mobile_menu",
switcherSelector: "#navitem_mobile",
simpleToggle: true,
showFunction: function (switcherObj, dropdownItem) {
if (dropdownItem.is(":hidden")) {
switcherObj.addClass("active");
} else {
switcherObj.removeClass("active");
}
},
hideFunction: function () {
$("#navitem_mobile").removeClass("active");
}
});
$.dropdownToggle({
dropdownID: "navitem_server_menu",
switcherSelector: "#navitem_server",
simpleToggle: true,
showFunction: function (switcherObj, dropdownItem) {
if (dropdownItem.is(":hidden")) {
switcherObj.addClass("active");
} else {
switcherObj.removeClass("active");
}
},
hideFunction: function () {
$("#navitem_server").removeClass("active");
}
});
});
//init Navigation Menu events

View File

@ -34,6 +34,10 @@ $(document).ready(function() {
i.removeClass("current"), n.addClass("current");
var t = i.not(".current");
e.siblings(".described").slideToggle(), e.siblings(".contents").slideToggle(), e.parent().find(".toggler").toggle(), t.find(".contents").slideUp(), t.find(".described").slideDown(), t.find(".toggler.showcont").show(), t.find(".toggler.hidecont").hide()
}), $('.inpage-toggler .iptoggler').on('click', function(){
$(this).siblings('.ipcontents').slideToggle();
$(this).siblings('.iptoggler').toggle();
$(this).toggle();
}), $(".sitemap_new ul.smn_node_1 li").each(function(e) {
var n = '<span class="expanded_node"></span>';
return $("ul.smn_node_1 li").has("ul").prepend(n), !1