From 1d5d15450209599ec7c38f7560e56050ec4148eb Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Sun, 22 Jul 2012 00:08:05 -0400 Subject: Merge --- static/js/pichat.js | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 2 deletions(-) (limited to 'static/js/pichat.js') diff --git a/static/js/pichat.js b/static/js/pichat.js index 1f1cf43..9a28450 100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -1247,6 +1247,11 @@ function setupUpload(elementId, roomKey) { // manual fave palette by ohgod $(function(){ $('#manual-palette-button').click(manPaletteToggle); + $('#manual-add-url-txt').keyup(ifEnter(function(){ + addManualFav($('#manual-add-url-txt').val().trim()); + $('#manual-add-url-txt').val(""); + })); +/* $('#manual-add-button').click(function () { addManualFav($('#manual-add-url-txt').val().trim()); $('#manual-add-url-txt').val(""); @@ -1255,6 +1260,7 @@ $(function(){ removeManualFav($('#manual-add-url-txt').val().trim()); $('#manual-add-url-txt').val(""); }); +*/ }); var manPaletteOpen = false; @@ -1313,6 +1319,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 +1328,7 @@ function manualPaletteBuildImageThumbs() { } } }; +*/ function addManualFav(url) { if (!url) return; @@ -1331,7 +1339,8 @@ function addManualFav(url) { if ($.inArray(url, mfavs) == -1) { mfavs.push(url); setManualFaves(mfavs); - $("#manual-palette-thumbs").append(""); + manualPaletteBuildImageThumbs(); + // $("#manual-palette-thumbs").append(""); } } }; @@ -1343,7 +1352,6 @@ function removeManualFav(url) { if (idx != -1) { mfavs.splice(idx, 1); setManualFaves(mfavs); - $("#manual-palette-thumbs").html(""); manualPaletteBuildImageThumbs(); } } @@ -1351,6 +1359,112 @@ function removeManualFav(url) { +// textchimp autocomplete mod + +function manualPaletteBuildImageThumbs() { + $("#manual-palette-thumbs").html(""); + 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(); +} +*/ + +// ohgod - checkbox to hide the userlist +$(function(){ + if ($('#textbutton').length == 0) return; + $('#textbutton input').attr('checked', true); + TextEnabled = true; + if (setTextEnable) setTextEnable.apply($('#textbutton input')[0]); + $('
').prependTo('#chatbuttons'); + $('#showulist').change(function(){ $('#userList').toggle( this.checked ); }); +}); + + function paletteToChat(img){ var chatText = $("#msgInput").val() if (chatText.length && chatText[chatText.length - 1] != " ") -- cgit v1.2.3-70-g09d2