1var currentMode; 2 3function onChangeBrowseBy() { 4 var formObj = frames['img_assist_header'].document.forms[0]; 5 browse = formObj['edit[browse]'].value; 6 frames['img_assist_main'].window.location.href = BASE_URL + 'index.php?q=img_assist/thumbs/' + browse; 7} 8 9function onClickUpload() { 10 frames['img_assist_main'].window.location.href = BASE_URL + 'index.php?q=img_assist/upload'; 11} 12 13function onClickStartOver() { 14 frames['img_assist_main'].window.location.href = BASE_URL + 'index.php?q=img_assist/thumbs/myimages'; 15} 16 17function updateCaption() { 18 var caption = frames['img_assist_main'].document.getElementById("caption"); 19 var title = frames['img_assist_main'].document.img_assist['edit[title]'].value; 20 var desc = frames['img_assist_main'].document.img_assist['edit[desc]'].value; 21 if (desc != '') { 22 title = title + ': '; 23 } 24 caption.innerHTML = '<strong>' + title + '</strong>' + desc; 25} 26 27function onChangeHeight() { 28 var formObj = frames['img_assist_main'].document.forms[0]; 29 var aspect = formObj['edit[aspect]'].value; 30 var height = formObj['edit[height]'].value; 31 formObj['edit[width]'].value = Math.round(height * aspect); 32} 33 34function onChangeWidth() { 35 var formObj = frames['img_assist_main'].document.forms[0]; 36 var aspect = formObj['edit[aspect]'].value; 37 var width = formObj['edit[width]'].value; 38 formObj['edit[height]'].value = Math.round(width / aspect); 39} 40 41function onChangeLink() { 42 var formObj = frames['img_assist_main'].document.forms[0]; 43 if (formObj['edit[link_options_visible]'].value == 1) { 44 if (formObj['edit[link]'].value == 'url') { 45 showElement('edit-url', 'inline'); 46 } else { 47 hideElement('edit-url'); 48 } 49 } 50} 51 52function onChangeSizeLabel() { 53 var formObj = frames['img_assist_main'].document.forms[0]; 54 if (formObj['edit[size_label]'].value == 'other') { 55 showElement('size-other', 'inline'); 56 } else { 57 hideElement('size-other'); 58 //showElement('size-other', 'inline'); // uncomment for testing 59 // get the new width and height 60 var size = formObj['edit[size_label]'].value.split('x'); 61 // this array is probably a bounding box size, not an actual image 62 // size, so now we use the known aspect ratio to find the actual size 63 var aspect = formObj['edit[aspect]'].value; 64 var width = size[0]; 65 var height = size[1]; 66 if (Math.round(width / aspect) <= height) { // width is controlling factor 67 height = Math.round(width / aspect); 68 } else { // height is controlling factor 69 width = Math.round(height * aspect); 70 } 71 // fill the hidden width and height textboxes with these values 72 formObj['edit[width]'].value = width; 73 formObj['edit[height]'].value = height; 74 } 75} 76 77function setHeader(mode) { 78 if (currentMode != mode) { 79 frames['img_assist_header'].window.location.href = BASE_URL + 'index.php?q=img_assist/header/' + mode; 80 } 81 currentMode = mode; 82} 83 84function showElement(id, format) { 85 var docObj = frames['img_assist_main'].document; 86 format = (format) ? format : 'block'; 87 if (docObj.layers) { 88 docObj.layers[id].display = format; 89 } else if (docObj.all) { 90 docObj.all[id].style.display = format; 91 } else if (docObj.getElementById) { 92 docObj.getElementById(id).style.display = format; 93 } 94} 95 96function hideElement(id) { 97 var docObj = frames['img_assist_main'].document; 98 if (docObj.layers) { 99 docObj.layers[id].display = 'none'; 100 } else if (docObj.all) { 101 docObj.all[id].style.display = 'none'; 102 } else if (docObj.getElementById) { 103 docObj.getElementById(id).style.display = 'none'; 104 } 105} 106 107function launch_popup(nid, mw, mh) { 108 var ox = mw; 109 var oy = mh; 110 if((ox>=screen.width) || (oy>=screen.height)){ 111 var ox = screen.width-150; 112 var oy = screen.height-150; 113 var winx = (screen.width / 2)-(ox / 2); 114 var winy = (screen.height / 2)-(oy / 2); 115 var use_scrollbars = 1; 116 } 117 else{ 118 var winx = (screen.width / 2)-(ox / 2); 119 var winy = (screen.height / 2)-(oy / 2); 120 var use_scrollbars = 0; 121 } 122 var win = window.open(BASE_URL + 'index.php?q=img_assist/popup/' + nid, 'imagev', 'height='+oy+'-10,width='+ox+',top='+winy+',left='+winx+',scrollbars='+use_scrollbars+',resizable'); 123} 124 125function insertImage() { 126 if (window.opener) { 127 // Get variables from the fields on the properties frame 128 var formObj = frames['img_assist_main'].document.forms[0]; 129 // Get mode (see img_assist.module for detailed comments)
130 if (formObj['edit[insertmode]'].value == 'html') { // return so the page can submit normally and generate the HTML code 131 return true; 132 } else if (formObj['edit[insertmode]'].value == 'html2') { // HTML step 2 (processed code, ready to be inserted) 133 var content = getHTML(formObj); 134 } else { 135 var content = getFilterTag(formObj); 136 } 137 insertToEditor(content); 138 return false; 139 140 } else { 141 alert('The image cannot be inserted because the parent window cannot be found.'); 142 return false; 143 } 144} 145 146function getHTML(formObj) { 147 var html = frames['img_assist_main'].document.getElementById("finalhtmlcode").innerHTML; 148 return html; 149}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.