From bfa25bc604b91497d14595191ec4b33beac6d34d Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Tue, 10 Jun 2014 13:34:39 -0400 Subject: [PATCH] sped up scroll bars --- app/assets/javascripts/Jit/topicCard.js | 9 +++-- app/assets/javascripts/application.js | 34 ++++++++++++------- .../javascripts/jquery/AllMappingPages.js | 1 + app/assets/stylesheets/application.css | 2 +- app/views/main/paq.html.erb | 7 +++- app/views/maps/_homemap.html.erb | 4 +-- 6 files changed, 38 insertions(+), 19 deletions(-) diff --git a/app/assets/javascripts/Jit/topicCard.js b/app/assets/javascripts/Jit/topicCard.js index 82e4c6c4..577c73fa 100644 --- a/app/assets/javascripts/Jit/topicCard.js +++ b/app/assets/javascripts/Jit/topicCard.js @@ -45,7 +45,7 @@ function buildCardWithHogan(node) { nodeValues.synapse_count = node.getData("synapseCount"); nodeValues.id = node.id; nodeValues.metacode = node.getData("metacode"); - nodeValues.metacode_class = 'mbg' + node.getData("metacode").replace(/\s/g,''); + nodeValues.metacode_class = 'mbg' + node.getData("metacode").replace(/\s/g, ''); nodeValues.imgsrc = imgArray[node.getData("metacode")].src; nodeValues.name = node.name; nodeValues.userid = node.getData("userid"); @@ -127,7 +127,12 @@ function populateShowCard(node) { $('.metacodeSelect').show(); // add the scroll bar to the list of metacode select options if it isn't already there if (!$('.metacodeSelect ul').hasClass('mCustomScrollbar')) { - $('.metacodeSelect ul').mCustomScrollbar(); + $('.metacodeSelect ul').mCustomScrollbar({ + mouseWheelPixels: 200, + advanced: { + updateOnContentResize: true + } + }); $('.metacodeSelect li').click(function () { selectingMetacode = false; diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index ee3a517d..f07ea1d8 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -148,7 +148,7 @@ function updateMetacode(node, metacode) { data: mdata, success: function (data) { $('.CardOnGraph').find('.metacodeTitle').text(metacode) - .attr('class', 'metacodeTitle mbg' + metacode.replace(/\s/g,'')); + .attr('class', 'metacodeTitle mbg' + metacode.replace(/\s/g, '')); $('.CardOnGraph').find('.metacodeImage').css('background-image', 'url(' + imgArray[metacode].src + ')'); node.setData("metacode", metacode); Mconsole.plot(); @@ -231,16 +231,16 @@ function updateMapPermission(mapid, permission) { } function updateMetacodeSet(set, index, custom) { - + if (custom && MetamapsModel.newSelectedMetacodes.length == 0) { alert('Please select at least one metacode to use!'); return false; } - + var codesToSwitchTo; MetamapsModel.selectedMetacodeSetIndex = index; MetamapsModel.selectedMetacodeSet = "metacodeset-" + set; - + if (!custom) { codesToSwitchTo = $('#metacodeSwitchTabs' + set).attr('data-metacodes').split(','); $('.customMetacodeList li').addClass('toggledOff'); @@ -259,7 +259,7 @@ function updateMetacodeSet(set, index, custom) { // sort by name codesToSwitchTo.sort(); codesToSwitchTo.reverse(); - + $('#metacodeImg, #metacodeImgTitle').empty(); $('#metacodeImg').removeData('cloudcarousel'); var newMetacodes = ""; @@ -275,7 +275,7 @@ function updateMetacodeSet(set, index, custom) { mouseWheel: true, bringToFront: true }); - + $('#lightbox_overlay').hide(); $('#topic_name').focus(); @@ -305,8 +305,7 @@ function cancelMetacodeSetSwitch() { MetamapsModel.selectedMetacodeNames = []; MetamapsModel.newSelectedMetacodes = []; MetamapsModel.newSelectedMetacodeNames = []; - } - else { // custom set is selected + } else { // custom set is selected // reset it to the current actual selection $('.customMetacodeList li').addClass('toggledOff'); for (var i = 0; i < MetamapsModel.selectedMetacodes.length; i++) { @@ -337,7 +336,12 @@ function openNodeShowcard(node) { $('.showcard').fadeIn('fast'); var s = $('.showcard').find('.scroll'); - s.height(s.height()).mCustomScrollbar(); + s.height(s.height()).mCustomScrollbar({ + mouseWheelPixels: 200, + advanced: { + updateOnContentResize: true + } + }); MetamapsModel.showcardInUse = node.id; } @@ -347,9 +351,14 @@ function openLightbox(which) { $('#lightbox_overlay').show(); $('#lightbox_main').css('margin-top', '-' + ($('#lightbox_main').height() / 2) + 'px'); - + if (!MetamapsModel.metacodeScrollerInit) { - $('.customMetacodeList, .metacodeSetList').mCustomScrollbar({advanced: { updateOnContentResize: true }}); + $('.customMetacodeList, .metacodeSetList').mCustomScrollbar({ + mouseWheelPixels: 200, + advanced: { + updateOnContentResize: true + } + }); MetamapsModel.metacodeScrollerInit = true; } if (which == "switchMetacodes") { @@ -383,5 +392,4 @@ function cancelMapCreate(id) { form.find('.mapCommonsIcon').addClass('selected'); return false; -} - +} \ No newline at end of file diff --git a/app/assets/javascripts/jquery/AllMappingPages.js b/app/assets/javascripts/jquery/AllMappingPages.js index c8f99afc..c4077c4d 100644 --- a/app/assets/javascripts/jquery/AllMappingPages.js +++ b/app/assets/javascripts/jquery/AllMappingPages.js @@ -76,6 +76,7 @@ $(document).ready(function () { // initialize scroll bar for filter by metacode, then hide it and position it correctly again $("#filter_by_metacode").mCustomScrollbar({ + mouseWheelPixels: 200, advanced: { updateOnContentResize: true } diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 9a59cbe6..c3934ad5 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1764,7 +1764,7 @@ div.mapInfoStat { list-style-type: none; display: block; padding: 0px; - width: 93px; + width: 92px; height: 70px; float: left; text-align: center; diff --git a/app/views/main/paq.html.erb b/app/views/main/paq.html.erb index a4c5081e..76d0ec5e 100644 --- a/app/views/main/paq.html.erb +++ b/app/views/main/paq.html.erb @@ -60,7 +60,12 @@