?? ricodraganddropcustomdraggable.js
字號(hào):
var names = [ "李, Debbie", "Barnes, Pat", "Dampier, Joan", "Alvarez, Randy", "Neil, William", "Hardoway, Kimber", "Story, Leslie", "Lott, Charlie", "Patton, Sabrina", "Lopez, Juan" ];var names2 = [ "Holloman, Debbie", "Barnes, Pat", "Dampier, Joan", "Alvarez, Randy", "Neil, William", "Hardoway, Kimber", "Story, Leslie", "Lott, Charlie", "Patton, Sabrina", "Lopez, Juan" ];function writeNameSpans() { for ( var i = 0 ; i < names.length ; i++ ) document.write( "<span id='d" + i + "' class='nameSpan' style='border:1px solid #ffffee;display:block'>" + names[i] + "</span>" );}function createDraggables() { for ( var i = 0 ; i < names.length ; i++ ) dndMgr.registerDraggable( new CustomDraggable($('d'+i), names[i], names[i]) );}function writeNameSpans2() { for ( var i = 0 ; i < names2.length ; i++ ) document.write( "<span id='e" + i + "' class='nameSpan' style='border:1px solid #ffffee;display:block'>" + names2[i] + "</span>" );}function createDraggables2() { for ( var i = 0 ; i < names2.length ; i++ ) dndMgr.registerDraggable( new CustomDraggable($('e'+i), names2[i], names2[i]) );}//function closeMe_order(obj,o){ obj.style.display='none'; //恢復(fù)源選項(xiàng) //alert($(o)); order_array.splice(getArrayIDByValue(order_array,o),1);}//by hsr 2006-2-27function closeMe(obj,o){ obj.style.display='none'; //恢復(fù)源選項(xiàng) //alert($(o)); $(o).style.display='block'; //alert(getArrayIDByValue(fields_array,this.name)); fields_array.splice(getArrayIDByValue(fields_array,o),1);}function closeMe_table(obj,o){ obj.style.display='none'; table_array.splice(getArrayIDByValue(table_array,o),1); $('table1').style.display='none';}function closeMe_where(obj,o){ obj.style.display='none'; where_array.splice(getArrayIDByValue(where_array,o),1); where_array_view.splice(getArrayIDByValue(where_array,o),1);}function closeMe_group(obj,o){ obj.style.display='none'; group_array.splice(getArrayIDByValue(group_array,o),1);}function showField(tableid){ $("dragBox"+tableid).style.display='block';}/** * Sample 'CustomDraggable' object which extends the Rico.Draggable to * override the behaviors associated with a draggable object... * **/var CustomDraggable = Class.create();//CustomDraggable.removeOnDrop = false;//CustomDraggable.revereNamesOnDrop = true;CustomDraggable.removeOnDrop = true;CustomDraggable.revereNamesOnDrop = false;CustomDraggable.prototype = (new Rico.Draggable()).extend( { initialize: function( htmlElement, name ,id) { this.type = 'Custom'; this.htmlElement = $(htmlElement); this.name = name; this.id = id; }, log: function(str) { new Insertion.Bottom( $('logger'), "<span class='logMsg'>" + str + "</span>" ); $('logger').scrollTop = $('logger').lastChild.offsetTop; }, select: function() { this.selected = true; var el = this.htmlElement; // show the item selected..... el.style.color = "#ffffff"; el.style.backgroundColor = "#08246b"; el.style.border = "1px solid blue"; }, deselect: function() { this.selected = false; var el = this.htmlElement; el.style.color = "#2b2b2b"; el.style.backgroundColor = "transparent"; el.style.border = "1px solid #ffffee"; }, startDrag: function() { var el = this.htmlElement; this.log("startDrag: [" + this.name +"]"); }, cancelDrag: function() { var el = this.htmlElement; this.log("cancelDrag: [" + this.name +"]"); }, endDrag: function() { var el = this.htmlElement; fields_array.push(this.id); this.log("endDrag: [" + this.name +"]"); if ( CustomDraggable.removeOnDrop ) this.htmlElement.style.display = 'none'; }, getSingleObjectDragGUI: function() { var el = this.htmlElement; var div = document.createElement("div"); div.className = 'customDraggable'; div.style.width = (this.htmlElement.offsetWidth - 10) + "px"; new Insertion.Top( div, this.name ); return div; }, getMultiObjectDragGUI: function( draggables ) { var el = this.htmlElement; var names = ""; for ( var i = 0 ; i < draggables.length ; i++ ) { names += draggables[i].name; if ( i != (draggables.length - 1) ) names += ",<br/>"; } var div = document.createElement("div"); div.className = 'customDraggable'; div.style.width = (this.htmlElement.offsetWidth - 10) + "px"; new Insertion.Top( div, names ); return div; }, getDroppedGUI: function() { var el = this.htmlElement; var div = document.createElement("div"); var names = this.name.split(","); if ( CustomDraggable.revereNamesOnDrop ){ new Insertion.Top( div, "<span class='nameSpan'>[" + names[1].substring(1) + " " + names[0]+ "]</span>" ); } else { //new Insertion.Top( div, "<span class='nameSpan'>[" + this.name + "]</span>" ); // by hsr 2006-2-27 //new Insertion.Top( div, "<span class='nameSpan' style='border:1px solid #ffffee;display:block' onClick='selectit2(this);' onDblClick='closeMe(this,\""+ el.id +"\")'>[" + this.name + "]</span>" ); new Insertion.Top( div, "<span class='nameSpan' style='border:1px solid #ffffee;display:block' onClick='selectit2(this);' onDblClick='closeMe(this,\""+ el.id +"\")'>[" + this.name + "]</span>" ); } return div; }, toString: function() { return this.name; }} );
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -