diff options
| -rw-r--r-- | static/js/pichat2.js | 95 | ||||
| -rw-r--r-- | static/js/src/palette-manual.js | 96 |
2 files changed, 191 insertions, 0 deletions
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('\ +<div class="mm" style="float: left">\ + <span class="menuicon" style="background-image: url(https://confluence.atlassian.com/download/attachments/218269032/gh-icon-cog-dropdown.png); background-repeat: no-repeat; background-size: 20px 12px; width: 30px; height: 30px; position: absolute; display: none; z-index: 100; opacity: 0.7">\ + <ul class="mymenu" style="display: none; background-color: #FFF; top: 13px; position: relative; border: 1px solid #ccc; min-width: 40px; width: auto">\ + <li onclick="javascript:showtaginput(this);"><div>tags <input type="text" style="width:40px; font-size: 10pt; display: none; border: 0px;" class="taginput"></div></li>\ + <li onclick="javascript:delfav(this);">del</li>\ + </ul>\ +<div class="tagin" style="border: 1px solid #ccc; width: 140px; height: 50px; display: none; position: relative; background-color: #eee; top: 13px; left: 0px; padding: 4px;">tags:<br><input type="text" style="width:130px; font-size: 10pt; border: 1px solid #000;" class="taginput"><!--<input type="button" value="ok" onclick="javascript:add_tags($(this).prev())" class="addtagbutton">--></div>\ +</span>\ +<img onclick="paletteToChat(this)" src="' + imgs[i] + '"></div>'); + } + + 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); + } + } + ); + + $("<style type='text/css'> .mymenu li:hover{ color: green;}</style>").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('\ +<div class="mm" style="float: left">\ + <span class="menuicon" style="background-image: url(https://confluence.atlassian.com/download/attachments/218269032/gh-icon-cog-dropdown.png); background-repeat: no-repeat; background-size: 20px 12px; width: 30px; height: 30px; position: absolute; display: none; z-index: 100; opacity: 0.7">\ + <ul class="mymenu" style="display: none; background-color: #FFF; top: 13px; position: relative; border: 1px solid #ccc; min-width: 40px; width: auto">\ + <li onclick="javascript:showtaginput(this);"><div>tags <input type="text" style="width:40px; font-size: 10pt; display: none; border: 0px;" class="taginput"></div></li>\ + <li onclick="javascript:delfav(this);">del</li>\ + </ul>\ +<div class="tagin" style="border: 1px solid #ccc; width: 140px; height: 50px; display: none; position: relative; background-color: #eee; top: 13px; left: 0px; padding: 4px;">tags:<br><input type="text" style="width:130px; font-size: 10pt; border: 1px solid #000;" class="taginput"><!--<input type="button" value="ok" onclick="javascript:add_tags($(this).prev())" class="addtagbutton">--></div>\ +</span>\ +<img onclick="paletteToChat(this)" src="' + imgs[i] + '"></div>'); + } + + 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); + } + } + ); + + $("<style type='text/css'> .mymenu li:hover{ color: green;}</style>").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 |
