From 202925302e94ef330d6557b3053536e6dec64ba9 Mon Sep 17 00:00:00 2001 From: Yann Flory Date: Tue, 20 Sep 2016 11:59:13 +0200 Subject: [PATCH] Display a indicator for read-only pads in the main page --- customize.dist/main.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/customize.dist/main.js b/customize.dist/main.js index 3e9eab3b5..d9220a8d7 100644 --- a/customize.dist/main.js +++ b/customize.dist/main.js @@ -106,9 +106,17 @@ define([ }); }); + var readOnly = false; + if (pad.href.indexOf('#') !== -1) { + var modeArray = pad.href.split('#')[1].split('/'); + if (modeArray.length >= 3 && modeArray[2] === 'view') { + readOnly = true; + } + } + var readOnlyText = readOnly ? '(' + Messages.readonly + ') ' : ''; $row .append($('').text(name)) - .append($('').append($('', { + .append($('').append(readOnlyText).append($('', { href: pad.href, title: pad.title, }).text(shortTitle))) @@ -134,6 +142,9 @@ define([ if (hasRecent) { $('table').attr('style', ''); + // Race condition here, this is triggered before the localization in HTML + // so we have to remove the data-localization attr + $tryit.removeAttr('data-localization'); $tryit.text(Messages.recentPads); } });