helpcenter/Web/js/help/editor.tables.js
2019-04-19 18:47:53 +03:00

49 lines
2.5 KiB
JavaScript

$(function() {
$(".document_editors .formats tr td").each(function() {
"+" == $(this).text() ? $(this).html('<span class="yes"></span>') : "" == $(this).text() && $(this).html('<span class="no"></span>')
}), $(".document_editors .formats tr td:nth-child(3)").addClass("centeredText"), $(".document_editors .formats tr td:nth-child(4)").addClass("centeredText"), $(".document_editors .formats tr td:nth-child(5)").addClass("centeredText"), $(".document_editors .formats tr:first-child").addClass("tableHeader");
function shortcutToggler(enabled,disabled,enabled_opt,disabled_opt){
var selectorTD_en = '.keyboard_shortcuts_table tr td:nth-child(' + enabled + ')',
selectorTD_dis = '.keyboard_shortcuts_table tr td:nth-child(' + disabled + ')';
$(disabled_opt).removeClass('enabled').addClass('disabled');
$(enabled_opt).removeClass('disabled').addClass('enabled');
$(selectorTD_dis).hide();
$(selectorTD_en).show().each(function() {
if($(this).text() == ''){
$(this).parent('tr').hide();
} else {
$(this).parent('tr').show();
}
});
}
if (navigator.platform.toUpperCase().indexOf('MAC') >= 0) {
shortcutToggler(3,2,'.mac_option','.pc_option');
$('.mac_option').removeClass('right_option').addClass('left_option');
$('.pc_option').removeClass('left_option').addClass('right_option');
} else {
shortcutToggler(2,3,'.pc_option','.mac_option');
}
$('.shortcut_toggle').on('click', function() {
if($(this).hasClass('mac_option')){
shortcutToggler(3,2,'.mac_option','.pc_option');
} else if ($(this).hasClass('pc_option')){
shortcutToggler(2,3,'.pc_option','.mac_option');
}
});
$('.document_editors .MainHelpCenter a').each(function() {
if($(this).attr('href')) {
var variable = $(this).attr('href').split('/');
if(variable[variable.length - 1] == '{{PLUGIN_LINK_MACROS}}'){
$(this).attr('href', 'https://api.onlyoffice.com/plugin/macros');
} else if (variable[variable.length - 1] == '{{PLUGIN_LINK}}') {
$(this).attr('href', 'https://api.onlyoffice.com/plugin/basic');
}
}
});
$('.document_editors .coediting .MainHelpCenter p b').each(function() {
if($(this).text() == '{{COEDITING_DESKTOP}}') {
$(this).text('Подключиться к облаку');
}
});
});