User:Canadabonk/common.js: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 66: Line 66:
//edit button begin
//edit button begin
if (!$('body.action-edit').length) {
sidetools.append('<div class="ct-edit"><a class="ct-sidetools-button"></a></div>');
sidetools.append('<div class="ct-edit"><a class="ct-sidetools-button"></a></div>');
const
const
faEditButton = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M362.7 19.3L314.3 67.7 444.3 197.7l48.4-48.4c25-25 25-65.5 0-90.5L453.3 19.3c-25-25-65.5-25-90.5 0zm-71 71L58.6 323.5c-10.4 10.4-18 23.3-22.2 37.4L1 481.2C-1.5 489.7 .8 498.8 7 505s15.3 8.5 23.7 6.1l120.3-35.4c14.1-4.2 27-11.8 37.4-22.2L421.7 220.3 291.7 90.3z"/></svg>',
faViewSource = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z"/></svg>',
faEditButton = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M362.7 19.3L314.3 67.7 444.3 197.7l48.4-48.4c25-25 25-65.5 0-90.5L453.3 19.3c-25-25-65.5-25-90.5 0zm-71 71L58.6 323.5c-10.4 10.4-18 23.3-22.2 37.4L1 481.2C-1.5 489.7 .8 498.8 7 505s15.3 8.5 23.7 6.1l120.3-35.4c14.1-4.2 27-11.8 37.4-22.2L421.7 220.3 291.7 90.3z"/></svg>',
faViewSource = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z"/></svg>',
cosmosEditButton = $('.cosmos-actions-edit').first(),
cosmosEditButton = $('.cosmos-actions-edit').first(),
editButtonHref = cosmosEditButton.parent().attr('href'),
editButtonText = cosmosEditButton.find('.cosmos-button-text').text(),
editButtonHref = cosmosEditButton.parent().attr('href'),
editButtonText = cosmosEditButton.find('.cosmos-button-text').text(),
sidetoolsEditButton = $('.ct-edit .ct-sidetools-button');
sidetoolsEditButton = $('.ct-edit .ct-sidetools-button');
sidetoolsEditButton.attr({
sidetoolsEditButton.attr({
'href': editButtonHref,
'title': editButtonText
'href': editButtonHref,
'title': editButtonText
});
});
if (cosmosEditButton.attr('id') == 'ca-viewsource') {
if (cosmosEditButton.attr('id') == 'ca-viewsource') {
sidetoolsEditButton.append(faViewSource);
sidetoolsEditButton.append(faViewSource);
} else {
} else {
sidetoolsEditButton.append(faEditButton);
sidetoolsEditButton.append(faEditButton);
}
}
}
} //end desktop
} //end desktop