summaryrefslogtreecommitdiffstats
path: root/wp-admin/js
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-12 16:21:15 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-12 16:21:15 +0000
commit3a4570b0fc8b3d6339bef71d17d7701554e0bbf7 (patch)
tree2a06e5261263c68d8afd95a6328879dc289cb909 /wp-admin/js
parentb83c34a7010faee0223f6037025c350da12e05e6 (diff)
downloadwordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.tar.gz
wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.tar.xz
wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.zip
Merge with WP 2.3 - testing use only!
Move pluggable functions out of wpmu-functions and into pluggable.php, fixes #439 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1069 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/js')
-rw-r--r--wp-admin/js/cat.js11
-rw-r--r--wp-admin/js/categories.js16
-rw-r--r--wp-admin/js/custom-fields.js26
-rw-r--r--wp-admin/js/dbx-admin-key.js47
-rw-r--r--wp-admin/js/edit-comments.js59
-rw-r--r--wp-admin/js/link-cat.js10
-rw-r--r--wp-admin/js/upload.js295
-rw-r--r--wp-admin/js/users.js21
-rw-r--r--wp-admin/js/xfn.js46
9 files changed, 531 insertions, 0 deletions
diff --git a/wp-admin/js/cat.js b/wp-admin/js/cat.js
new file mode 100644
index 0000000..e697e9b
--- /dev/null
+++ b/wp-admin/js/cat.js
@@ -0,0 +1,11 @@
+addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;});
+addLoadEvent(newCatAddIn);
+function newCatAddIn() {
+ var jaxcat = $('jaxcat');
+ if ( !jaxcat )
+ return false;
+ // These multiple blank hidden inputs are needed: https://bugzilla.mozilla.org/show_bug.cgi?id=377815 , #3895 , #4664
+ Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span>');
+ $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); };
+ $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); };
+}
diff --git a/wp-admin/js/categories.js b/wp-admin/js/categories.js
new file mode 100644
index 0000000..3cee6c6
--- /dev/null
+++ b/wp-admin/js/categories.js
@@ -0,0 +1,16 @@
+addLoadEvent(function() {
+ if (!theList.theList) return false;
+ document.forms.addcat.submit.onclick = function(e) {return killSubmit('theList.ajaxAdder("cat", "addcat");', e); };
+ theList.addComplete = function(what, where, update, transport) {
+ var name = getNodeValue(transport.responseXML, 'name').unescapeHTML();
+ var id = transport.responseXML.getElementsByTagName(what)[0].getAttribute('id');
+ var options = document.forms['addcat'].category_parent.options;
+ options[options.length] = new Option(name, id);
+ };
+ theList.delComplete = function(what, id) {
+ var options = document.forms['addcat'].category_parent.options;
+ for ( var o = 0; o < options.length; o++ )
+ if ( id == options[o].value )
+ options[o] = null;
+ };
+});
diff --git a/wp-admin/js/custom-fields.js b/wp-admin/js/custom-fields.js
new file mode 100644
index 0000000..ad7a2db
--- /dev/null
+++ b/wp-admin/js/custom-fields.js
@@ -0,0 +1,26 @@
+function customFieldsOnComplete( what, where, update, transport ) {
+ var pidEl = $('post_ID');
+ pidEl.name = 'post_ID';
+ pidEl.value = getNodeValue(transport.responseXML, 'postid');
+ var aEl = $('hiddenaction')
+ if ( aEl.value == 'post' ) aEl.value = 'postajaxpost';
+}
+addLoadEvent(customFieldsAddIn);
+function customFieldsAddIn() {
+ theList.showLink=0;
+ theList.addComplete = customFieldsOnComplete;
+ if (!theList.theList) return false;
+ inputs = theList.theList.getElementsByTagName('input');
+ for ( var i=0; i < inputs.length; i++ ) {
+ if ('text' == inputs[i].type) {
+ inputs[i].setAttribute('autocomplete', 'off');
+ inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); };
+ }
+ if ('updatemeta' == inputs[i].className) {
+ inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); };
+ }
+ }
+
+ $('metakeyinput').onkeypress = function(e) {return killSubmit('theList.inputData+="&id="+$("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); };
+ $('updatemetasub').onclick = function(e) {return killSubmit('theList.inputData+="&id="+$("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); };
+}
diff --git a/wp-admin/js/dbx-admin-key.js b/wp-admin/js/dbx-admin-key.js
new file mode 100644
index 0000000..3b3f7af
--- /dev/null
+++ b/wp-admin/js/dbx-admin-key.js
@@ -0,0 +1,47 @@
+addLoadEvent( function() {var manager = new dbxManager( dbxL10n.manager );} );
+
+addLoadEvent( function()
+{
+ //create new docking boxes group
+ var meta = new dbxGroup(
+ 'grabit', // container ID [/-_a-zA-Z0-9/]
+ 'vertical', // orientation ['vertical'|'horizontal']
+ '10', // drag threshold ['n' pixels]
+ 'no', // restrict drag movement to container axis ['yes'|'no']
+ '10', // animate re-ordering [frames per transition, or '0' for no effect]
+ 'yes', // include open/close toggle buttons ['yes'|'no']
+ 'closed', // default state ['open'|'closed']
+ dbxL10n.open, // word for "open", as in "open this box"
+ dbxL10n.close, // word for "close", as in "close this box"
+ dbxL10n.moveMouse, // sentence for "move this box" by mouse
+ dbxL10n.toggleMouse, // pattern-match sentence for "(open|close) this box" by mouse
+ dbxL10n.moveKey, // sentence for "move this box" by keyboard
+ dbxL10n.toggleKey, // pattern-match sentence-fragment for "(open|close) this box" by keyboard
+ '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
+ );
+
+ // Boxes are closed by default. Open the Category box if the cookie isn't already set.
+ var catdiv = document.getElementById('categorydiv');
+ if ( catdiv ) {
+ var button = catdiv.getElementsByTagName('A')[0];
+ if ( dbx.cookiestate == null && /dbx\-toggle\-closed/.test(button.className) )
+ meta.toggleBoxState(button, true);
+ }
+
+ var advanced = new dbxGroup(
+ 'advancedstuff',
+ 'vertical',
+ '10',
+ 'yes', // restrict drag movement to container axis ['yes'|'no']
+ '10',
+ 'yes',
+ 'closed',
+ dbxL10n.open,
+ dbxL10n.close,
+ dbxL10n.moveMouse,
+ dbxL10n.toggleMouse,
+ dbxL10n.moveKey,
+ dbxL10n.toggleKey,
+ '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
+ );
+});
diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js
new file mode 100644
index 0000000..e1fc68f
--- /dev/null
+++ b/wp-admin/js/edit-comments.js
@@ -0,0 +1,59 @@
+addLoadEvent(function() {
+ theCommentList = new listMan('the-comment-list');
+ if ( !theCommentList )
+ return false;
+
+ theExtraCommentList = new listMan('the-extra-comment-list');
+ if ( theExtraCommentList ) {
+ theExtraCommentList.showLink = 0;
+ theExtraCommentList.altOffset = 1;
+ if ( theExtraCommentList.theList && theExtraCommentList.theList.childNodes )
+ var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length;
+ else
+ var commentNum = 0;
+ var urlQ = document.location.href.split('?');
+ var params = urlQ[1] ? urlQ[1].toQueryParams() : [];
+ var search = params['s'] ? params['s'] : '';
+ var page = params['apage'] ? params['apage'] : 1;
+ }
+
+ theCommentList.dimComplete = function(what,id,dimClass) {
+ var m = document.getElementById('awaitmod');
+ if ( document.getElementById(what + '-' + id).className.match(dimClass) )
+ m.innerHTML = parseInt(m.innerHTML,10) + 1;
+ else
+ m.innerHTML = parseInt(m.innerHTML,10) - 1;
+ }
+
+ theCommentList.delComplete = function(what,id) {
+ var m = document.getElementById('awaitmod');
+ what = what.split('-')[0];
+ if ( document.getElementById(what + '-' + id).className.match('unapproved') )
+ m.innerHTML = parseInt(m.innerHTML,10) - 1;
+ if ( theExtraCommentList && commentNum ) {
+ var theMover = theExtraCommentList.theList.childNodes[0];
+ Element.removeClassName(theMover,'alternate');
+ theCommentList.theList.appendChild(theMover);
+ theExtraCommentList.inputData += '&page=' + page;
+ if ( search )
+ theExtraCommentList.inputData += '&s=' + search; // trust the URL not the search box
+ theExtraCommentList.addComplete = function() {
+ if ( theExtraCommentList.theList.childNodes )
+ var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length;
+ else
+ var commentNum = 0;
+ }
+ theExtraCommentList.ajaxAdder( 'comment', 'ajax-response' ); // Dummy Request
+ }
+ }
+
+ if ( theList ) // the post list: edit.php
+ theList.delComplete = function() {
+ var comments = document.getElementById('comments');
+ var commdel = encloseFunc(function(a){a.parentNode.removeChild(a);},comments);
+ var listdel = encloseFunc(function(a){a.parentNode.removeChild(a);},theCommentList.theList);
+ setTimeout(commdel,705);
+ setTimeout(listdel,705);
+ }
+});
+
diff --git a/wp-admin/js/link-cat.js b/wp-admin/js/link-cat.js
new file mode 100644
index 0000000..a0775ce
--- /dev/null
+++ b/wp-admin/js/link-cat.js
@@ -0,0 +1,10 @@
+addLoadEvent(function(){linkcatList=new listMan('linkcategorychecklist');linkcatList.ajaxRespEl='jaxcat';linkcatList.topAdder=1;linkcatList.alt=0;linkcatList.showLink=0;});
+addLoadEvent(newLinkCatAddIn);
+function newLinkCatAddIn() {
+ var jaxcat = $('jaxcat');
+ if ( !jaxcat )
+ return false;
+ Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + linkcatL10n.add + '"/><input type="hidden"/><span id="howto">' + linkcatL10n.how + '</span></span>');
+ $('newcat').onkeypress = function(e) { return killSubmit("linkcatList.ajaxAdder('link-category','jaxcat');", e); };
+ $('catadd').onclick = function() { linkcatList.ajaxAdder('link-category', 'jaxcat'); };
+}
diff --git a/wp-admin/js/upload.js b/wp-admin/js/upload.js
new file mode 100644
index 0000000..d38cdcb
--- /dev/null
+++ b/wp-admin/js/upload.js
@@ -0,0 +1,295 @@
+addLoadEvent( function() {
+ theFileList = {
+ currentImage: {ID: 0},
+ nonce: '',
+ tab: '',
+ postID: 0,
+
+ toQueryParams: function(qryStrOrig) {
+ var params = new Object();
+ var qryStr = qryStrOrig;
+ var i = 0;
+ do {
+ params[qryStr.split("=")[0].replace(/&/, "")] = ( qryStr.split("=")[1] ) ? qryStr.split("=")[1].split(/&|$/)[0] : '';
+ qryStr = ( qryStr.split("=")[1] ) ? qryStr.split(qryStr.split("=")[1].split(/&|$/)[0])[1] : '';
+ i++;
+ }
+ while(i < (qryStrOrig.split("=").length - 1));
+ return params;
+ },
+
+ toQueryString: function(params) {
+ var qryStr = '';
+ for ( var key in params )
+ qryStr += key + '=' + params[key] + '&';
+ return qryStr;
+ },
+
+ initializeVars: function() {
+ this.urlData = document.location.href.split('?');
+ this.params = this.toQueryParams(this.urlData[1]);
+ this.postID = this.params['post_id'];
+ this.tab = this.params['tab'];
+ this.style = this.params['style'];
+ this.ID = this.params['ID'];
+ if ( !this.style )
+ this.style = 'default';
+ var nonceEl = jQuery('#nonce-value');
+ if ( nonceEl )
+ this.nonce = jQuery(nonceEl).val();
+ if ( this.ID ) {
+ this.grabImageData( this.ID );
+ this.imageView( this.ID );
+ }
+ },
+
+ initializeLinks: function() {
+ if ( this.ID )
+ return;
+ jQuery('a.file-link').each(function() {
+ var id = jQuery(this).attr('id').split('-').pop();
+ jQuery(this).attr('href','javascript:void(0)').click(function(e) {
+ theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e);
+ });
+ });
+ },
+
+ grabImageData: function(id) {
+ if ( id == this.currentImage.ID )
+ return;
+ var thumbEl = jQuery('#attachment-thumb-url-' + id);
+ if ( thumbEl ) {
+ this.currentImage.thumb = ( 0 == id ? '' : jQuery(thumbEl).val() );
+ this.currentImage.thumbBase = ( 0 == id ? '' : jQuery('#attachment-thumb-url-base-' + id).val() );
+ } else {
+ this.currentImage.thumb = false;
+ }
+ this.currentImage.src = ( 0 == id ? '' : jQuery('#attachment-url-' + id).val() );
+ this.currentImage.srcBase = ( 0 == id ? '' : jQuery('#attachment-url-base-' + id).val() );
+ this.currentImage.page = ( 0 == id ? '' : jQuery('#attachment-page-url-' + id).val() );
+ this.currentImage.title = ( 0 == id ? '' : jQuery('#attachment-title-' + id).val() );
+ this.currentImage.description = ( 0 == id ? '' : jQuery('#attachment-description-' + id).val() );
+ var widthEl = jQuery('#attachment-width-' + id);
+ if ( widthEl ) {
+ this.currentImage.width = ( 0 == id ? '' : jQuery(widthEl).val() );
+ this.currentImage.height = ( 0 == id ? '' : jQuery('#attachment-height-' + id).val() );
+ } else {
+ this.currentImage.width = false;
+ this.currentImage.height = false;
+ }
+ this.currentImage.isImage = ( 0 == id ? 0 : jQuery('#attachment-is-image-' + id).val() );
+ this.currentImage.ID = id;
+ },
+
+ imageView: function(id, e) {
+ this.prepView(id);
+ var h = '';
+
+ h += "<div id='upload-file'>"
+ if ( this.ID ) {
+ var params = this.params;
+ params.ID = '';
+ params.action = '';
+ h += "<a href='" + this.urlData[0] + '?' + this.toQueryString(params) + "'";
+ } else {
+ h += "<a href='#' onclick='return theFileList.cancelView();'";
+ }
+ h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>";
+ h += "<div id='file-title'>"
+ if ( 0 == this.currentImage.isImage )
+ h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>";
+ else
+ h += "<h2>" + this.currentImage.title + "</h2>";
+ h += " &#8212; <span>";
+ h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>" + this.edit + "</a>"
+ h += "</span>";
+ h += '</div>'
+ h += "<div id='upload-file-view' class='alignleft'>";
+ if ( 1 == this.currentImage.isImage ) {
+ h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>";
+ h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
+ h += "</a>";
+ } else
+ h += '&nbsp;';
+ h += "</div>";
+
+ h += "<form name='uploadoptions' id='uploadoptions' class='alignleft'>";
+ h += "<table>";
+ var display = [];
+ var checked = 'display-title';
+ if ( 1 == this.currentImage.isImage ) {
+ checked = 'display-full';
+ if ( this.currentImage.thumb ) {
+ display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.thumb + "</label><br />");
+ checked = 'display-thumb';
+ }
+ display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> " + this.full + "</label>");
+ } else if ( this.currentImage.thumb ) {
+ display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.icon + "</label>");
+ }
+ if ( display.length ) {
+ display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + this.title + "</label>");
+ h += "<tr><th style='padding-bottom:.5em'>" + this.show + "</th><td style='padding-bottom:.5em'>";
+ jQuery(display).each( function() { h += this; } );
+ h += "</td></tr>";
+ }
+
+ h += "<tr><th>" + this.link + "</th><td>";
+ h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> " + this.file + "</label><br />";
+ h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> " + this.page + "</label><br />";
+ h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> " + this.none + "</label>";
+ h += "</td></tr>";
+
+ h += "<tr><td colspan='2'><p class='submit'>";
+ h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='" + this.editorText + "' />";
+ h += "</p></td></tr></table>";
+ h += "</form>";
+
+ h += "</div>";
+
+ jQuery(h).prependTo('#upload-content');
+ jQuery('#' + checked).attr('checked','checked');
+ if (e) return e.stopPropagation();
+ return false;
+ },
+
+ editView: function(id, e) {
+ this.prepView(id);
+ var h = '';
+
+ var action = 'upload.php?style=' + this.style + '&amp;tab=upload';
+ if ( this.postID )
+ action += '&amp;post_id=' + this.postID;
+
+ h += "<form id='upload-file' method='post' action='" + action + "'>";
+ if ( this.ID ) {
+ var params = this.params;
+ params.ID = '';
+ params.action = '';
+ h += "<a href='" + this.urlData[0] + '?' + this.toQueryString(params) + "'";
+ } else {
+ h += "<a href='#' onclick='return theFileList.cancelView();'";
+ }
+ h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>";
+ h += "<div id='file-title'>"
+ if ( 0 == this.currentImage.isImage )
+ h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>";
+ else
+ h += "<h2>" + this.currentImage.title + "</h2>";
+ h += " &#8212; <span>";
+ h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>" + this.insert + "</a>";
+ h += "</span>";
+ h += '</div>'
+ h += "<div id='upload-file-view' class='alignleft'>";
+ if ( 1 == this.currentImage.isImage ) {
+ h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>";
+ h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
+ h += "</a>";
+ } else
+ h += '&nbsp;';
+ h += "</div>";
+
+
+ h += "<table><col /><col class='widefat' /><tr>";
+ h += "<th scope='row'><label for='url'>" + this.urlText + "</label></th>";
+ h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>";
+ h += "</tr><tr>";
+ h += "<th scope='row'><label for='post_title'>" + this.title + "</label></th>";
+ h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>";
+ h += "</tr><tr>";
+ h += "<th scope='row'><label for='post_content'>" + this.desc + "</label></th>";
+ h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>";
+ h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='" + this.deleteText + "' onclick='theFileList.deleteFile(" + id + ");' />";
+ h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />";
+ h += "<input type='hidden' name='post_parent' value='" + parseInt(this.postID,10) + "' />";
+ h += "<input type='hidden' name='action' id='action-value' value='save' />";
+ h += "<input type='hidden' name='ID' value='" + id + "' />";
+ h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";
+ h += "<div class='submit'><input type='submit' value='" + this.saveText + "' /></div>";
+ h += "</td></tr></table></form>";
+
+ jQuery(h).prependTo('#upload-content');
+ if (e) e.stopPropagation();
+ return false;
+ },
+
+ prepView: function(id) {
+ this.cancelView( true );
+ var filesEl = jQuery('#upload-files');
+ if ( filesEl )
+ filesEl.hide();
+ var navEl = jQuery('#current-tab-nav');
+ if ( navEl )
+ navEl.hide();
+ this.grabImageData(id);
+ },
+
+ cancelView: function( prep ) {
+ if ( !prep ) {
+ var filesEl = jQuery('#upload-files');
+ if ( filesEl )
+ jQuery(filesEl).show();
+ var navEl = jQuery('#current-tab-nav');
+ if ( navEl )
+ jQuery(navEl).show();
+ }
+ if ( !this.ID )
+ this.grabImageData(0);
+ var div = jQuery('#upload-file');
+ if ( div )
+ jQuery(div).remove();
+ return false;
+ },
+
+ sendToEditor: function(id) {
+ this.grabImageData(id);
+ var link = '';
+ var display = '';
+ var h = '';
+
+ link = jQuery('input[@type=radio][@name="link"][@checked]','#uploadoptions').val();
+ displayEl = jQuery('input[@type=radio][@name="display"][@checked]','#uploadoptions');
+ if ( displayEl )
+ display = jQuery(displayEl).val();
+ else if ( 1 == this.currentImage.isImage )
+ display = 'full';
+
+ if ( 'none' != link )
+ h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment wp-att-" + this.currentImage.ID ) ) + "' title='" + this.currentImage.title + "'>";
+ if ( display && 'title' != display )
+ h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />";
+ else
+ h += this.currentImage.title;
+ if ( 'none' != link )
+ h += "</a>";
+
+ var win = window.opener ? window.opener : window.dialogArguments;
+ if ( !win )
+ win = top;
+ tinyMCE = win.tinyMCE;
+ if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') ) {
+ tinyMCE.selectedInstance.getWin().focus();
+ tinyMCE.execCommand('mceInsertContent', false, h);
+ } else
+ win.edInsertContent(win.edCanvas, h);
+ if ( !this.ID )
+ this.cancelView();
+ return false;
+ },
+
+ deleteFile: function(id) {
+ if ( confirm( this.confirmText.replace(/%title%/g, this.currentImage.title) ) ) {
+ jQuery('#action-value').attr('value','delete');
+ jQuery('#upload-file').submit();
+ return true;
+ }
+ return false;
+ }
+
+ };
+
+ for ( var property in uploadL10n )
+ theFileList[property] = uploadL10n[property];
+ theFileList.initializeVars();
+ theFileList.initializeLinks();
+} );
diff --git a/wp-admin/js/users.js b/wp-admin/js/users.js
new file mode 100644
index 0000000..f249f65
--- /dev/null
+++ b/wp-admin/js/users.js
@@ -0,0 +1,21 @@
+addLoadEvent(function() {
+ theListEls = document.getElementsByTagName('tbody');
+ theUserLists = new Array();
+ for ( var l = 0; l < theListEls.length; l++ ) {
+ if ( theListEls[l].id )
+ theUserLists[theListEls[l].id] = new listMan(theListEls[l].id);
+ }
+ addUserInputs = document.getElementById('adduser').getElementsByTagName('input');
+ for ( var i = 0; i < addUserInputs.length; i++ ) {
+ addUserInputs[i].onkeypress = function(e) { return killSubmit('addUserSubmit();', e); }
+ }
+ document.getElementById('addusersub').onclick = function(e) { return killSubmit('addUserSubmit();', e); }
+}
+);
+
+function addUserSubmit() {
+ var roleEl = document.getElementById('role');
+ var role = roleEl.options[roleEl.selectedIndex].value;
+ if ( !theUserLists['role-' + role] ) return true;
+ return theUserLists['role-' + role].ajaxAdder('user', 'adduser');
+}
diff --git a/wp-admin/js/xfn.js b/wp-admin/js/xfn.js
new file mode 100644
index 0000000..2fe41eb
--- /dev/null
+++ b/wp-admin/js/xfn.js
@@ -0,0 +1,46 @@
+function GetElementsWithClassName(elementName, className) {
+ var allElements = document.getElementsByTagName(elementName);
+ var elemColl = new Array();
+ for (i = 0; i < allElements.length; i++) {
+ if (allElements[i].className == className) {
+ elemColl[elemColl.length] = allElements[i];
+ }
+ }
+ return elemColl;
+}
+
+function meChecked() {
+ var undefined;
+ var eMe = document.getElementById('me');
+ if (eMe == undefined) return false;
+ else return eMe.checked;
+}
+
+function upit() {
+ var isMe = meChecked(); //document.getElementById('me').checked;
+ var inputColl = GetElementsWithClassName('input', 'valinp');
+ var results = document.getElementById('link_rel');
+ var linkText, linkUrl, inputs = '';
+ for (i = 0; i < inputColl.length; i++) {
+ inputColl[i].disabled = isMe;
+ inputColl[i].parentNode.className = isMe ? 'disabled' : '';
+ if (!isMe && inputColl[i].checked && inputColl[i].value != '') {
+ inputs += inputColl[i].value + ' ';
+ }
+ }
+ inputs = inputs.substr(0,inputs.length - 1);
+ if (isMe) inputs='me';
+ results.value = inputs;
+ }
+
+function blurry() {
+ if (!document.getElementById) return;
+
+ var aInputs = document.getElementsByTagName('input');
+
+ for (var i = 0; i < aInputs.length; i++) {
+ aInputs[i].onclick = aInputs[i].onkeyup = upit;
+ }
+}
+
+addLoadEvent(blurry); \ No newline at end of file