Chat: pasting image from clipboard
This commit is contained in:
@@ -1918,6 +1918,24 @@ class Databap extends PhpObject
|
|||||||
}
|
}
|
||||||
else $sDesc = $asImage['error'];
|
else $sDesc = $asImage['error'];
|
||||||
}
|
}
|
||||||
|
elseif(mb_substr($sMessage, 0, 8) == '/imgsrc ' && mb_strlen($sMessage)>8)
|
||||||
|
{
|
||||||
|
//Store locally
|
||||||
|
$sSourceString = mb_substr($sMessage, 8);
|
||||||
|
$oImage = imagecreatefromstring(base64_decode($sSourceString));
|
||||||
|
$sRawPath = self::DOC_TMP_FOLDER.uniqid().'.jpeg';
|
||||||
|
imagejpeg($oImage, $sRawPath, 100);
|
||||||
|
|
||||||
|
//Create thumbnail & display on chat
|
||||||
|
$asImage = $this->downloadToTmp($sRawPath);
|
||||||
|
$bSuccess = ($asImage['error']=='');
|
||||||
|
if($bSuccess)
|
||||||
|
{
|
||||||
|
$sMessage = $this->getJsonMessage(array($asImage['out'], $asImage['width'], $asImage['height'], $sRawPath));
|
||||||
|
$sType = self::MESSAGE_IMG;
|
||||||
|
}
|
||||||
|
else $sDesc = $asImage['error'];
|
||||||
|
}
|
||||||
elseif(mb_substr($sMessage, 0, 6) == '/9gag ' && mb_strlen($sMessage)>6)
|
elseif(mb_substr($sMessage, 0, 6) == '/9gag ' && mb_strlen($sMessage)>6)
|
||||||
{
|
{
|
||||||
$asImage = $this->get9gagPost(trim(mb_substr($sMessage, 6)));
|
$asImage = $this->get9gagPost(trim(mb_substr($sMessage, 6)));
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
20
jquery/resize.js
vendored
20
jquery/resize.js
vendored
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* jQuery resize event - v1.1 - 3/14/2010
|
|
||||||
* http://benalman.com/projects/jquery-resize-plugin/
|
|
||||||
*
|
|
||||||
* Copyright (c) 2010 "Cowboy" Ben Alman
|
|
||||||
* Dual licensed under the MIT and GPL licenses.
|
|
||||||
* http://benalman.com/about/license/
|
|
||||||
*
|
|
||||||
* E.g.
|
|
||||||
*
|
|
||||||
* $("#unicorns").resize
|
|
||||||
* (
|
|
||||||
* function(e)
|
|
||||||
* {
|
|
||||||
*
|
|
||||||
* }
|
|
||||||
* );
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
|
|
||||||
140
jquery/tinyscrollbar.js
vendored
140
jquery/tinyscrollbar.js
vendored
@@ -1,140 +0,0 @@
|
|||||||
(
|
|
||||||
function($)
|
|
||||||
{
|
|
||||||
$.tiny = $.tiny||{};
|
|
||||||
$.tiny.scrollbar = {options:{axis:'y',wheel:40,scroll:true,size:'auto',sizethumb:'auto'}};
|
|
||||||
$.fn.tinyscrollbar=function(options){var options=$.extend({},$.tiny.scrollbar.options,options);this.each(function(){$(this).data('tsb',new Scrollbar($(this),options));});return this;};
|
|
||||||
$.fn.tinyscrollbar_update=function(sScroll){return $(this).data('tsb').update(sScroll);};
|
|
||||||
|
|
||||||
function Scrollbar(root,options)
|
|
||||||
{
|
|
||||||
var oSelf=this;
|
|
||||||
var oWrapper=root;
|
|
||||||
var oViewport={obj:$(options.viewport,root)};
|
|
||||||
var oContent={obj:$(options.overview,root)};
|
|
||||||
var oScrollbar={obj:$('.scrollbar',root)};
|
|
||||||
var oTrack={obj:$('.track',oScrollbar.obj)};
|
|
||||||
var oThumb={obj:$('.thumb',oScrollbar.obj)};
|
|
||||||
var sAxis=options.axis=='x',sDirection=sAxis?'left':'top',sSize=sAxis?'Width':'Height';
|
|
||||||
var iScroll,iPosition={start:0,now:0},iMouse={};
|
|
||||||
|
|
||||||
function initialize()
|
|
||||||
{
|
|
||||||
oSelf.update();
|
|
||||||
setEvents();
|
|
||||||
return oSelf;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.update=function(sScroll)
|
|
||||||
{
|
|
||||||
oViewport[options.axis]=oViewport.obj[0]['offset'+sSize];
|
|
||||||
oContent[options.axis] = oContent.obj[0]['scroll'+sSize];
|
|
||||||
|
|
||||||
/* Adding border - Start */
|
|
||||||
oContent[options.axis] += oViewport.obj.outerHeight() - oViewport.obj.innerHeight();
|
|
||||||
/* Adding border - End */
|
|
||||||
|
|
||||||
oContent.ratio=oViewport[options.axis]/oContent[options.axis];
|
|
||||||
oScrollbar.obj.toggleClass('disable',oContent.ratio>=1);
|
|
||||||
oTrack[options.axis]=options.size=='auto'?oViewport[options.axis]:options.size;
|
|
||||||
oThumb[options.axis]=Math.min(oTrack[options.axis],Math.max(0,(options.sizethumb=='auto'?(oTrack[options.axis]*oContent.ratio):options.sizethumb)));
|
|
||||||
oScrollbar.ratio=options.sizethumb=='auto'?(oContent[options.axis]/oTrack[options.axis]):(oContent[options.axis]-oViewport[options.axis])/(oTrack[options.axis]-oThumb[options.axis]);
|
|
||||||
iScroll=(sScroll=='relative'&&oContent.ratio<=1)?Math.min((oContent[options.axis]-oViewport[options.axis]),Math.max(0,iScroll)):0;
|
|
||||||
iScroll=(sScroll=='bottom'&&oContent.ratio<=1)?(oContent[options.axis]-oViewport[options.axis]):isNaN(parseInt(sScroll))?iScroll:parseInt(sScroll);
|
|
||||||
setSize();
|
|
||||||
};
|
|
||||||
|
|
||||||
function setSize()
|
|
||||||
{
|
|
||||||
oThumb.obj.css(sDirection,iScroll/oScrollbar.ratio);
|
|
||||||
oContent.obj.css(sDirection,-iScroll);
|
|
||||||
iMouse['start']=oThumb.obj.offset()[sDirection];
|
|
||||||
var sCssSize=sSize.toLowerCase();
|
|
||||||
oScrollbar.obj.css(sCssSize,oTrack[options.axis]);
|
|
||||||
oTrack.obj.css(sCssSize,oTrack[options.axis]);
|
|
||||||
oThumb.obj.css(sCssSize,oThumb[options.axis]);
|
|
||||||
};
|
|
||||||
|
|
||||||
function setEvents()
|
|
||||||
{
|
|
||||||
oThumb.obj.bind('mousedown',start);
|
|
||||||
//[+]oViewport.obj.bind('mousedown',start);
|
|
||||||
oThumb.obj[0].ontouchstart=function(oEvent)
|
|
||||||
{
|
|
||||||
oEvent.preventDefault();
|
|
||||||
oThumb.obj.unbind('mousedown');
|
|
||||||
start(oEvent.touches[0]);
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
oTrack.obj.bind('mouseup',drag);
|
|
||||||
if(options.scroll&&this.addEventListener)
|
|
||||||
{
|
|
||||||
oWrapper[0].addEventListener('DOMMouseScroll',wheel,false);
|
|
||||||
oWrapper[0].addEventListener('mousewheel',wheel,false);
|
|
||||||
}
|
|
||||||
else if(options.scroll){oWrapper[0].onmousewheel=wheel;}
|
|
||||||
};
|
|
||||||
|
|
||||||
function start(oEvent)
|
|
||||||
{
|
|
||||||
iMouse.start=sAxis?oEvent.pageX:oEvent.pageY;
|
|
||||||
var oThumbDir=parseInt(oThumb.obj.css(sDirection));
|
|
||||||
iPosition.start=oThumbDir=='auto'?0:oThumbDir;
|
|
||||||
$(document).bind('mousemove',drag);
|
|
||||||
|
|
||||||
document.ontouchmove=function(oEvent)
|
|
||||||
{
|
|
||||||
$(document).unbind('mousemove');
|
|
||||||
drag(oEvent.touches[0]);
|
|
||||||
};
|
|
||||||
|
|
||||||
$(document).bind('mouseup',end);
|
|
||||||
oThumb.obj.bind('mouseup',end);
|
|
||||||
oThumb.obj[0].ontouchend=document.ontouchend=function(oEvent)
|
|
||||||
{
|
|
||||||
$(document).unbind('mouseup');
|
|
||||||
oThumb.obj.unbind('mouseup');
|
|
||||||
end(oEvent.touches[0]);
|
|
||||||
};
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
function wheel(oEvent)
|
|
||||||
{
|
|
||||||
if(!(oContent.ratio>=1))
|
|
||||||
{
|
|
||||||
//[-]oEvent=$.event.fix(oEvent||window.event);
|
|
||||||
var iDelta=oEvent.wheelDelta?oEvent.wheelDelta/120:-oEvent.detail/3;
|
|
||||||
iScroll-=iDelta*options.wheel;
|
|
||||||
iScroll=Math.min((oContent[options.axis]-oViewport[options.axis]),Math.max(0,iScroll));
|
|
||||||
oThumb.obj.css(sDirection,iScroll/oScrollbar.ratio);oContent.obj.css(sDirection,-iScroll);
|
|
||||||
oEvent.preventDefault();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
function end(oEvent)
|
|
||||||
{
|
|
||||||
$(document).unbind('mousemove',drag);
|
|
||||||
$(document).unbind('mouseup',end);
|
|
||||||
oThumb.obj.unbind('mouseup',end);
|
|
||||||
document.ontouchmove=oThumb.obj[0].ontouchend=document.ontouchend=null;
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
function drag(oEvent)
|
|
||||||
{
|
|
||||||
if(!(oContent.ratio>=1))
|
|
||||||
{
|
|
||||||
iPosition.now=Math.min((oTrack[options.axis]-oThumb[options.axis]),Math.max(0,(iPosition.start+((sAxis?oEvent.pageX:oEvent.pageY)-iMouse.start))));
|
|
||||||
iScroll=iPosition.now*oScrollbar.ratio;oContent.obj.css(sDirection,-iScroll);
|
|
||||||
oThumb.obj.css(sDirection,iPosition.now);;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
return initialize();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
)
|
|
||||||
(jQuery);
|
|
||||||
@@ -153,7 +153,7 @@ databap.onKeyDown = function(e)
|
|||||||
|
|
||||||
function initImageUpload()
|
function initImageUpload()
|
||||||
{
|
{
|
||||||
//load Uploader
|
//Load Uploader
|
||||||
self.tmp('uploader', new qq.FileUploader
|
self.tmp('uploader', new qq.FileUploader
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
@@ -190,8 +190,19 @@ function initImageUpload()
|
|||||||
));
|
));
|
||||||
$('.uploader_box').append($('#message_input').children());
|
$('.uploader_box').append($('#message_input').children());
|
||||||
|
|
||||||
//prompt file explorer
|
//Prompt file explorer
|
||||||
$('#upload_img').click(function(){$('#c1_file').click();});
|
$('#upload_img').click(function(){$('#c1_file').click();});
|
||||||
|
|
||||||
|
//Clipboard handling
|
||||||
|
$(function(){$.pasteimage(function(sSource)
|
||||||
|
{
|
||||||
|
//Parse the uri to strip out "base64"
|
||||||
|
var sSourceSplit = sSource.split("base64,");
|
||||||
|
var sSourceString = sSourceSplit[1];
|
||||||
|
|
||||||
|
//Write base64-encoded string into input field
|
||||||
|
postMessage('/imgsrc '+sSourceString);
|
||||||
|
});});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initSideBar()
|
function initSideBar()
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ databap.pageInit = function()
|
|||||||
sp_fixes: [ 'Détection des 9gag NSFW',
|
sp_fixes: [ 'Détection des 9gag NSFW',
|
||||||
'Réparation de la fonction /invite (+tab pour trouver le nom)',
|
'Réparation de la fonction /invite (+tab pour trouver le nom)',
|
||||||
'Modification des icônes de la <a href="#doc">documentation</a> (<i class="fa fa-c-doc"></i>) et de la <a href="#liste">liste complète</a> (<i class="fa fa-c-list"></i>)'],
|
'Modification des icônes de la <a href="#doc">documentation</a> (<i class="fa fa-c-doc"></i>) et de la <a href="#liste">liste complète</a> (<i class="fa fa-c-list"></i>)'],
|
||||||
ehp_improvements: [ 'Possibilité d\'accéder à tous les messags non lus, mêmes plus anciens qu\'une journée. cf. <a href="#options">#options</a>',
|
ehp_improvements: [ 'Copier-coller une image dans le chat : en utilisant l\'icone en bas à droite du chat ou par glisser déposer depuis l\'exporer ou depuis le presse-papier (attention de bien déselectionner la barre de message avant de coller)',
|
||||||
|
'Possibilité d\'accéder à tous les messags non lus, mêmes plus anciens qu\'une journée. cf. <a href="#options">#options</a>',
|
||||||
'Nouveau design',
|
'Nouveau design',
|
||||||
'Lecture de notes SAP (sans authentification) : #note-<num>',
|
'Lecture de notes SAP (sans authentification) : #note-<num>',
|
||||||
'Annonceurs: Commande /news X : Vous annoncez le message X (votre message est ajouté à la liste des news automatiquement)',
|
'Annonceurs: Commande /news X : Vous annoncez le message X (votre message est ajouté à la liste des news automatiquement)',
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -210,6 +210,9 @@
|
|||||||
margin-top:10px;
|
margin-top:10px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
#welcome #welcome_container ul li .fa-li {
|
||||||
|
top: 0.242857em;
|
||||||
|
}
|
||||||
|
|
||||||
#welcome #welcome_container ul li ul {
|
#welcome #welcome_container ul li ul {
|
||||||
font-size:$size_big;
|
font-size:$size_big;
|
||||||
|
|||||||
Reference in New Issue
Block a user