From 676bb4aebcbb65f6271f062d03aef2a48346f2e3 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 9 Feb 2018 16:17:03 +0100 Subject: [backup] Use permission helpers --- script/slx-fixes.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'script/slx-fixes.js') diff --git a/script/slx-fixes.js b/script/slx-fixes.js index 12db9c79..1ed71cb9 100644 --- a/script/slx-fixes.js +++ b/script/slx-fixes.js @@ -1,6 +1,8 @@ // Give file select dialogs a modern style and feel $(document).on('change', '.btn-file :file', function() { var input = $(this); + if (input.parents('.disabled').length !== 0) + return; var numFiles = input.get(0).files ? input.get(0).files.length : 1; var label = input.val().replace(/\\/g, '/').replace(/.*\//, ''); input.trigger('fileselect', [numFiles, label]); @@ -15,23 +17,23 @@ $(document).ready(function() { }); }); $('.upload-ex :text').click(function () { - $(this).parents('.upload-ex').find(':file').click(); + var $this = $(this); + if ($this.parents('.disabled').length !== 0) + return; + $this.parents('.upload-ex').find(':file').click(); }); // Replace message query params in URL, so you won't see them again if you bookmark or share the link if (history && history.replaceState && window && window.location && window.location.search && window.location.search.indexOf('message[]=') !== -1) { var str = window.location.search; - console.log('TRUE: ' + str); do { var repl = str.match(/([\?&])message\[\]=[^&]+(&|$)/); - console.log(repl); if (!repl) break; if (repl[2].length === 0) { str = str.replace(repl[0], ''); } else { str = str.replace(repl[0], repl[1]); } - console.log('Replace: ' + str); } while (1); history.replaceState(null, null, window.location.pathname + str); } -- cgit v1.2.3-55-g7522 From d879774ad2b6cc5ce3f870eb85972245464c56b3 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 12 Feb 2018 18:00:45 +0100 Subject: slx-fixes.js/default.css: Fix disabled cursor-style --- script/slx-fixes.js | 7 +++++++ style/default.css | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'script/slx-fixes.js') diff --git a/script/slx-fixes.js b/script/slx-fixes.js index 1ed71cb9..9cd93c05 100644 --- a/script/slx-fixes.js +++ b/script/slx-fixes.js @@ -41,4 +41,11 @@ if (history && history.replaceState && window && window.location && window.locat // Simple decollapse functionality for tables $('.slx-decollapse').click(function () { $(this).siblings('.collapse').removeClass('collapse'); +}); + +$('a.disabled').each(function() { + var $this = $(this); + var $hax = $('
'); + $this.after($hax); + $hax.append($this); }); \ No newline at end of file diff --git a/style/default.css b/style/default.css index 57f76f69..a9d45681 100644 --- a/style/default.css +++ b/style/default.css @@ -600,12 +600,22 @@ table.slx-ellipsis td { white-space: nowrap; } -div.disabled input, div.disabled label { - pointer-events: none; +div.disabled { cursor: not-allowed; } +div.disabled input, div.disabled label, div.disabled .btn { + pointer-events: none; +} + .input-group-addon > label { font-weight: normal; margin-bottom: inherit; +} + +div.disabled-hack { + cursor: not-allowed; + margin: 0; + padding: 0; + display: inline-block; } \ No newline at end of file -- cgit v1.2.3-55-g7522 From f17c3d0aa5c5a4c5a26f44badb123022b0767c78 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 19 Feb 2018 13:38:03 +0100 Subject: slx-fixes.js: Refine disabled style hack to not ruin btn-groups --- script/slx-fixes.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'script/slx-fixes.js') diff --git a/script/slx-fixes.js b/script/slx-fixes.js index 9cd93c05..a5864efb 100644 --- a/script/slx-fixes.js +++ b/script/slx-fixes.js @@ -43,8 +43,10 @@ $('.slx-decollapse').click(function () { $(this).siblings('.collapse').removeClass('collapse'); }); +// Show not-allowed cursor for disabled links (not in btn-group as it messes up the style) $('a.disabled').each(function() { var $this = $(this); + if ($this.parent().hasClass('btn-group')) return; var $hax = $('
'); $this.after($hax); $hax.append($this); -- cgit v1.2.3-55-g7522