📄 move.js
字号:
ctx.moveTo(x1, y1); ctx.lineTo(x2, y2); ctx.stroke();}/** * draws a relation/constraint line, whether angular or not */function Line0(x1, y1, x2, y2, color_line){ Circle(x1, y1, 3, 3, "rgba(0,0,255,1)"); Rect(x2 - 1, y2 - 2, 4, 4, "rgba(0,0,255,1)"); if (ON_angular_direct) { Line2(x1, y1, x2, y2, color_line); } else { Line3(x1, y1, x2, y2, color_line); }}/** * draws a angualr relation/constraint line */function Line2(x1, y1, x2, y2, color_line){ var x1_ = x1; var x2_ = x2; if (s_right) { x1_ += sm_add; x2_ += sm_add; } else if (s_left) { x1_ -= sm_add; x2_ -= sm_add; } else if (x1 < x2) { x1_ += sm_add; x2_ -= sm_add; } else { x1_ -= sm_add; x2_ += sm_add; } Line(x1, y1, x1_, y1, color_line); Line(x2, y2, x2_, y2, color_line); Line(x1_, y1, x2_, y2, color_line);}/** * draws a relation/constraint line */function Line3(x1, y1, x2, y2, color_line){ var x1_ = x1; var x2_ = x2; if (s_right) { if (x1 < x2) { x1_ += x2 - x1 + sm_add; x2_ += sm_add; } else { x2_ += x1 - x2 + sm_add; x1_ += sm_add; } Line(x1, y1, x1_, y1, color_line); Line(x2, y2, x2_, y2, color_line); Line(x1_, y1, x2_, y2, color_line); return; } if (s_left) { if (x1 < x2) { x2_ -= x2 - x1 + sm_add; x1_ -= sm_add; } else { x1_ -= x1 - x2 + sm_add; x2_ -= sm_add; } Line(x1, y1, x1_, y1, color_line); Line(x2, y2, x2_, y2, color_line); Line(x1_, y1, x2_, y2, color_line); return; } var x_s = (x1 + x2) / 2; Line(x1, y1, x_s, y1, color_line); Line(x_s, y2, x2, y2, color_line); Line(x_s, y1, x_s, y2, color_line);}function Circle(x, y, r, w, color){ var ctx = document.getElementById('canvas').getContext('2d'); ctx.beginPath(); ctx.moveTo(x, y); ctx.lineWidth = w; ctx.strokeStyle = color; ctx.arc(x, y, r, 0, 2 * Math.PI, true); ctx.stroke();}function Clear(){ var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d"); ctx.clearRect(0, 0, canvas_width, canvas_height);}function Rect(x1, y1, w, h, color){ var ctx = document.getElementById('canvas').getContext('2d'); ctx.fillStyle = color; ctx.fillRect(x1, y1, w, h);}//------------------------------ SAVE ------------------------------------------function Save(url) // (del?) no for pdf{ for (key in j_tabs) { document.getElementById('t_x_' + key + '_').value = parseInt(document.getElementById(key).style.left); document.getElementById('t_y_' + key + '_').value = parseInt(document.getElementById(key).style.top); document.getElementById('t_v_' + key + '_').value = document.getElementById('id_tbody_' + key).style.display == 'none' ? 0 : 1; document.getElementById('t_h_' + key + '_').value = document.getElementById('check_vis_' + key).checked ? 1 : 0; } document.form1.action = url; document.form1.submit();}function Get_url_pos(){ var poststr = ''; for (key in j_tabs) { poststr += '&t_x[' + key + ']=' + parseInt(document.getElementById(key).style.left); poststr += '&t_y[' + key + ']=' + parseInt(document.getElementById(key).style.top); poststr += '&t_v[' + key + ']=' + (document.getElementById('id_tbody_' + key).style.display == 'none' ? 0 : 1); poststr += '&t_h[' + key + ']=' + (document.getElementById('check_vis_' + key).checked ? 1 : 0); } return poststr;}function Save2(){ var poststr = 'IS_AJAX=1&server='+server+'&db=' + db + '&token=' + token + '&die_save_pos=1'; poststr += Get_url_pos(); makeRequest('pmd_save_pos.php', poststr);}function Grid(){ if (!ON_grid) { ON_grid = 1; document.getElementById('grid_button').className = 'M_butt_Selected_down'; } else { document.getElementById('grid_button').className = 'M_butt'; ON_grid = 0; }}function Angular_direct(){ if (ON_angular_direct) { ON_angular_direct = 0; document.getElementById('angular_direct_button').className = 'M_butt_Selected_down'; } else { ON_angular_direct = 1; document.getElementById('angular_direct_button').className = 'M_butt'; } Re_load();}//++++++++++++++++++++++++++++++ RELATION ++++++++++++++++++++++++++++++++++++++function Start_relation(){ if (ON_display_field) { return; } if (!ON_relation) { document.getElementById('foreign_relation').style.display = ''; ON_relation = 1; document.getElementById('hint').innerHTML = LangSelectReferencedKey; document.getElementById('hint').style.visibility = "visible"; document.getElementById('rel_button').className = 'M_butt_Selected_down'; } else { document.getElementById('hint').innerHTML = ""; document.getElementById('hint').style.visibility = "hidden"; document.getElementById('rel_button').className = 'M_butt'; click_field = 0; ON_relation = 0; }}function Click_field(T, f, PK) // table field{ if (ON_relation) { if (!click_field) { //.style.display=='none' .style.visibility = "hidden" if (!PK) { alert(LangPleaseSelectPrimaryOrUniqueKey); return;// 0; }//PK if (j_tabs[db + '.' + T] != '1') { document.getElementById('foreign_relation').style.display = 'none'; } click_field = 1; link_relation = "T1=" + T + "&F1=" + f; document.getElementById('hint').innerHTML = LangSelectForeignKey; } else { Start_relation(); // hidden hint... if (j_tabs[db + '.' + T] != '1' || !PK) { document.getElementById('foreign_relation').style.display = 'none'; } var left = Glob_X - (document.getElementById('layer_new_relation').offsetWidth>>1); document.getElementById('layer_new_relation').style.left = left + 'px'; var top = Glob_Y - document.getElementById('layer_new_relation').offsetHeight - 10; document.getElementById('layer_new_relation').style.top = top + 'px'; document.getElementById('layer_new_relation').style.visibility = "visible"; link_relation += '&T2=' + T + '&F2=' + f; } } if (ON_display_field) { // if is display field if (display_field[T] == f) { //alert(T); //s = '';for(k in display_field)s += k + ' = ' + display_field[k] + ',';alert(s); old_class = 'tab_field'; //display_field.splice(T, 1); delete display_field[T]; //s = '';for(k in display_field)s += k + ' = ' + display_field[k] + ', ';alert(s); //n = 0;for(k in display_field)n++;alert(n); } else { old_class = 'tab_field_3'; if (display_field[T]) { document.getElementById('id_tr_' + T + '.' + display_field[T]).className = 'tab_field'; //display_field.splice(T, 1); delete display_field[T]; } display_field[T] = f; } ON_display_field = 0; document.getElementById('hint').innerHTML = ""; document.getElementById('hint').style.visibility = "hidden"; document.getElementById('display_field_button').className = 'M_butt'; makeRequest('pmd_display_field.php', 'T=' + T + '&F=' + f + '&server=' + server + '&db=' + db + '&token=' + token); }}function New_relation(){ document.getElementById('layer_new_relation').style.visibility = 'hidden'; link_relation += '&server=' + server + '&db=' + db + '&token=' + token + '&die_save_pos=0'; link_relation += '&on_delete=' + document.getElementById('on_delete').value + '&on_update=' + document.getElementById('on_update').value; link_relation += Get_url_pos(); //alert(link_relation); makeRequest('pmd_relation_new.php', link_relation);}//-------------------------- create tables -------------------------------------function Start_table_new(){ window.location.href = 'db_operations.php?server=' + server + '&db=' + db + '&token=' + token;}function Start_tab_upd(table){ window.location.href = 'tbl_structure.php?server=' + server + '&db=' + db + '&token=' + token + '&table=' + table;}//--------------------------- hide tables --------------------------------------function Small_tab_all(id_this) // max/min all tables{ if (id_this.alt == "v") { for (key in j_tabs) { if (document.getElementById('id_hide_tbody_'+key).innerHTML == "v") { Small_tab(key, 0); } } id_this.alt = ">"; id_this.src = "pmd/images/rightarrow1.png"; } else { for (key in j_tabs) { if (document.getElementById('id_hide_tbody_'+key).innerHTML != "v") { Small_tab(key, 0); } } id_this.alt = "v"; id_this.src = "pmd/images/downarrow1.png"; } Re_load();}function Small_tab_invert() // invert max/min all tables{ for (key in j_tabs) { Small_tab(key, 0); } Re_load();}function Small_tab_refresh(){ for (key in j_tabs) { if(document.getElementById('id_hide_tbody_'+key).innerHTML != "v") { Small_tab(key, 0); Small_tab(key, 0); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -