From 31946c96b3774576765d678a8ac9c92ff24fba01 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Thu, 11 Dec 2014 12:55:42 +0000 Subject: [PATCH] Remove deprecated and redundant qTip2 attributes and CSS. Fix restore scene exceptions tip over title on displayShow page. Change ajax for a deferred ajax call used for plots tips and scene exception tips. Tweak some tip positions and cleanup calls to be more uniform. --- gui/slick/interfaces/default/displayShow.tmpl | 2 +- gui/slick/js/configPostProcessing.js | 68 ++++++++----------- gui/slick/js/fuzzyMoment.js | 6 +- gui/slick/js/plotTooltip.js | 39 ++++++----- gui/slick/js/ratingTooltip.js | 8 +-- gui/slick/js/sceneExceptionsTooltip.js | 40 ++++++----- 6 files changed, 75 insertions(+), 88 deletions(-) diff --git a/gui/slick/interfaces/default/displayShow.tmpl b/gui/slick/interfaces/default/displayShow.tmpl index 38a40221..1296b4d3 100644 --- a/gui/slick/interfaces/default/displayShow.tmpl +++ b/gui/slick/interfaces/default/displayShow.tmpl @@ -42,7 +42,7 @@ $(this).qtip({ show: {solo:true}, position: {viewport:$(window), my:'left center', adjust:{ y: -10, x: 2 }}, - style: {tip:{corner:true, method:'polygon'}, classes:'qtip-rounded qtip-shadow ui-tooltip-sb'} + style: {classes:'qtip-rounded qtip-shadow'} }); }); #end raw diff --git a/gui/slick/js/configPostProcessing.js b/gui/slick/js/configPostProcessing.js index 036d5c28..312c0b64 100644 --- a/gui/slick/js/configPostProcessing.js +++ b/gui/slick/js/configPostProcessing.js @@ -17,7 +17,7 @@ $(document).ready(function () { } else { $('#unpack').qtip('option', { 'content.text': 'Unrar Executable not found.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-red' + 'style.classes': 'qtip-red qtip-rounded qtip-shadow' }); $('#unpack').qtip('toggle', true); $('#unpack').css('background-color', '#FFFFDD'); @@ -56,21 +56,21 @@ $(document).ready(function () { if (data == "invalid") { $('#naming_pattern').qtip('option', { 'content.text': 'This pattern is invalid.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-red' + 'style.classes': 'qtip-red qtip-rounded qtip-shadow' }); $('#naming_pattern').qtip('toggle', true); $('#naming_pattern').css('background-color', '#FFDDDD'); } else if (data == "seasonfolders") { $('#naming_pattern').qtip('option', { 'content.text': 'This pattern would be invalid without the folders, using it will force "Flatten" off for all shows.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-red' + 'style.classes': 'qtip-red qtip-rounded qtip-shadow' }); $('#naming_pattern').qtip('toggle', true); $('#naming_pattern').css('background-color', '#FFFFDD'); } else { $('#naming_pattern').qtip('option', { 'content.text': 'This pattern is valid.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-green' + 'style.classes': 'qtip-green qtip-rounded qtip-shadow' }); $('#naming_pattern').qtip('toggle', false); $('#naming_pattern').css('background-color', '#FFFFFF'); @@ -97,21 +97,21 @@ $(document).ready(function () { if (data == "invalid") { $('#naming_abd_pattern').qtip('option', { 'content.text': 'This pattern is invalid.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-red' + 'style.classes': 'qtip-red qtip-rounded qtip-shadow' }); $('#naming_abd_pattern').qtip('toggle', true); $('#naming_abd_pattern').css('background-color', '#FFDDDD'); } else if (data == "seasonfolders") { $('#naming_abd_pattern').qtip('option', { 'content.text': 'This pattern would be invalid without the folders, using it will force "Flatten" off for all shows.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-red' + 'style.classes': 'qtip-red qtip-rounded qtip-shadow' }); $('#naming_abd_pattern').qtip('toggle', true); $('#naming_abd_pattern').css('background-color', '#FFFFDD'); } else { $('#naming_abd_pattern').qtip('option', { 'content.text': 'This pattern is valid.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-green' + 'style.classes': 'qtip-green qtip-rounded qtip-shadow' }); $('#naming_abd_pattern').qtip('toggle', false); $('#naming_abd_pattern').css('background-color', '#FFFFFF'); @@ -138,21 +138,21 @@ $(document).ready(function () { if (data == "invalid") { $('#naming_sports_pattern').qtip('option', { 'content.text': 'This pattern is invalid.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-red' + 'style.classes': 'qtip-red qtip-rounded qtip-shadow' }); $('#naming_sports_pattern').qtip('toggle', true); $('#naming_sports_pattern').css('background-color', '#FFDDDD'); } else if (data == "seasonfolders") { $('#naming_sports_pattern').qtip('option', { 'content.text': 'This pattern would be invalid without the folders, using it will force "Flatten" off for all shows.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-red' + 'style.classes': 'qtip-red qtip-rounded qtip-shadow' }); $('#naming_sports_pattern').qtip('toggle', true); $('#naming_sports_pattern').css('background-color', '#FFFFDD'); } else { $('#naming_sports_pattern').qtip('option', { 'content.text': 'This pattern is valid.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-green' + 'style.classes': 'qtip-green qtip-rounded qtip-shadow' }); $('#naming_sports_pattern').qtip('toggle', false); $('#naming_sports_pattern').css('background-color', '#FFFFFF'); @@ -179,21 +179,21 @@ $(document).ready(function () { if (data == "invalid") { $('#naming_sports_pattern').qtip('option', { 'content.text': 'This pattern is invalid.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-red' + 'style.classes': 'qtip-red qtip-rounded qtip-shadow' }); $('#naming_sports_pattern').qtip('toggle', true); $('#naming_sports_pattern').css('background-color', '#FFDDDD'); } else if (data == "seasonfolders") { $('#naming_sports_pattern').qtip('option', { 'content.text': 'This pattern would be invalid without the folders, using it will force "Flatten" off for all shows.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-red' + 'style.classes': 'qtip-red qtip-rounded qtip-shadow' }); $('#naming_sports_pattern').qtip('toggle', true); $('#naming_sports_pattern').css('background-color', '#FFFFDD'); } else { $('#naming_sports_pattern').qtip('option', { 'content.text': 'This pattern is valid.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-green' + 'style.classes': 'qtip-green qtip-rounded qtip-shadow' }); $('#naming_sports_pattern').qtip('toggle', false); $('#naming_sports_pattern').css('background-color', '#FFFFFF'); @@ -232,21 +232,21 @@ $(document).ready(function () { if (data == "invalid") { $('#naming_anime_pattern').qtip('option', { 'content.text': 'This pattern is invalid.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-red' + 'style.classes': 'qtip-red qtip-rounded qtip-shadow' }); $('#naming_anime_pattern').qtip('toggle', true); $('#naming_anime_pattern').css('background-color', '#FFDDDD'); } else if (data == "seasonfolders") { $('#naming_anime_pattern').qtip('option', { 'content.text': 'This pattern would be invalid without the folders, using it will force "Flatten" off for all shows.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-red' + 'style.classes': 'qtip-red qtip-rounded qtip-shadow' }); $('#naming_anime_pattern').qtip('toggle', true); $('#naming_anime_pattern').css('background-color', '#FFFFDD'); } else { $('#naming_anime_pattern').qtip('option', { 'content.text': 'This pattern is valid.', - 'style.classes': 'qtip-rounded qtip-shadow qtip-green' + 'style.classes': 'qtip-green qtip-rounded qtip-shadow' }); $('#naming_anime_pattern').qtip('toggle', false); $('#naming_anime_pattern').css('background-color', '#FFFFFF'); @@ -485,35 +485,27 @@ $(document).ready(function () { } $(this).refreshMetadataConfig(true); - $('img[title]').qtip( { + $('img[title]').qtip({ position: { viewport: $(window), - at: 'bottom center', - my: 'top right' + my: 'top right', + at: 'bottom center' }, style: { - tip: { - corner: true, - method: 'polygon' - }, - classes: 'qtip-shadow qtip-dark' + classes: 'qtip-dark qtip-rounded qtip-shadow' } }); - $('i[title]').qtip( { + $('i[title]').qtip({ position: { viewport: $(window), - at: 'top center', - my: 'bottom center' + my: 'bottom center', + at: 'top center' }, style: { - tip: { - corner: true, - method: 'polygon' - }, - classes: 'qtip-rounded qtip-shadow ui-tooltip-sb' + classes: 'qtip-rounded qtip-shadow' } }); - $('.custom-pattern,#unpack').qtip( { + $('.custom-pattern,#unpack').qtip({ content: 'validating...', show: { event: false, @@ -522,15 +514,11 @@ $(document).ready(function () { hide: false, position: { viewport: $(window), - at: 'center left', - my: 'center right' + my: 'right center', + at: 'left center' }, style: { - tip: { - corner: true, - method: 'polygon' - }, - classes: 'qtip-rounded qtip-shadow qtip-red' + classes: 'qtip-red qtip-rounded qtip-shadow' } }); diff --git a/gui/slick/js/fuzzyMoment.js b/gui/slick/js/fuzzyMoment.js index 510ca941..dc81c399 100644 --- a/gui/slick/js/fuzzyMoment.js +++ b/gui/slick/js/fuzzyMoment.js @@ -54,11 +54,7 @@ } }, style: { - tip: { - corner: true, - method: 'polygon' - }, - classes: 'qtip-rounded qtip-dark qtip-shadow ui-tooltip-sb' + classes: 'qtip-dark qtip-rounded qtip-shadow' } }); }); diff --git a/gui/slick/js/plotTooltip.js b/gui/slick/js/plotTooltip.js index 6f737922..b15009d3 100644 --- a/gui/slick/js/plotTooltip.js +++ b/gui/slick/js/plotTooltip.js @@ -1,20 +1,27 @@ $(function () { $('.plotInfo').each(function () { - match = $(this).attr("id").match(/^plot_info_(\d+)_(\d+)_(\d+)$/); + var match = $(this).attr('id').match(/^plot_info_(\d+)_(\d+)_(\d+)$/); $(this).qtip({ content: { - text: 'Loading...', - ajax: { - url: $("#sbRoot").val() + '/home/plotDetails', - type: 'GET', - data: { - show: match[1], - episode: match[3], - season: match[2] - }, - success: function (data, status) { - this.set('content.text', data); - } + text: function(event, api) { + // deferred object ensuring the request is only made once + $.ajax({ + url: $('#sbRoot').val() + '/home/plotDetails', + type: 'GET', + data: { + show: match[1], + episode: match[3], + season: match[2] + } + }) + .then(function(content) { + // Set the tooltip content upon successful retrieval + api.set('content.text', content); + }, function(xhr, status, error) { + // Upon failure... set the tooltip content to the status and error value + api.set('content.text', status + ': ' + error); + }); + return 'Loading...'; // Set initial text } }, show: { @@ -29,11 +36,7 @@ $(function () { } }, style: { - tip: { - corner: true, - method: 'polygon' - }, - classes: 'qtip-rounded qtip-shadow ui-tooltip-sb' + classes: 'qtip-rounded qtip-shadow' } }); }); diff --git a/gui/slick/js/ratingTooltip.js b/gui/slick/js/ratingTooltip.js index 712c2f9a..35a481b7 100644 --- a/gui/slick/js/ratingTooltip.js +++ b/gui/slick/js/ratingTooltip.js @@ -15,15 +15,11 @@ $(function () { at: 'center left', adjust: { y: 0, - x: -6 + x: -2 } }, style: { - tip: { - corner: true, - method: 'polygon' - }, - classes: 'qtip-rounded qtip-shadow ui-tooltip-sb' + classes: 'qtip-rounded qtip-shadow' } }); }); diff --git a/gui/slick/js/sceneExceptionsTooltip.js b/gui/slick/js/sceneExceptionsTooltip.js index 46e525a3..ae12a0db 100644 --- a/gui/slick/js/sceneExceptionsTooltip.js +++ b/gui/slick/js/sceneExceptionsTooltip.js @@ -1,17 +1,25 @@ $(function () { $('.title span').each(function () { + var match = $(this).parent().attr('id').match(/^scene_exception_(\d+)$/); $(this).qtip({ content: { - text: 'Loading...', - ajax: { - url: $("#sbRoot").val() + '/home/sceneExceptions', - type: 'GET', - data: { - show: match[1] - }, - success: function (data, status) { - this.set('content.text', data); - } + text: function(event, api) { + // deferred object ensuring the request is only made once + $.ajax({ + url: $('#sbRoot').val() + '/home/sceneExceptions', + type: 'GET', + data: { + show: match[1] + } + }) + .then(function(content) { + // Set the tooltip content upon successful retrieval + api.set('content.text', content); + }, function(xhr, status, error) { + // Upon failure... set the tooltip content to the status and error value + api.set('content.text', status + ': ' + error); + }); + return 'Loading...'; // Set initial text } }, show: { @@ -19,19 +27,15 @@ $(function () { }, position: { viewport: $(window), - my: 'left middle', - at: 'right middle', + my: 'left center', + at: 'right center', adjust: { y: 0, - x: 10 + x: 2 } }, style: { - tip: { - corner: true, - method: 'polygon' - }, - classes: 'qtip-rounded qtip-shadow ui-tooltip-sb' + classes: 'qtip-rounded qtip-shadow' } }); });