broken in 2.2? :S Removing for a minimal release, 2.2.1 will be for extra features and things again \o/
git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.2@906 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
04f335b797
commit
554ff9051c
Binary file not shown.
Before Width: | Height: | Size: 183 B |
Binary file not shown.
Before Width: | Height: | Size: 227 B |
Binary file not shown.
Before Width: | Height: | Size: 170 B |
Binary file not shown.
Before Width: | Height: | Size: 198 B |
Binary file not shown.
@ -1,174 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Name: Tagger
|
||||
* Description: Advanced Tagging v2
|
||||
* Author: Artanis (Erik Youngren) <artanis.00@gmail.com>
|
||||
* Do not remove this notice.
|
||||
*/
|
||||
|
||||
class Tagger extends Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event ($event) {
|
||||
if(is_null($this->theme))
|
||||
$this->theme = get_theme_object("tagger", "taggerTheme");
|
||||
|
||||
if(is_a($event,'DisplayingImageEvent')) {
|
||||
global $page, $config, $user;
|
||||
|
||||
if($config->get_bool("tag_edit_anon")
|
||||
|| ($user->id != $config->get_int("anon_id"))
|
||||
&& $config->get_bool("ext_tagger_enabled"))
|
||||
{
|
||||
$this->theme->build_tagger($page,$event);
|
||||
}
|
||||
}
|
||||
if(is_a($event,'SetupBuildingEvent')) {
|
||||
$sb = new SetupBlock("Tagger");
|
||||
$sb->add_bool_option("ext_tagger_enabled","Enable Tagger");
|
||||
$sb->add_int_option("ext_tagger_search_delay","<br/>Delay queries by ");
|
||||
$sb->add_label(" milliseconds.");
|
||||
$sb->add_label("<br/>Limit queries returning more than ");
|
||||
$sb->add_int_option("ext_tagger_tag_max");
|
||||
$sb->add_label(" tags to ");
|
||||
$sb->add_int_option("ext_tagger_limit");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
}
|
||||
} add_event_listener( new tagger());
|
||||
|
||||
// Tagger AJAX back-end
|
||||
class TaggerXML extends Extension {
|
||||
public function receive_event($event) {
|
||||
if(is_a($event,'PageRequestEvent')
|
||||
&& $event->page_name == "tagger"
|
||||
&& $event->get_arg(0) == "tags")
|
||||
{
|
||||
global $page;
|
||||
|
||||
//$match_tags = null;
|
||||
//$image_tags = null;
|
||||
$tags=null;
|
||||
if (isset($_GET['s'])) { // tagger/tags[/...]?s=$string
|
||||
// return matching tags in XML form
|
||||
$tags = $this->match_tag_list($_GET['s']);
|
||||
} else if($event->get_arg(1)) { // tagger/tags/$int
|
||||
// return arg[1] AS image_id's tag list in XML form
|
||||
$tags = $this->image_tag_list($event->get_arg(1));
|
||||
}
|
||||
|
||||
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".
|
||||
"<tags>".
|
||||
$tags.
|
||||
"</tags>";
|
||||
|
||||
$page->set_mode("data");
|
||||
$page->set_type("text/xml");
|
||||
$page->set_data($xml);
|
||||
}
|
||||
}
|
||||
|
||||
private function match_tag_list ($s) {
|
||||
global $database, $config, $event;
|
||||
|
||||
$max_rows = $config->get_int("ext_tagger_tag_max",30);
|
||||
$limit_rows = $config->get_int("ext_tagger_limit",30);
|
||||
|
||||
$values = array();
|
||||
|
||||
// Match
|
||||
$p = strlen($s) == 1? " ":"\_";
|
||||
$sq = "%".$p.mysql_real_escape_string($s)."%";
|
||||
$match = "concat(?,tag) LIKE ?";
|
||||
array_push($values,$p,$sq);
|
||||
// Exclude
|
||||
// $exclude = $event->get_arg(1)? "AND NOT IN ".$this->image_tags($event->get_arg(1)) : null;
|
||||
|
||||
// Hidden Tags
|
||||
$hidden = $config->get_string('ext-tagger_show-hidden','N')=='N' ?
|
||||
"AND substring(tag,1,1) != '.'" : null;
|
||||
|
||||
$q_where = "WHERE {$match} {$hidden} AND count > 0";
|
||||
|
||||
// FROM based on return count
|
||||
$q_from = null;
|
||||
$count = $this->count($q_where,$values);
|
||||
if ($count > $max_rows) {
|
||||
$q_from = "FROM (SELECT * FROM `tags` {$q_where} ".
|
||||
"ORDER BY count DESC LIMIT 0, {$limit_rows}) AS `c_tags`";
|
||||
$q_where = null;
|
||||
$count = array("max"=>$count);
|
||||
} else {
|
||||
$q_from = "FROM `tags`";
|
||||
$count = null;
|
||||
}
|
||||
|
||||
$tags = $database->Execute("
|
||||
SELECT *
|
||||
{$q_from}
|
||||
{$q_where}
|
||||
ORDER BY tag",
|
||||
$values);
|
||||
|
||||
return $this->list_to_xml($tags,"search",$s,$count);
|
||||
}
|
||||
|
||||
private function image_tag_list ($image_id) {
|
||||
global $database;
|
||||
$tags = $database->Execute("
|
||||
SELECT tags.*
|
||||
FROM image_tags JOIN tags ON image_tags.tag_id = tags.id
|
||||
WHERE image_id=? ORDER BY tag", array($image_id));
|
||||
return $this->list_to_xml($tags,"image",$image_id);
|
||||
}
|
||||
|
||||
private function list_to_xml ($tags,$type,$query,$misc=null) {
|
||||
$r = $tags->_numOfRows;
|
||||
|
||||
$s_misc = "";
|
||||
if(!is_null($misc))
|
||||
foreach($misc as $attr => $val) $s_misc .= " ".$attr."=\"".$val."\"";
|
||||
|
||||
$result = "<list id=\"$type\" query=\"$query\" rows=\"$r\"{$s_misc}>";
|
||||
foreach($tags as $tag) {
|
||||
$result .= $this->tag_to_xml($tag);
|
||||
}
|
||||
return $result."</list>";
|
||||
}
|
||||
|
||||
private function tag_to_xml ($tag) {
|
||||
return
|
||||
"<tag ".
|
||||
"id=\"".$tag['id']."\" ".
|
||||
"count=\"".$tag['count']."\">".
|
||||
html_escape($tag['tag']).
|
||||
"</tag>";
|
||||
}
|
||||
|
||||
private function count($query,$values) {
|
||||
global $database;
|
||||
return $database->Execute(
|
||||
"SELECT COUNT(*) FROM `tags` $query",$values)->fields['COUNT(*)'];
|
||||
}
|
||||
|
||||
private function image_tags ($image_id) {
|
||||
global $database;
|
||||
$list = "(";
|
||||
$i_tags = $database->Execute(
|
||||
"SELECT tag_id FROM `image_tags` WHERE image_id=?",
|
||||
array($image_id));
|
||||
|
||||
$b = false;
|
||||
foreach($i_tags as $tag) {
|
||||
if($b)
|
||||
$list .= ",";
|
||||
$b = true;
|
||||
$list .= $tag['tag_id'];
|
||||
|
||||
}
|
||||
$list .= ")";
|
||||
|
||||
return $list;
|
||||
}
|
||||
} add_event_listener( new taggerXML(),10);
|
||||
?>
|
@ -1,218 +0,0 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||
* Tagger - Advanced Tagging v2 *
|
||||
* Author: Artanis (Erik Youngren <artanis.00@gmail.com>) *
|
||||
* Do not remove this notice. *
|
||||
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
var Tagger = {
|
||||
initialize : function (image_id) {
|
||||
// object navigation
|
||||
this.tag.parent = this;
|
||||
this.position.parent = this;
|
||||
// components
|
||||
this.editor.container = byId('tagger_parent');
|
||||
this.editor.titlebar = byId('tagger_titlebar');
|
||||
this.editor.toolbar = byId('tagger_toolbar');
|
||||
//this.editor.menu = byId('tagger_p-menu');
|
||||
this.editor.body = byId('tagger_body');
|
||||
this.editor.tags = byId('tagger_tags');
|
||||
this.editor.form = this.editor.tags.parentNode;
|
||||
this.editor.statusbar = byId('tagger_statusbar');
|
||||
// initial data
|
||||
this.tag.image = image_id;
|
||||
this.tag.query = config.make_link("tagger/tags");
|
||||
this.tag.list = null;
|
||||
this.tag.suggest = null;
|
||||
this.tag.image_tags();
|
||||
|
||||
// reveal
|
||||
this.editor.container.style.display = "";
|
||||
|
||||
// dragging
|
||||
DragHandler.attach(this.editor.titlebar);
|
||||
|
||||
// positioning
|
||||
this.position.load();
|
||||
|
||||
// events
|
||||
window.onunload = function () { Tagger.position.save(); };
|
||||
},
|
||||
|
||||
alert : function (type,text,timeout) {
|
||||
var id = "tagger_alert-"+type
|
||||
var t_alert = byId(id);
|
||||
if (t_alert) {
|
||||
if(text == false) {
|
||||
// remove
|
||||
t_alert.parentNode.removeChild(t_alert);
|
||||
} else {
|
||||
// update
|
||||
t_alert.innerHTML = text;
|
||||
}
|
||||
} else if (text) {
|
||||
// create
|
||||
var t_alert = document.createElement("div");
|
||||
t_alert.setAttribute("id",id);
|
||||
t_alert.appendChild(document.createTextNode(text));
|
||||
this.editor.statusbar.appendChild(t_alert);
|
||||
if(timeout>1) {
|
||||
console.log("Tagger.alert('"+type+"',false,0)");
|
||||
setTimeout("Tagger.alert('"+type+"',false,0)",timeout);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
editor : {},
|
||||
|
||||
tag : {
|
||||
submit : function () {
|
||||
var l = this.list.childNodes.length;
|
||||
var tags = Array();
|
||||
for(var i=0; i<l; i++) {
|
||||
var s_tag = this.list.childNodes[i].firstChild.data;
|
||||
tags.push(s_tag);
|
||||
}
|
||||
tags = tags.join(" ");
|
||||
this.parent.editor.tags.value = tags;
|
||||
return true;
|
||||
},
|
||||
|
||||
search : function(s,ms) {
|
||||
clearTimeout(Tagger.tag.timer);
|
||||
Tagger.tag.timer = setTimeout(
|
||||
"Tagger.tag.ajax('"+Tagger.tag.query+"?s="+s+"',Tagger.tag.receive)",
|
||||
ms);
|
||||
},
|
||||
|
||||
receive : function (xml) {
|
||||
if(xml) {
|
||||
Tagger.tag.suggest = document.importNode(
|
||||
xml.responseXML.getElementsByTagName("list")[0],true);
|
||||
Tagger.tag.publish(Tagger.tag.suggest,byId("tagger_p-search"));
|
||||
}
|
||||
if(Tagger.tag.suggest.getAttribute("max")) {
|
||||
var rows = Tagger.tag.suggest.getAttribute("rows");
|
||||
var max = Tagger.tag.suggest.getAttribute("max");
|
||||
Tagger.alert("maxout","Showing "+rows+" of "+max+" tags",0);
|
||||
} else {
|
||||
Tagger.alert("maxout",false);
|
||||
}
|
||||
},
|
||||
|
||||
image_tags : function(xml) {
|
||||
if (!xml) {
|
||||
this.ajax(this.query+"/"+this.image,this.image_tags);
|
||||
return true;
|
||||
} else {
|
||||
Tagger.tag.list = document.importNode(
|
||||
xml.responseXML.getElementsByTagName("list")[0],true);
|
||||
Tagger.tag.publish(Tagger.tag.list,byId("tagger_p-applied"));
|
||||
}
|
||||
},
|
||||
|
||||
publish : function (list, page) {
|
||||
list.setAttribute("xmlns","http://www.w3.org/1999/xhtml");
|
||||
|
||||
var l = list.childNodes.length;
|
||||
for(var i=0; i<l; i++) {
|
||||
var tag = list.childNodes[i];
|
||||
tag.onclick = function () {
|
||||
Tagger.tag.toggle(this);
|
||||
byId("tagger_filter").select();
|
||||
};
|
||||
tag.setAttribute("title",tag.getAttribute("count")+" uses");
|
||||
}
|
||||
|
||||
page.innerHTML = "";
|
||||
page.appendChild(list);
|
||||
},
|
||||
|
||||
create : function (tag_name) {
|
||||
if(tag_name.length > 0) {
|
||||
var tag = document.createElement("tag");
|
||||
tag.setAttribute("count","0");
|
||||
tag.setAttribute("id","newTag_"+tag_name);
|
||||
tag.setAttribute("title","New - 0 uses");
|
||||
tag.onclick = function() {
|
||||
Tagger.tag.toggle(this);
|
||||
};
|
||||
tag.appendChild(document.createTextNode(tag_name));
|
||||
Tagger.tag.list.appendChild(tag);
|
||||
}
|
||||
},
|
||||
|
||||
toggle : function (tag) {
|
||||
if(tag.parentNode == this.list) {
|
||||
this.list.removeChild(tag);
|
||||
} else {
|
||||
this.list.appendChild(tag);
|
||||
}
|
||||
},
|
||||
|
||||
ajax : function (url, callback) {
|
||||
var http = (new XMLHttpRequest || new ActiveXObject("Microsoft.XMLHTTP"));
|
||||
http.open("GET",url,true);
|
||||
http.onreadystatechange = function () {
|
||||
if(http.readyState == 4) callback(http);
|
||||
};
|
||||
http.send(null);
|
||||
}
|
||||
},
|
||||
|
||||
position : {
|
||||
set : function (x,y) {
|
||||
if (!x || !y) {
|
||||
with(this.parent.editor.container.style) {
|
||||
top = "25px";
|
||||
left = "";
|
||||
right = "25px";
|
||||
bottom = "";
|
||||
}
|
||||
var xy = this.get();
|
||||
x = xy[0];
|
||||
y = xy[1];
|
||||
}
|
||||
with(this.parent.editor.container.style) {
|
||||
top = y+"px";
|
||||
left = x+"px";
|
||||
right = "";
|
||||
bottom = "";
|
||||
}
|
||||
},
|
||||
|
||||
get : function () {
|
||||
// http://www.quirksmode.org/js/findpos.html
|
||||
var left = 0;
|
||||
var top = 0;
|
||||
var obj = this.parent.editor.container;
|
||||
if(obj.offsetParent) {
|
||||
left = obj.offsetLeft;
|
||||
top = obj.offsetTop;
|
||||
while (obj = obj.offsetParent) {
|
||||
left += obj.offsetLeft;
|
||||
top += obj.offsetTop;
|
||||
}
|
||||
}
|
||||
return [left,top];
|
||||
},
|
||||
|
||||
save : function (x,y) {
|
||||
if (!x || !y) {
|
||||
var xy = this.get();
|
||||
x = xy[0];
|
||||
y = xy[1];
|
||||
}
|
||||
setCookie(config.title+"_tagger-position",x+" "+y,14);
|
||||
},
|
||||
|
||||
load : function () {
|
||||
var p = getCookie(config.title+"_tagger-position");
|
||||
if(p) {
|
||||
var xy = p.split(" ");
|
||||
this.set(xy[0],xy[1]);
|
||||
} else {
|
||||
this.set();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -1,104 +0,0 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Tagger - Advanced Tagging v2 *
|
||||
* Author: Artanis (Erik Youngren <artanis.00@gmail.com>) *
|
||||
* Do not remove this notice. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#tagger_parent {
|
||||
text-align:left;
|
||||
position:fixed;
|
||||
max-width:300px;
|
||||
|
||||
}
|
||||
#tagger_parent * {
|
||||
background-color:#EEE;
|
||||
}
|
||||
|
||||
#tagger_titlebar {
|
||||
background-color:#ddd;
|
||||
border:2px solid;
|
||||
cursor:move;
|
||||
font-weight:bold;
|
||||
-moz-border-radius:5px 5px 0 0;
|
||||
padding:.25em;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
#tagger_toolbar, #tagger_body {
|
||||
padding:2px 2px 0 2px;
|
||||
border-style:solid;
|
||||
border-width: 0px 2px 0px 2px;
|
||||
}
|
||||
#tagger_body {
|
||||
max-height:175px;
|
||||
overflow:auto;
|
||||
overflow-x:hidden;
|
||||
overflow-y:auto;
|
||||
}
|
||||
|
||||
#tagger_statusbar {
|
||||
background-color:#ddd;
|
||||
border:2px solid;
|
||||
font-weight: bold;
|
||||
min-height:16px;
|
||||
-moz-border-radius:0 0 5px 5px;
|
||||
padding:.25em;
|
||||
} #tagger_statusbar * { background-color:#ddd; }
|
||||
|
||||
#tagger_body div {
|
||||
padding-top:2px;
|
||||
margin-top:2px;
|
||||
border-top:1px solid;
|
||||
}
|
||||
|
||||
/* Tagger Styling
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
#tagger_parent form {
|
||||
display:inline;
|
||||
}
|
||||
#tagger_parent input {
|
||||
width:auto;
|
||||
}
|
||||
#tagger_parent input[type=text] {
|
||||
background-color:white;
|
||||
}
|
||||
|
||||
/* Custom Element Base Styles
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#tagger_parent list {
|
||||
display: block;
|
||||
}
|
||||
#tagger_parent tag {
|
||||
font-size:1.25em;
|
||||
display:block;
|
||||
}
|
||||
|
||||
#tagger_parent list[id=image] tag:before {
|
||||
content:url('./images/active.png');
|
||||
}
|
||||
|
||||
#tagger_parent list[id=search] tag:before {
|
||||
content:url('./images/inactive.png');
|
||||
}
|
||||
/* Hovering */
|
||||
#tagger_parent tag:hover {
|
||||
cursor:pointer;
|
||||
background-color:#ddd;
|
||||
}
|
||||
|
||||
/*#tagger_parent list[id=image] tag:hover {
|
||||
background-color:#faa;
|
||||
}
|
||||
|
||||
#tagger_parent list[id=search] tag:hover {
|
||||
background-color:#afa;
|
||||
}*/
|
||||
|
||||
#tagger_parent list[id=image] tag:hover:before {
|
||||
content:url('./images/rem-tag.png');
|
||||
}
|
||||
|
||||
#tagger_parent list[id=search] tag:hover:before {
|
||||
content:url('./images/add-tag.png');
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Tagger - Advanced Tagging v2 *
|
||||
* Author: Artanis (Erik Youngren <artanis.00@gmail.com>) *
|
||||
* Do not remove this notice. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
class taggerTheme extends Themelet {
|
||||
public function build_tagger ($page, $event) {
|
||||
global $config;
|
||||
// Initialization code
|
||||
$base_href = $config->get_string('base_href');
|
||||
// TODO: AJAX test and fallback.
|
||||
$page->add_header("<script src='$base_href/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>");
|
||||
$page->add_block(new Block(null,
|
||||
"<script type='text/javascript'>Tagger.initialize("
|
||||
.$event->get_image()->id.");</script>","main",1000));
|
||||
|
||||
// Tagger block
|
||||
$page->add_block( new Block(
|
||||
null,
|
||||
$this->html($event->get_image()),
|
||||
"main"));
|
||||
}
|
||||
private function html($image) {
|
||||
global $config;
|
||||
$i_image_id = int_escape($image->id);
|
||||
$h_source = html_escape($image->source);
|
||||
$h_query = isset($_GET['search'])? $h_query= "search=".url_escape($_GET['search']) : "";
|
||||
|
||||
$delay = $config->get_string("ext_tagger_search_delay","250");
|
||||
|
||||
$url_form = make_link("tag_edit/set");
|
||||
|
||||
// TODO: option for initial Tagger window placement.
|
||||
$html = <<< EOD
|
||||
<div id="tagger_parent" style="display:none; top:25px; right:25px;">
|
||||
<div id="tagger_titlebar">Tagger</div>
|
||||
|
||||
<div id="tagger_toolbar">
|
||||
<input type="text" value="" id="tagger_filter" onkeyup="Tagger.tag.search(this.value, $delay);"></input>
|
||||
<input type="button" value="Add" onclick="Tagger.tag.create(byId('tagger_filter').value);"></input>
|
||||
<form action="$url_form" method="POST" onsubmit="Tagger.tag.submit();">
|
||||
<input type='hidden' name='image_id' value='$i_image_id' id="image_id"></input>
|
||||
<input type='hidden' name='query' value='$h_query'></input>
|
||||
<input type='hidden' name='source' value='$h_source'></input>
|
||||
<input type="hidden" name="tags" value="" id="tagger_tags"></input>
|
||||
|
||||
<input type="submit" value="Set"></input>
|
||||
</form>
|
||||
<!--<ul id="tagger_p-menu"></ul>
|
||||
<br style="clear:both;"/>-->
|
||||
</div>
|
||||
|
||||
<div id="tagger_body">
|
||||
<div id="tagger_p-search" name="Searched Tags"></div>
|
||||
<div id="tagger_p-applied" name="Applied Tags"></div>
|
||||
</div>
|
||||
<div id="tagger_statusbar"></div>
|
||||
</div>
|
||||
EOD;
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,85 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* Crossbrowser Drag Handler
|
||||
* http://www.webtoolkit.info/
|
||||
*
|
||||
* Modified by Erik Youngren to move parent node
|
||||
**/
|
||||
|
||||
var DragHandler = {
|
||||
|
||||
|
||||
// private property.
|
||||
_oElem : null,
|
||||
|
||||
|
||||
// public method. Attach drag handler to an element.
|
||||
attach : function(oElem) {
|
||||
oElem.onmousedown = DragHandler._dragBegin;
|
||||
|
||||
// callbacks
|
||||
oElem.dragBegin = new Function();
|
||||
oElem.drag = new Function();
|
||||
oElem.dragEnd = new Function();
|
||||
|
||||
return oElem;
|
||||
},
|
||||
|
||||
|
||||
// private method. Begin drag process.
|
||||
_dragBegin : function(e) {
|
||||
var oElem = DragHandler._oElem = this;
|
||||
|
||||
if (isNaN(parseInt(oElem.parentNode.style.left))) { oElem.parentNode.style.left = '0px'; }
|
||||
if (isNaN(parseInt(oElem.parentNode.style.top))) { oElem.parentNode.style.top = '0px'; }
|
||||
|
||||
var x = parseInt(oElem.parentNode.style.left);
|
||||
var y = parseInt(oElem.parentNode.style.top);
|
||||
|
||||
e = e ? e : window.event;
|
||||
oElem.mouseX = e.clientX;
|
||||
oElem.mouseY = e.clientY;
|
||||
|
||||
oElem.dragBegin(oElem, x, y);
|
||||
|
||||
document.onmousemove = DragHandler._drag;
|
||||
document.onmouseup = DragHandler._dragEnd;
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
// private method. Drag (move) element.
|
||||
_drag : function(e) {
|
||||
var oElem = DragHandler._oElem;
|
||||
|
||||
var x = parseInt(oElem.parentNode.style.left);
|
||||
var y = parseInt(oElem.parentNode.style.top);
|
||||
|
||||
e = e ? e : window.event;
|
||||
oElem.parentNode.style.left = x + (e.clientX - oElem.mouseX) + 'px';
|
||||
oElem.parentNode.style.top = y + (e.clientY - oElem.mouseY) + 'px';
|
||||
|
||||
oElem.mouseX = e.clientX;
|
||||
oElem.mouseY = e.clientY;
|
||||
|
||||
oElem.drag(oElem, x, y);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
// private method. Stop drag process.
|
||||
_dragEnd : function() {
|
||||
var oElem = DragHandler._oElem;
|
||||
|
||||
var x = parseInt(oElem.parentNode.style.left);
|
||||
var y = parseInt(oElem.parentNode.style.top);
|
||||
|
||||
oElem.dragEnd(oElem, x, y);
|
||||
|
||||
document.onmousemove = null;
|
||||
document.onmouseup = null;
|
||||
DragHandler._oElem = null;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user