diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-03-22 12:00:29 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2023-03-22 12:00:29 +0000 |
| commit | b8ac06e96379c20d55009144c580089a0a7404aa (patch) | |
| tree | c2463ed506d31a13435bea4abef6c3ba59ad22d3 /resources | |
| parent | 3dcee65137d7c25129c93a2f197084e2e9c8ab2f (diff) | |
remove smileys, fixes #2403
Closes #2403
Merge request studip/studip!1599
Diffstat (limited to 'resources')
| -rw-r--r-- | resources/assets/javascripts/bootstrap/smiley.js | 19 | ||||
| -rw-r--r-- | resources/assets/javascripts/bootstrap/smiley_picker.js | 7 | ||||
| -rw-r--r-- | resources/assets/javascripts/entry-base.js | 2 | ||||
| -rw-r--r-- | resources/assets/javascripts/init.js | 2 | ||||
| -rw-r--r-- | resources/assets/javascripts/lib/forum.js | 4 | ||||
| -rw-r--r-- | resources/assets/javascripts/lib/smiley_picker.js | 128 | ||||
| -rw-r--r-- | resources/assets/javascripts/lib/toolbar_buttonset.js | 10 | ||||
| -rw-r--r-- | resources/assets/stylesheets/scss/forum.scss | 5 | ||||
| -rw-r--r-- | resources/assets/stylesheets/scss/smileys.scss | 193 | ||||
| -rw-r--r-- | resources/assets/stylesheets/studip.scss | 1 |
10 files changed, 0 insertions, 371 deletions
diff --git a/resources/assets/javascripts/bootstrap/smiley.js b/resources/assets/javascripts/bootstrap/smiley.js deleted file mode 100644 index d584b1c..0000000 --- a/resources/assets/javascripts/bootstrap/smiley.js +++ /dev/null @@ -1,19 +0,0 @@ -$(document).on('click', '.smiley-toggle', function(event) { - var element = $(this); - - element.prop('disabled', true).addClass('ajax'); - - $.getJSON(element.attr('href')).then(function(json) { - var container = $(element) - .closest('.ui-dialog-content,#content') - .first(); - $('.messagebox', container).remove(); - container.prepend(json.message); - - element - .toggleClass('favorite', json.state) - .removeClass('ajax') - .prop('disabled', false); - }); - event.preventDefault(); -}); diff --git a/resources/assets/javascripts/bootstrap/smiley_picker.js b/resources/assets/javascripts/bootstrap/smiley_picker.js deleted file mode 100644 index 0c5ea35..0000000 --- a/resources/assets/javascripts/bootstrap/smiley_picker.js +++ /dev/null @@ -1,7 +0,0 @@ -// Navigation: Load any url in this very same dialog -$(document).on('click', '.smiley-picker .navigation a', STUDIP.SmileyPicker.handleNavigationClick); - -// Smiley: -// Execute select handler with selected smiley's code -// (typically adds the code to a certain textarea) -$(document).on('click', '.smiley-picker .smiley', STUDIP.SmileyPicker.handleSmileyClick); diff --git a/resources/assets/javascripts/entry-base.js b/resources/assets/javascripts/entry-base.js index 9464a9c..f6f5595 100644 --- a/resources/assets/javascripts/entry-base.js +++ b/resources/assets/javascripts/entry-base.js @@ -29,7 +29,6 @@ import "./bootstrap/header_magic.js" import "./bootstrap/header_navigation.js" import "./bootstrap/personal_notifications.js" import "./bootstrap/sidebar.js" -import "./bootstrap/smiley_picker.js" import "./bootstrap/dialog.js" import "./bootstrap/jsupdater.js" import "./bootstrap/files.js" @@ -53,7 +52,6 @@ import "./bootstrap/qr_code.js" import "./bootstrap/startpage.js" import "./bootstrap/wiki.js" import "./bootstrap/course_wizard.js" -import "./bootstrap/smiley.js" import "./bootstrap/big_image_handler.js" import "./bootstrap/opengraph.js" import "./bootstrap/actionmenu.js" diff --git a/resources/assets/javascripts/init.js b/resources/assets/javascripts/init.js index 68ed726..e01f84e 100644 --- a/resources/assets/javascripts/init.js +++ b/resources/assets/javascripts/init.js @@ -69,7 +69,6 @@ import Scroll from './lib/scroll.js'; import Search from './lib/search.js'; import Sidebar from './lib/sidebar.js'; import SkipLinks from './lib/skip_links.js'; -import SmileyPicker from './lib/smiley_picker.js'; import startpage from './lib/startpage.js'; import Statusgroups from './lib/statusgroups.js'; import study_area_selection from './lib/study_area_selection.js'; @@ -155,7 +154,6 @@ window.STUDIP = _.assign(window.STUDIP || {}, { Search, Sidebar, SkipLinks, - SmileyPicker, startpage, Statusgroups, study_area_selection, diff --git a/resources/assets/javascripts/lib/forum.js b/resources/assets/javascripts/lib/forum.js index 1ff2bf5..fbada1f 100644 --- a/resources/assets/javascripts/lib/forum.js +++ b/resources/assets/javascripts/lib/forum.js @@ -63,10 +63,6 @@ const Forum = { STUDIP.Forum.attachEventHandlers(); }, - insertSmiley: function(textarea_id, element) { - jQuery('textarea[data-textarea=' + textarea_id + ']').insertAtCaret(jQuery(element).data('smiley')); - }, - approveDelete: function () { if (STUDIP.Forum.current_area_id) { // hide the area in the dom diff --git a/resources/assets/javascripts/lib/smiley_picker.js b/resources/assets/javascripts/lib/smiley_picker.js deleted file mode 100644 index 21d8bc2..0000000 --- a/resources/assets/javascripts/lib/smiley_picker.js +++ /dev/null @@ -1,128 +0,0 @@ -/** - * smiley-picker.js - Smiley Picker - * - * Creates a SmileyPicker object in the global STUDIP namespace with - * the methods show, hide and toggle. - * show and toggle accept two arguments "triggerElement, onSelect": - * - triggerElement is the element that triggered the event - * - onSelect is a function to be executed once a smiley is selected - * - * The picker requires a php based backend under the route - * "smileys/picker" which renders the html for the picker. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * @author Jan-Hendrik Willms <tleilax+studip@gmail.com> - * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 - * @category Stud.IP - */ -import { $gettext } from './gettext.js'; -import Dialog from './dialog.js'; - -var initialized = false, - picker_element = $('<div/>'), - select_handler = function() {}; - -// Loads a url -function loadURL(url, callback) { - $.get(url, function(response) { - response = $(response); - - // Add a preload icon for each smiley to avoid a potential flash - // of the alternative text - $('.smileys img', response).each(function() { - var that = this, - src = this.src, - image = new Image(); - this.src = STUDIP.ASSETS_URL + 'images/loading-indicator.gif'; - - image.onload = image.onerror = function() { - that.src = src; - }; - image.src = src; - }); - - picker_element.html(response); - - if ($.isFunction(callback)) { - callback(); - } - }); -} - -// Create smiley picker object and bind it to global STUDIP namespace -const SmileyPicker = { - // Show smiley picker, triggered by a specific element and handle - // a selected smiley by the passed function - show: function(triggerElement, onSelect) { - select_handler = onSelect; - - if (!initialized) { - // Setup picker dialog - picker_element.dialog({ - autoOpen: false, - width: 420, // needs to be hardcoded, unfortunately. - dialogClass: 'smiley-picker-dialog', - resizable: false, - title: $gettext('Smileys'), - show: 'fade', - hide: 'fade', - buttons: [ - { - text: $gettext('Zur Gesamtübersicht'), - click: function() { - var url = STUDIP.URLHelper.getURL('dispatch.php/smileys'); - picker_element.dialog('close'); - Dialog.fromURL(url); - } - }, - { - text: $gettext('Schliessen'), - click: function() { - picker_element.dialog('close'); - } - } - ] - }); - - // Initial load with spinner next to trigger element - $(triggerElement).showAjaxNotification(); - loadURL(STUDIP.URLHelper.getURL('dispatch.php/smileys/picker'), function() { - $(triggerElement).hideAjaxNotification(); - picker_element.dialog('open'); - }); - - initialized = true; - } else { - picker_element.dialog('open'); - } - }, - // Hide smiley picker - hide: function() { - picker_element.dialog('close'); - }, - // Toggle smiley picker display (pass the same arguments as for show) - toggle: function(triggerElement, onSelect) { - if (initialized && picker_element.dialog('isOpen')) { - SmileyPicker.hide(); - } else { - SmileyPicker.show(triggerElement, onSelect); - } - }, - - handleNavigationClick: function(event) { - loadURL(this.href); - return false; - }, - - handleSmileyClick: function(event) { - select_handler($(this).data().code); - picker_element.dialog('close'); - return false; - } -}; - -export default SmileyPicker; diff --git a/resources/assets/javascripts/lib/toolbar_buttonset.js b/resources/assets/javascripts/lib/toolbar_buttonset.js index 5bb211f..cd92f54 100644 --- a/resources/assets/javascripts/lib/toolbar_buttonset.js +++ b/resources/assets/javascripts/lib/toolbar_buttonset.js @@ -1,5 +1,3 @@ -import SmileyPicker from './smiley_picker.js'; - // Creates a wrapper function that wraps the passed string using the // passed prefix and suffix. If the suffix is omitted, it will be replaced // by the prefix. @@ -54,14 +52,6 @@ const buttonSet = { } }, right: { - smilies: { - label: ':)', - evaluate: function(string, textarea, button) { - SmileyPicker.toggle(button, function(code) { - textarea.replaceSelection(code + ' '); - }); - } - }, help: { label: '?', evaluate: function() { diff --git a/resources/assets/stylesheets/scss/forum.scss b/resources/assets/stylesheets/scss/forum.scss index f46383c..0638330 100644 --- a/resources/assets/stylesheets/scss/forum.scss +++ b/resources/assets/stylesheets/scss/forum.scss @@ -329,11 +329,6 @@ html.no-js #forum { } } - .smiley_favorites { - text-align: center; - padding-right: 5px; - } - a.tooltip2 { color: black; cursor: help; diff --git a/resources/assets/stylesheets/scss/smileys.scss b/resources/assets/stylesheets/scss/smileys.scss deleted file mode 100644 index e6bc47c..0000000 --- a/resources/assets/stylesheets/scss/smileys.scss +++ /dev/null @@ -1,193 +0,0 @@ -.smiley-tabs { - display: flex; - justify-content: space-between; - margin: 0 0 0.5em; - line-height: 1.8em; - width: 100%; - - &, li { - list-style: none; - padding: 0; - } - - li { - flex-grow: 1; - display: inline-block; - float: none; - margin: 0; - white-space: nowrap; - - &.favorites a { - @include icon(before, smiley, info_alt); - } - - &.favorites.current a { - @include icon(before, smiley, info); - } - &.current { - padding-top: 0; - a, span.quiet { - color: $base-color; - } - } - } - - a { - display: block; - padding-left: 0; - padding-right: 0; - text-align: center; - color: $black - } -} - -.smiley-container { - border-collapse: collapse; - width: 100%; - - > tbody > tr > td { - padding: 0 1em 0 0; - - &:last-child { - padding-right: 0; - } - } -} - -.smiley-container, .smiley-column { - table-layout: fixed; -} - -.smiley-column { - margin-right: 1em; - - &:last-child { - margin-right: 0; - } -} - -.smiley-icon { - img { - height: auto; - max-width: 100%; - width: auto; - } -} - -.smiley-toggle { - @include square(16px); - @include hide-text(); - @include background-icon(checkbox-unchecked, clickable); - background-position: center; - background-repeat: no-repeat; - display: inline-block; - vertical-align: middle; - - &.favorite { - @include background-icon(checkbox-checked, clickable); - } - - &.ajax { - background-image: url("#{$image-path}/loading-indicator.svg"); - } -} - -.smiley-statistics { - margin: 0; - padding: 0; - - dt { - clear: left; - float: left; - padding-right: 0.5em; - - &::after { - content: ':'; - } - } - - dd { - font-weight: 700; - margin: 0; - text-align: right; - } -} - -.smiley-picker { - width: 420px; - - .smileys { - text-align: center; - width: 100%; - padding: 5px 0; - } - - .smiley, .empty { - display: inline-block; - height: 80px; - vertical-align: middle; - width: 80px; - } - - .smiley { - box-sizing: border-box; - cursor: pointer; - max-height: 80px; - max-width: 80px; - text-align: center; - - // see http://css-tricks.com/centering-in-the-unknown/ - &:before { - content: ''; - display: inline-block; - height: 100%; - vertical-align: middle; - margin-right: -0.25em; - } - - img { - vertical-align: middle; - max-height: 76px; - max-width: 72px; - margin-right: 0.25em; - } - - &:hover { - background-color: fade($active-color, 10%); - border-radius: 20px; - box-shadow: 0 -1px 4px fade($active-color, 10%), 0 2px 5px #888; - } - } - - .navigation { - border-collapse: collapse; - width: 100%; - - img { - vertical-align: text-top; - } - - td { - padding: 2px; - } - - &.top td { - border-bottom: 1px solid $brand-color-dark; - } - - &.bottom td { - border-top: 1px solid $brand-color-dark; - } - - .active a { - color: $active-color; - font-weight: bold; - } - } -} - -.smiley-picker-dialog { - .ui-dialog-content { - padding: 0; - } -} diff --git a/resources/assets/stylesheets/studip.scss b/resources/assets/stylesheets/studip.scss index fb38beb..5a462db 100644 --- a/resources/assets/stylesheets/studip.scss +++ b/resources/assets/stylesheets/studip.scss @@ -87,7 +87,6 @@ @import "scss/skiplinks"; @import "scss/start"; @import "scss/scroll-to-top"; -@import "scss/smileys"; @import "scss/statusgroups"; @import "scss/study-area-selection"; @import "scss/studygroup"; |
