fixed tool for webkit
This commit is contained in:
parent
f56c713c3f
commit
98aadae1c7
|
@ -117,10 +117,13 @@ function handleRevision(json) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
if (window.navigator.userAgent.indexOf("Firefox") == -1) {
|
|
||||||
alert("Sorry, this currently only works in Firefox.");
|
if ($.browser.msie) {
|
||||||
|
alert("Sorry, this does not currently work in Internet Explorer.");
|
||||||
window.location.href = "/";
|
window.location.href = "/";
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ARTICLE_ID != 0) {
|
if (ARTICLE_ID != 0) {
|
||||||
loadArticle(ARTICLE_ID);
|
loadArticle(ARTICLE_ID);
|
||||||
} else {
|
} else {
|
||||||
|
@ -263,11 +266,11 @@ Canvas.prototype.init = function() {
|
||||||
if ($(ui.draggable).attr('class') == 'resource ui-draggable') {
|
if ($(ui.draggable).attr('class') == 'resource ui-draggable') {
|
||||||
r = edgeBin.allResources[$(ui.draggable).attr("data-index")];
|
r = edgeBin.allResources[$(ui.draggable).attr("data-index")];
|
||||||
if (r.mime == 'image') {
|
if (r.mime == 'image') {
|
||||||
top = $(this).position().top;
|
var top = $(this).position().top;
|
||||||
left = $(this).position().left;
|
var left = $(this).position().left;
|
||||||
height = parseInt(r.height) / 2;
|
var height = parseInt(r.height) / 2;
|
||||||
// console.log("heightFOO: " + height);
|
// console.log("heightFOO: " + height);
|
||||||
width = parseInt(r.width) / 2;
|
var width = parseInt(r.width) / 2;
|
||||||
highest_index = getHighestIndex(c.jq);
|
highest_index = getHighestIndex(c.jq);
|
||||||
new_index = parseInt(highest_index) + 1;
|
new_index = parseInt(highest_index) + 1;
|
||||||
// console.log('index: ' + new_index);
|
// console.log('index: ' + new_index);
|
||||||
|
@ -278,8 +281,8 @@ Canvas.prototype.init = function() {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var elem = $(ui.draggable);
|
var elem = $(ui.draggable);
|
||||||
top = $(this).position().top;
|
var top = $(this).position().top;
|
||||||
left = $(this).position().left;
|
var left = $(this).position().left;
|
||||||
if (elem.hasClass('arabic')) {
|
if (elem.hasClass('arabic')) {
|
||||||
t = new TextBox(c, {'html': '<p class="textbox_canvas_text">انقر على مربع التحرير</p>', 'css': {'direction': 'rtl'}});
|
t = new TextBox(c, {'html': '<p class="textbox_canvas_text">انقر على مربع التحرير</p>', 'css': {'direction': 'rtl'}});
|
||||||
} else {
|
} else {
|
||||||
|
@ -503,6 +506,13 @@ TextBox.prototype.init = function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
var e = $('<div />');
|
var e = $('<div />');
|
||||||
e.html(tmpl('tmpl_textbox', {'html': that.html})).attr("data-id", that.id).attr("data-index", that.index).css(that.css).addClass("box").addClass("textBox");
|
e.html(tmpl('tmpl_textbox', {'html': that.html})).attr("data-id", that.id).attr("data-index", that.index).css(that.css).addClass("box").addClass("textBox");
|
||||||
|
/* Workaround for strange webkit behaviour */
|
||||||
|
|
||||||
|
if (e.css("position") == "relative" || e.css("position") == '') {
|
||||||
|
e.css("position", "absolute");
|
||||||
|
}
|
||||||
|
// console.log(e.css("position"));
|
||||||
|
// GLOB = e.css("position");
|
||||||
// e.append($('<div />').addClass("boxText"));
|
// e.append($('<div />').addClass("boxText"));
|
||||||
e.draggable({
|
e.draggable({
|
||||||
snap: '.box, .ruler',
|
snap: '.box, .ruler',
|
||||||
|
@ -1250,8 +1260,8 @@ $(".box").live("click", function(e){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
top = parseInt($(this).css('top'));
|
var top = parseInt($(this).css('top'));
|
||||||
left = parseInt($(this).css('left'));
|
var left = parseInt($(this).css('left'));
|
||||||
var box = $(this).find('*').getBox().jq;
|
var box = $(this).find('*').getBox().jq;
|
||||||
var boxObj = $(this).find('*').getBox();
|
var boxObj = $(this).find('*').getBox();
|
||||||
if ($(".properties").length == 0) {
|
if ($(".properties").length == 0) {
|
||||||
|
@ -1469,7 +1479,7 @@ $(".box").live("click", function(e){
|
||||||
// console.log(event.keyCode);
|
// console.log(event.keyCode);
|
||||||
if (event.keyCode == '38') {
|
if (event.keyCode == '38') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
top = box.css('top');
|
var top = box.css('top');
|
||||||
if (parseInt(top) > 1) {
|
if (parseInt(top) > 1) {
|
||||||
boxObj.setCSS({'top': toPx(parseInt(top) - 1)});
|
boxObj.setCSS({'top': toPx(parseInt(top) - 1)});
|
||||||
// console.log('up?');
|
// console.log('up?');
|
||||||
|
@ -1477,10 +1487,10 @@ $(".box").live("click", function(e){
|
||||||
}
|
}
|
||||||
if (event.keyCode == '40') {
|
if (event.keyCode == '40') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
top = box.css('top');
|
var top = box.css('top');
|
||||||
height = box.outerHeight();
|
var height = box.outerHeight();
|
||||||
lower_edge = parseInt(top) + parseInt(height);
|
var lower_edge = parseInt(top) + parseInt(height);
|
||||||
canvas_height = canvas.css('height');
|
var canvas_height = canvas.css('height');
|
||||||
// console.log('canvas_height:' + canvas_height);
|
// console.log('canvas_height:' + canvas_height);
|
||||||
// console.log('box lower:' + lower_edge);
|
// console.log('box lower:' + lower_edge);
|
||||||
if (lower_edge < parseInt(canvas_height)) {
|
if (lower_edge < parseInt(canvas_height)) {
|
||||||
|
@ -1491,9 +1501,9 @@ $(".box").live("click", function(e){
|
||||||
}
|
}
|
||||||
if (event.keyCode == '39') {
|
if (event.keyCode == '39') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
left = box.css('left');
|
var left = box.css('left');
|
||||||
width = box.outerWidth();
|
var width = box.outerWidth();
|
||||||
right_edge = parseInt(left) + parseInt(width);
|
var right_edge = parseInt(left) + parseInt(width);
|
||||||
canvas_width = canvas.css('width');
|
canvas_width = canvas.css('width');
|
||||||
if (right_edge < parseInt(canvas_width)) {
|
if (right_edge < parseInt(canvas_width)) {
|
||||||
boxObj.setCSS({'left': toPx(parseInt(left) + 1)});
|
boxObj.setCSS({'left': toPx(parseInt(left) + 1)});
|
||||||
|
@ -1533,10 +1543,10 @@ $(".box").live("click", function(e){
|
||||||
|
|
||||||
$(".z-index-add").bind("click", function(e){
|
$(".z-index-add").bind("click", function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
canvas = box.parents('.canvas');
|
var canvas = box.parents('.canvas');
|
||||||
highest_index = getHighestIndex(canvas);
|
highest_index = getHighestIndex(canvas);
|
||||||
// console.log(highest_index);
|
// console.log(highest_index);
|
||||||
new_index = highest_index + 1;
|
var new_index = highest_index + 1;
|
||||||
boxObj.setCSS({'z-index': new_index});
|
boxObj.setCSS({'z-index': new_index});
|
||||||
reSortBoxes(canvas);
|
reSortBoxes(canvas);
|
||||||
});
|
});
|
||||||
|
@ -1559,8 +1569,8 @@ $(".box").live("click", function(e){
|
||||||
|
|
||||||
$(".canvas").live("mousemove", function(e){
|
$(".canvas").live("mousemove", function(e){
|
||||||
|
|
||||||
left = parseInt($(this).position().left) + parseInt($(this).css('margin-left'));
|
var left = parseInt($(this).position().left) + parseInt($(this).css('margin-left'));
|
||||||
top = parseInt($(this).position().top) + parseInt($(this).css('margin-top'));
|
var top = parseInt($(this).position().top) + parseInt($(this).css('margin-top'));
|
||||||
// console.log(top);
|
// console.log(top);
|
||||||
var pageCoords = "( " + (e.pageX - left) + ", " + (e.pageY - top) + " )";
|
var pageCoords = "( " + (e.pageX - left) + ", " + (e.pageY - top) + " )";
|
||||||
$('#coordinates').html(pageCoords);
|
$('#coordinates').html(pageCoords);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
|
margin-left: 12px;
|
||||||
color: #393939;
|
color: #393939;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user