From 4437d7e051a6e11d2950794d99788c2e730824b1 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 19 Jul 2012 11:12:36 -0400 Subject: textchimp's manual fave mod --- static/js/pichat2.js | 95 ++++++++++++++++++++++++++++++++++++++++ static/js/src/palette-manual.js | 96 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 191 insertions(+) (limited to 'static') diff --git a/static/js/pichat2.js b/static/js/pichat2.js index 1f1cf43..038b356 100644 --- a/static/js/pichat2.js +++ b/static/js/pichat2.js @@ -1313,6 +1313,7 @@ function setManualFaves(mfavs) { localStorage.manual_favs = JSON.stringify(mfavs); }; +/* function manualPaletteBuildImageThumbs() { var imgs = JSON.parse(localStorage.manual_favs); if (imgs && imgs.length != 0) { @@ -1321,6 +1322,7 @@ function manualPaletteBuildImageThumbs() { } } }; +*/ function addManualFav(url) { if (!url) return; @@ -1351,6 +1353,99 @@ function removeManualFav(url) { +// textchimp autocomplete mod + +function manualPaletteBuildImageThumbs() { + var imgs = JSON.parse(localStorage.manual_favs); + if (imgs && imgs.length != 0) { + for (var i = 0; i < imgs.length; i++) { + $("#manual-palette-thumbs").append('\ +
\ + \ +
'); + } + + var test_tags = ["dogs", "text", "funny", "disturbing"]; + $('.taginput').autocomplete({ + source: test_tags, + open: function(){ + $(this).autocomplete('widget').css({'z-index': '55555555555', 'background-color': '#EFF5FB', 'width': '128px'}); + return false; + } + }); + + + + + $('.taginput').blur(function(e){ if(!$('.ui-autocomplete').is(':visible') ) { $(e.target).parent().hide(); } }); + + $('.taginput').keypress(function(e) { if(e.charCode == 13) { add_tags(e.target); } }); + + $('.mm').hover( + function(){ $(this).children(".menuicon").show(); }, + function(){ + if(!$(this).children('.menuicon').children('.tagin').is(':visible')) { + $(this).children(".menuicon").hide(); + } + }); + + $('.menuicon').hover( + function(){ + if(!$(this).children('.tagin').is(':visible')) { + $(this).css('opacity', '1.0'); + $(this).children('.mymenu').slideDown(100); + } + }, + function(){ + if(!$(this).children('.tagin').is(':visible')) { + $(this).css('opacity', '0.7'); + $(this).children('.tagin').hide(); + $(this).children('.mymenu').slideUp(100); + } + } + ); + + $("").appendTo("head"); + + $('.mymenu li').css({ + 'background-color': '#eee', + 'margin': '1px', + 'padding-left': '2px', + 'cursor': 'pointer', + 'font-size': '10pt' + }); + + + } +} + +function showtaginput(e) { + $(e).parent().hide(); + $(e).parent().next().show(); + $(e).parent().next().children('.taginput').focus(); +} + +function delfav(e) { + console.log($(e).parents('.mm').children('img').attr('src')); + removeManualFav($(e).parents('.mm').children('img').attr('src')); +} + +function add_tags(e) { + console.log('tags: ' + $(e).val() + '(for: ' + $(e).parents('.mm').children('img').attr('src') + ')'); + $(e).parent().hide(); +} + +/* +if(!manPaletteOpen) { + manPaletteToggle(); +} +*/ function paletteToChat(img){ var chatText = $("#msgInput").val() if (chatText.length && chatText[chatText.length - 1] != " ") diff --git a/static/js/src/palette-manual.js b/static/js/src/palette-manual.js index 102a0d2..95e1907 100644 --- a/static/js/src/palette-manual.js +++ b/static/js/src/palette-manual.js @@ -67,6 +67,7 @@ function setManualFaves(mfavs) { localStorage.manual_favs = JSON.stringify(mfavs); }; +/* function manualPaletteBuildImageThumbs() { var imgs = JSON.parse(localStorage.manual_favs); if (imgs && imgs.length != 0) { @@ -75,6 +76,7 @@ function manualPaletteBuildImageThumbs() { } } }; +*/ function addManualFav(url) { if (!url) return; @@ -104,3 +106,97 @@ function removeManualFav(url) { }; + +// textchimp autocomplete mod + +function manualPaletteBuildImageThumbs() { + var imgs = JSON.parse(localStorage.manual_favs); + if (imgs && imgs.length != 0) { + for (var i = 0; i < imgs.length; i++) { + $("#manual-palette-thumbs").append('\ +
\ + \ +
'); + } + + var test_tags = ["dogs", "text", "funny", "disturbing"]; + $('.taginput').autocomplete({ + source: test_tags, + open: function(){ + $(this).autocomplete('widget').css({'z-index': '55555555555', 'background-color': '#EFF5FB', 'width': '128px'}); + return false; + } + }); + + + + + $('.taginput').blur(function(e){ if(!$('.ui-autocomplete').is(':visible') ) { $(e.target).parent().hide(); } }); + + $('.taginput').keypress(function(e) { if(e.charCode == 13) { add_tags(e.target); } }); + + $('.mm').hover( + function(){ $(this).children(".menuicon").show(); }, + function(){ + if(!$(this).children('.menuicon').children('.tagin').is(':visible')) { + $(this).children(".menuicon").hide(); + } + }); + + $('.menuicon').hover( + function(){ + if(!$(this).children('.tagin').is(':visible')) { + $(this).css('opacity', '1.0'); + $(this).children('.mymenu').slideDown(100); + } + }, + function(){ + if(!$(this).children('.tagin').is(':visible')) { + $(this).css('opacity', '0.7'); + $(this).children('.tagin').hide(); + $(this).children('.mymenu').slideUp(100); + } + } + ); + + $("").appendTo("head"); + + $('.mymenu li').css({ + 'background-color': '#eee', + 'margin': '1px', + 'padding-left': '2px', + 'cursor': 'pointer', + 'font-size': '10pt' + }); + + + } +} + +function showtaginput(e) { + $(e).parent().hide(); + $(e).parent().next().show(); + $(e).parent().next().children('.taginput').focus(); +} + +function delfav(e) { + console.log($(e).parents('.mm').children('img').attr('src')); + removeManualFav($(e).parents('.mm').children('img').attr('src')); +} + +function add_tags(e) { + console.log('tags: ' + $(e).val() + '(for: ' + $(e).parents('.mm').children('img').attr('src') + ')'); + $(e).parent().hide(); +} + +/* +if(!manPaletteOpen) { + manPaletteToggle(); +} +*/ \ No newline at end of file -- cgit v1.2.3-70-g09d2