'use strict';function metaEditor(target,meta_field,meta_type,meta_options){this.target=target;this.meta_field=meta_field;this.meta_type=meta_type;meta_options=meta_options||{};this.meta_url=meta_options.meta_url||this.meta_url;this.list_type=meta_options.list_type||this.list_type;this.text_confirm_remove=meta_options.text_confirm_remove||this.text_confirm_remove;this.text_add_meta=meta_options.text_add_meta||this.text_add_meta;this.text_choose=meta_options.text_choose||this.text_choose;this.text_all=meta_options.text_all||this.text_all;this.text_separation=meta_options.text_separation||this.text_separation;}
metaEditor.prototype={meta_url:'',text_confirm_remove:'Are you sure you want to remove this %s?',text_add_meta:'Add a %s to this entry',text_choose:'Choose from list',text_all:'all',text_separation:'Separate each %s by comas',list_type:'more',target:null,meta_type:null,meta_dialog:null,meta_field:null,submit_button:null,post_id:false,service_uri:'services.php',displayMeta:function(type,post_id,input_id='post_meta_input'){this.meta_type=type;this.post_id=post_id;this.target.empty();this.meta_dialog=$('');this.meta_dialog.attr('title',this.text_add_meta.replace(/%s/,this.meta_type));this.meta_dialog.attr('id',input_id);this.meta_dialog.attr('class','post_meta_input');this.meta_dialog.on('keypress',function(evt){if(evt.keyCode==13){This.addMeta(this.value);return false;}
return true;});const This=this;this.submit_button=$('');this.submit_button.on('click',function(){const v=This.meta_dialog.val();This.addMeta(v);return false;});this.addMetaDialog();if(this.post_id==false){this.target.append(this.meta_field);}
this.displayMetaList();},displayMetaList:function(){let li;if(this.meta_list==undefined){this.meta_list=$('