From 298752c8c4a53ea63d306a131b65d0c2152faac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saray=20Cabrera=20Padr=C3=B3n?= Date: Mon, 2 Sep 2019 19:51:04 +0200 Subject: [PATCH] Remove all unused bento JavaScript --- .../javascripts/webui/application.js.erb | 296 --------- .../webui/application/attribute.js | 5 - .../application/bento/global-navigation.js | 50 -- .../l10n/global-navigation-data-en_US.js | 149 ----- .../webui/application/bento/script.js | 208 ------ .../webui/application/cm2/index-diff.js | 17 - .../webui/application/cm2/index-prjconf.js | 17 - .../webui/application/cm2/index-xml.js | 17 - .../webui/application/cm2/index.js | 66 -- .../application/cm2/mode/baselibsconf.js | 70 -- .../webui/application/cm2/mode/dockerfile.js | 79 --- .../webui/application/cm2/mode/prjconf.js | 76 --- .../webui/application/cm2/mode/simple.js | 216 ------- .../webui/application/cm2/toolbars.js | 596 ------------------ .../webui/application/cm2/use-codemirror.js | 72 --- .../javascripts/webui/application/comment.js | 50 -- .../webui/application/datatables.js | 1 - .../webui/application/image_templates.js | 7 - .../webui/application/interconnect.js | 8 - .../webui/application/kiwi_editor.js | 448 ------------- .../webui/application/live_build_log.js | 117 ---- .../javascripts/webui/application/main.js | 10 - .../javascripts/webui/application/package.js | 84 --- .../webui/application/patchinfo.js.erb | 133 ---- .../javascripts/webui/application/project.js | 178 ------ .../webui/application/repository_tab.js | 48 -- .../javascripts/webui/application/request.js | 209 ------ .../webui/application/requests_table.js.erb | 68 -- .../javascripts/webui/application/tabs.js | 43 -- .../webui/application/upload_jobs.js | 6 - .../javascripts/webui/application/user.js | 7 - .../javascripts/webui/keybindings.js.coffee | 54 -- 32 files changed, 3405 deletions(-) delete mode 100644 src/api/app/assets/javascripts/webui/application.js.erb delete mode 100644 src/api/app/assets/javascripts/webui/application/attribute.js delete mode 100644 src/api/app/assets/javascripts/webui/application/bento/global-navigation.js delete mode 100644 src/api/app/assets/javascripts/webui/application/bento/l10n/global-navigation-data-en_US.js delete mode 100644 src/api/app/assets/javascripts/webui/application/bento/script.js delete mode 100644 src/api/app/assets/javascripts/webui/application/cm2/index-diff.js delete mode 100644 src/api/app/assets/javascripts/webui/application/cm2/index-prjconf.js delete mode 100644 src/api/app/assets/javascripts/webui/application/cm2/index-xml.js delete mode 100644 src/api/app/assets/javascripts/webui/application/cm2/index.js delete mode 100644 src/api/app/assets/javascripts/webui/application/cm2/mode/baselibsconf.js delete mode 100644 src/api/app/assets/javascripts/webui/application/cm2/mode/dockerfile.js delete mode 100644 src/api/app/assets/javascripts/webui/application/cm2/mode/prjconf.js delete mode 100644 src/api/app/assets/javascripts/webui/application/cm2/mode/simple.js delete mode 100644 src/api/app/assets/javascripts/webui/application/cm2/toolbars.js delete mode 100644 src/api/app/assets/javascripts/webui/application/cm2/use-codemirror.js delete mode 100644 src/api/app/assets/javascripts/webui/application/comment.js delete mode 100644 src/api/app/assets/javascripts/webui/application/datatables.js delete mode 100644 src/api/app/assets/javascripts/webui/application/image_templates.js delete mode 100644 src/api/app/assets/javascripts/webui/application/interconnect.js delete mode 100644 src/api/app/assets/javascripts/webui/application/kiwi_editor.js delete mode 100644 src/api/app/assets/javascripts/webui/application/live_build_log.js delete mode 100644 src/api/app/assets/javascripts/webui/application/main.js delete mode 100644 src/api/app/assets/javascripts/webui/application/package.js delete mode 100644 src/api/app/assets/javascripts/webui/application/patchinfo.js.erb delete mode 100644 src/api/app/assets/javascripts/webui/application/project.js delete mode 100644 src/api/app/assets/javascripts/webui/application/repository_tab.js delete mode 100644 src/api/app/assets/javascripts/webui/application/request.js delete mode 100644 src/api/app/assets/javascripts/webui/application/requests_table.js.erb delete mode 100644 src/api/app/assets/javascripts/webui/application/tabs.js delete mode 100644 src/api/app/assets/javascripts/webui/application/upload_jobs.js delete mode 100644 src/api/app/assets/javascripts/webui/application/user.js delete mode 100644 src/api/app/assets/javascripts/webui/keybindings.js.coffee diff --git a/src/api/app/assets/javascripts/webui/application.js.erb b/src/api/app/assets/javascripts/webui/application.js.erb deleted file mode 100644 index 7e72e147535..00000000000 --- a/src/api/app/assets/javascripts/webui/application.js.erb +++ /dev/null @@ -1,296 +0,0 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, -// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD -// GO AFTER THE REQUIRES BELOW. -// -//= require jquery -//= require jquery.ui.menu -//= require jquery.ui.autocomplete -//= require jquery.ui.tabs -//= require jquery.ui.tooltip -//= require jquery.tokeninput -//= require jquery.flot -//= require jquery.flot.resize -//= require jquery.flot.time -//= require jquery.flot.stack.js -//= require jquery_ujs -//= require webui/application/datatables -//= require cocoon -//= require moment -//= require mousetrap -//= require peek -//= require rails-timeago -// -//= require webui/keybindings.js.coffee -//= require webui/application/bento/script.js -//= require webui/application/bento/global-navigation.js -//= require webui/application/bento/l10n/global-navigation-data-en_US.js -//= require webui/application/package -//= require webui/application/project -//= require webui/application/request -//= require webui/application/patchinfo -//= require webui/application/comment -//= require webui/application/attribute -//= require webui/application/main -//= require webui/application/repository_tab -//= require webui/application/user -//= require webui/application/requests_table -//= require webui/application/image_templates -//= require webui/application/kiwi_editor -//= require webui/application/live_build_log -//= require webui/application/tabs -//= require webui/application/upload_jobs -//= require webui/application/interconnect - -function remove_dialog() { - $(this).parents('.dialog:visible').remove(); - $('.overlay').hide(); -} - - -function setup_buildresult_tooltip(element_id, url) { - $('#' + element_id).tooltip({ - content: function () { - return "
loading buildresult...
"; - } - }); - $('#' + element_id).mouseover(function () { - if ($('#' + element_id + '_tooltip').html() == 'loading buildresult...') { - $('#' + element_id + '_tooltip').load(url); - } - }); -} - -function fillEmptyFields() { - if (document.getElementById('username').value === '') { - document.getElementById('username').value = "_"; - } - if (document.getElementById('password').value === '') { - document.getElementById('password').value = "_"; - } -} - -function toggleBox(link, box) { - //calculating offset for displaying popup message - var leftVal = link.position().left + "px"; - var topVal = link.position().bottom + "px"; - $(box).css({ - left: leftVal, - top: topVal - }).toggle(); -} - -function project_monitor_ready() { - /* $(document).click(function() { $(".filterbox").hide(); }); - $(".filteritem input").click(function() { toggleCheck($(this)); toggleCheck($(this)); return true; }); - $(".filteritem").click(function() { toggleCheck($(this).find("input:first")); return false; }); */ - $("#statuslink").click(function () { - toggleBox($(this), "#statusbox"); - $("#archbox").hide(); - $("#repobox").hide(); - return false; - }); - $("#archlink").click(function () { - toggleBox($(this), "#archbox"); - $("#statusbox").hide(); - $("#repobox").hide(); - return false; - }); - $("#repolink").click(function () { - toggleBox($(this), "#repobox"); - $("#archbox").hide(); - $("#statusbox").hide(); - return false; - }); - - $("#statusbox_close").click(function () { - $("#statusbox").hide(); - }); - $("#statusbox_all").click(function () { - $(".statusitem").prop("checked", true); - return false; - }); - $("#statusbox_none").click(function () { - $(".statusitem").prop("checked", false); - return false; - }); - - $("#archbox_close").click(function () { - $("#archbox").hide(); - }); - $("#archbox_all").click(function () { - $(".architem").prop("checked", true); - return false; - }); - $("#archbox_none").click(function () { - $(".architem").prop("checked", false); - return false; - }); - - $("#repobox_close").click(function () { - $("#repobox").hide(); - }); - $("#repobox_all").click(function () { - $(".repoitem").prop("checked", true); - return false; - }); - $("#repobox_none").click(function () { - $(".repoitem").prop("checked", false); - return false; - }); -} - -// TODO: bento_only -function monitor_ready() { - $(".scheduler_status").hover( - function () { - $(this).find(".statustext").fadeIn(); - }, - function () { - $(this).find(".statustext").hide(); - } - ); -} - -function resizeMonitorBoxes() { - /* needs work */ -} - -function callPiwik() { - var u = (("https:" == document.location.protocol) ? "https://beans.opensuse.org/piwik/" : "http://beans.opensuse.org/piwik/"); - _paq.push(['setSiteId', 8]); - _paq.push(['setTrackerUrl', u + 'piwik.php']); - _paq.push(['trackPageView']); - _paq.push(['setDomains', ["*.opensuse.org"]]); - var d = document, - g = d.createElement('script'), - s = d.getElementsByTagName('script')[0]; - g.type = 'text/javascript'; - g.defer = true; - g.async = true; - g.src = u + 'piwik.js'; - s.parentNode.insertBefore(g, s); -} - -$(document).ajaxSend(function (event, request, settings) { - if (typeof(CSRF_PROTECT_AUTH_TOKEN) == "undefined") return; - // settings.data is a serialized string like "foo=bar&baz=boink" (or null) - settings.data = settings.data || ""; - settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(CSRF_PROTECT_AUTH_TOKEN); -}); - -// Could be handy elsewhere ;-) -var URL_REGEX = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi; - -// jquery.dataTables setup: -$(function () { - $.extend($.fn.dataTable.defaults, { - 'iDisplayLength': 25, - }); -}); - -function change_role(obj) { - var td = obj.parent("td"); - var type = td.data("type"); - var role = td.data("role"); - - var url; - var data = {project: $('#involved-users').data("project"), package: $('#involved-users').data("package"), role: role}; - data[type + 'id'] = td.data(type); - if (obj.is(':checked')) { - url = $('#involved-users').data("save-" + type); - } else { - url = $('#involved-users').data("remove"); - } - - $('#' + type + '_spinner').show(); - $('#' + type + '_table input').animate({opacity: 0.2}, 500); - $('#' + type + '_table input').prop("disabled", true); - - $.ajax({ - url: url, - type: 'POST', - data: data, - complete: function () { - $('#' + type + '_spinner').hide(); - $('#' + type + '_table input').animate({opacity: 1}, 200); - $('#' + type + '_table input').prop('disabled', false); - } - }); -} - -function collapse_expand(file_id) { - var placeholder = $('#diff_view_' + file_id + '_placeholder'); - if (placeholder.attr('id')) { - $.ajax({ - url: placeholder.parents('.table_wrapper').data("url"), - type: 'POST', - data: { text: placeholder.text(), uid: placeholder.data('uid') }, - success: function (data) { - $('#diff_view_' + file_id).show(); - $('#diff_view_' + file_id + '_placeholder').html(data); - $('#diff_view_' + file_id + '_placeholder').attr('id', ''); - use_codemirror(placeholder.data('uid'), true, placeholder.data("mode")); - $('#collapse_' + file_id).show(); - $('#expand_' + file_id).hide(); - }, - error: function (data) { - $('#diff_view_' + file_id).hide(); - $('#collapse_' + file_id).hide(); - $('#expand_' + file_id).show(); - }, - }); - } else { - $('#diff_view_' + file_id).toggle(); - $('#collapse_' + file_id).toggle(); - $('#expand_' + file_id).toggle(); - } -} - -// used in testing -function select_from_autocomplete(toselect) { - $('ul.ui-autocomplete li.ui-menu-item a').each(function (index) { - if ($(this).text() == toselect) { $(this).trigger('mouseenter').click(); } - }); -} - -$(function() { - $('.show_dialog').on('click', function() { - $($(this).data('target')).removeClass('hidden'); - $('.overlay').show(); - }); -}); - -$(document).on('click','.close-dialog', function() { - var target = $(this).data('target'); - if (target) { - $(target).addClass('hidden'); - $('.overlay').hide(); - } -}); - -// show/hide functionality for text -$(function() { - $('.show-hide').on('click', function() { - var target = $(this).data('target'); - $(target).toggle(); - - if ($(target).is(':hidden')) { - $(this).text($(this).data('showtext')); - } - else { - $(this).text($(this).data('hidetext')); - } - }); -}); - -$(document).ready(function(){ - $('#group-members-table').dataTable(); -}); diff --git a/src/api/app/assets/javascripts/webui/application/attribute.js b/src/api/app/assets/javascripts/webui/application/attribute.js deleted file mode 100644 index a1601069e86..00000000000 --- a/src/api/app/assets/javascripts/webui/application/attribute.js +++ /dev/null @@ -1,5 +0,0 @@ -$(document).on('change', '#attrib_attrib_type_id', function() { - $("#first-help").hide(); - $(".attrib-type").hide(); - $('#' + $(this).val() + '-help').show(); -}); diff --git a/src/api/app/assets/javascripts/webui/application/bento/global-navigation.js b/src/api/app/assets/javascripts/webui/application/bento/global-navigation.js deleted file mode 100644 index 574ff766a52..00000000000 --- a/src/api/app/assets/javascripts/webui/application/bento/global-navigation.js +++ /dev/null @@ -1,50 +0,0 @@ -var position_menu = function(button_id, menu_id) { - var top = $('#global-navigation').height()+1; - var left = $('#' + button_id).offset().left; - $('#' + menu_id).css({left:'',top:''}); - $('#' + menu_id).offset({left:left,top:top}); -}; - -$(function() { - - if (!global_navigation_data) return; - - var html = ''; - - $.each(global_navigation_data, function(i,menu){ - html += ''; - }); - - $('#global-navigation').after(html); - - $('#global-navigation li[id^=item-]').click(function(){ - var name = $(this).attr('id').substring(5); - $("ul[id^=menu-]:visible").each(function() { - $(this).fadeOut('fast'); - } ); - - if( $(this).hasClass('selected') ) { - $('#global-navigation li.selected').removeClass('selected'); - } else { - $('#global-navigation li.selected').removeClass('selected'); - position_menu('item-' + name, 'menu-' + name); - $('#menu-' + name).fadeIn(); - $(this).addClass('selected'); - } - return false; - }); - - $('.global-navigation-menu').mouseleave(function(){ - $('#global-navigation li.selected').removeClass('selected'); - $(this).fadeOut(); - }); - -}); diff --git a/src/api/app/assets/javascripts/webui/application/bento/l10n/global-navigation-data-en_US.js b/src/api/app/assets/javascripts/webui/application/bento/l10n/global-navigation-data-en_US.js deleted file mode 100644 index 46cf4d1d2e5..00000000000 --- a/src/api/app/assets/javascripts/webui/application/bento/l10n/global-navigation-data-en_US.js +++ /dev/null @@ -1,149 +0,0 @@ -var global_navigation_data = [ -{ - "id": "downloads", - "items": [ - { - "link": "http://software.opensuse.org/", - "image": "release-stable", - "title": "Latest stable release", - "desc": "Get the latest stable release of openSUSE" - }, - { - "link": "http://software.opensuse.org/developer/", - "image": "release-devel", - "title": "Latest development release", - "desc": "Get the latest development release of openSUSE" - }, - { - "link": "http://software.opensuse.org/search", - "image": "packages", - "title": "Search for packages", - "desc": "Get additional software from openSUSE Build Service" - }, - { - "link": "http://en.opensuse.org/Derivatives", - "image": "derivatives", - "title": "Derivatives", - "desc": "Get one of the specialized distributions built on openSUSE" - } - ] -}, -{ - "id": "support", - "items": [ - { - "link": "http://en.opensuse.org/Portal:Support", - "image": "help", - "title": "Help", - "desc": "Go to the Support Portal" - }, - { - "link": "http://doc.opensuse.org", - "image": "development-documentation", - "title": "Documentation", - "desc": "Read guides and manuals" - }, - { - "link": "http://en.opensuse.org/", - "image": "wiki", - "title": "Wiki", - "desc": "Read and write articles in our Wiki" - }, - { - "link": "http://tube.opensuse.org", - "image": "video", - "title": "Video", - "desc": "Watch various tutorials, screencasts and recordings from talks and presentations" - }, - { - "link": "http://forums.opensuse.org/", - "image": "forums", - "title": "Forums", - "desc": "Participate in our forums" - }, - { - "link": "http://en.opensuse.org/openSUSE:Mailing_lists", - "image": "lists", - "title": "Mailing lists", - "desc": "Subscribe to mailinglists and look into their archives" - }, - { - "link": "http://en.opensuse.org/openSUSE:IRC_list", - "image": "irc", - "title": "IRC channels", - "desc": "Communicate online using Internet Relay Chat" - } - ] -}, -{ - "id": "community", - "items": [ - { - "link": "http://connect.opensuse.org/", - "image": "users", - "title": "Connect", - "desc": "Connect with your openSUSE friends" - }, - { - "link": "http://planet.opensuse.org/", - "image": "planet", - "title": "Planet", - "desc": "See blogposts aggregated into one stream" - }, - { - "link": "http://news.opensuse.org/", - "image": "news", - "title": "News", - "desc": "Latest announcements from the team" - }, - { - "link": "http://lizards.opensuse.org/", - "image": "lizards", - "title": "Lizards", - "desc": "Users blog platform" - }, - { - "link": "http://shop.opensuse.org/", - "image": "shop", - "title": "Shop", - "desc": "openSUSE gear here!" - } - ] -}, -{ - "id": "development", - "items": - [ - { - "link": "http://en.opensuse.org/Portal:Development", - "image": "developer", - "title": "Developer documentation", - "desc": "Centralized developer's documentation" - }, - { - "link": "http://features.opensuse.org/", - "image": "features", - "title": "Features", - "desc": "Vote and work on upcoming openSUSE features" - }, - { - "link": "http://build.opensuse.org/", - "image": "buildservice", - "title": "Build Service", - "desc": "Create, build and enhance packages" - }, - { - "link": "http://bugs.opensuse.org/", - "image": "bugs", - "title": "Bugs", - "desc": "Report bugs using Bugzilla" - }, - { - "link": "http://susestudio.com", - "image": "studio", - "title": "SUSE Studio", - "desc": "Create your own images using Studio" - } - ] -} -]; diff --git a/src/api/app/assets/javascripts/webui/application/bento/script.js b/src/api/app/assets/javascripts/webui/application/bento/script.js deleted file mode 100644 index c97a5c0d1c1..00000000000 --- a/src/api/app/assets/javascripts/webui/application/bento/script.js +++ /dev/null @@ -1,208 +0,0 @@ -$(function() { - - // == Login Form UI Actions ================================================ - - var formStatus = false; // true == form is open; false == forme is closed - - // variables to specify form dimensions - var x1 = 0; - var x2 = 0; - var y1 = 0; - var y2 = 0; - - $('#login-form').insertAfter('#footer'); // move login form to end of document - - var positionIndicator = ''; // Snipplet to get bottom-right position - $('#login-form > :last-child').after(positionIndicator); // place snipplet after last element in form-container - - $('#login-trigger').click(function() { // display login form - var offsetSubheader = $('#subheader').offset(); // get position of #subheader - var posX = parseInt(offsetSubheader.left) + $('#subheader').width() - $('#login-form').width(); // calculate position for login-form - $('#login-form').css('left', posX).slideToggle('fast', function() { // slide down and set position in callback - var rbPos = $('.position-br').offset(); - x1 = posX; // left - x2 = rbPos.left; // right - y1 = offsetSubheader.top; // top - y2 = rbPos.top; // bottom - $('#username').focus(); - }); - - formStatus = true; - return false; - }); - - $('#login-form input.inline-text').each(function() { // hide overlaying