<%smilies%> canAttach = <%if can_attach%>true<%else%>false<%endif%>; advancedEditor.prototype.canAttach = function () { return canAttach; } advancedEditor.prototype.addTag = function (smilie) { var smilies = { <%~loop smilies_loop%> '<%escape_js tag%>' : '<%escape_js url%>'<%unless last%>,<%endunless%> <%~endloop%> }; var selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow); var img = this.objects.editableFrameDoc.createElement('img'); img.src = smilies[smilie]; selection.replaceSelection(img); } advancedEditor.prototype.insertQuote = function () { var selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow); var sel = selection.getSelectionHTML(); var node = this.objects.editableFrameDoc.createElement('div'); node.innerHTML = '[quote]' + (sel ? sel : '') + '[/quote]'; selection.replaceSelection(node); } advancedEditor.prototype.insertReply = function () { var selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow); var sel = selection.getSelectionHTML(); var node = this.objects.editableFrameDoc.createElement('div'); node.innerHTML = '[reply]' + (sel ? sel : '') + '[/reply]'; selection.replaceSelection(node); } advancedEditor.prototype.insertCode = function () { var selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow); var sel = selection.getSelectionHTML(); var node = this.objects.editableFrameDoc.createElement('div'); node.innerHTML = '[code]' + (sel ? sel : '') + '[/code]'; selection.replaceSelection(node); } function getInlineAttachments () { return inlineAttachments; } function updateInline (filename, type, id, add) { for (var i = 0; i < inlineAttachments.length; i++) { if (inlineAttachments[i][0] == filename && inlineAttachments[i][1] == type && inlineAttachments[i][2] == id) { if (!add) inlineAttachments.splice(i--, 1); return; } } if (add) inlineAttachments.push([filename, type, id]); } function refreshAttachmentList() { /* Mozilla gives XMLHttpRequest errors if the XMLHttpRequest object is * created in a parent window function called from a child window; this * (instant) setTimeout works around the problem. */ setTimeout(_refreshAttachmentList, 0); } function _refreshAttachmentList() { var url = '<%cgi_root_url%>/<%config.gforum_cgi%>?do=<%if this_do starts "post_"%>post<%else%>message<%endif%>_attachment_list;to_redo=<%this_do%>;temp_id=<%temp_id%>'; <%~if this_do starts 'post_'%> url = url + ';forum=<%forum_id%>'; <%~if this_do eq 'post_reply_write'%> url = url + ';parent_post_id=<%parent_post_id%>'; <%~elsif this_do eq 'post_edit'%> url = url + ';post=<%post_id%>'; <%~endif%> <%~endif%> var inputs = document.getElementsByTagName('input'); for (var i = 0; i < inputs.length; i++) { var input = inputs[i]; if (!(input.type == 'checkbox' && input.name.match(/^att_inline-(\d+)-(\w+)$/))) continue; url = url + ';' + RegExp.$2 + '_' + (input.checked ? '' : 'de') + 'inline=' + RegExp.$1; } url = url + '<%hidden_url%>'; xmlReqSend(url, 'GET', '', _updateAttachList); } function _updateAttachList(req) { document.getElementById('attachment_list').innerHTML = req.responseText; }