משתמש:Bharel/סקריפטים/78-min.js

מתוך ויקיפדיה, האנציקלופדיה החופשית

הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.

  • פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
  • גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
  • אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
  • אופרה: ללחוץ על Ctrl-F5.
var pagesCare={currentLocation:"מדיה ויקי:סקריפטים/78.js",panel:$("<div>",{id:"pc-panel"}).append($("<div>",{id:"pc-titlebar"}).append($("<span>",{id:"pc-close",class:"ui-icon ui-icon-closethick",title:"סגירה"}),$("<div>",{id:"pc-caption"})),$("<span>",{id:"pc-creator"}),$("<form>",{id:"pc-form",onsubmit:"return false"}).append($("<div>",{class:"pc-dialog"}).text("מה לעשות עם הדף הזה?"),$("<div>",{class:"pc-action"}).append($("<input>",{name:"pc-type",id:"pca-move",class:"pca-opt",type:"radio",value:1}),$("<label>",{for:"pca-move"}).text("להעביר אותו לטיוטה")),$("<dd>",{id:"pc-custom"}).append($("<div>",{class:"pc-dialog"}).text("איזו הודעה יקבל המשתמש?"),$("<div>",{class:"pc-action"}).append($("<input>",{name:"pc-msg",id:"pcm-default",type:"radio",value:1,checked:!0}),$("<label>",{for:"pcm-default"}).text("הודעת ברירת המחדל")),$("<div>",{class:"pc-action"}).append($("<input>",{name:"pc-msg",id:"pcm-custom",type:"radio",value:2}),$("<label>",{for:"pcm-custom"}).text("הודעה מותאמת אישית")),$("<textarea>",{placeholder:"הודעה (ללא חתימה)"}),$("<div>",{class:"pc-dialog"}).text("להעביר גם את דף השיחה?"),$("<div>",{class:"pc-action"}).append($("<input>",{name:"pc-move-talk",id:"pcm-mty",type:"radio",checked:!0}),$("<label>",{for:"pcm-mty"}).text("כן")),$("<div>",{class:"pc-action"}).append($("<input>",{name:"pc-move-talk",id:"pcm-mtn",type:"radio"}),$("<label>",{for:"pcm-mtn"}).text("לא"))),$("<div>",{class:"pc-action"}).append($("<input>",{name:"pc-type",id:"pca-delete",class:"pca-opt",type:"radio",value:2}),$("<label>",{for:"pca-delete"}).text("למחוק אותו")),$("<div>",{id:"pc-reason"}).append($("<div>",{class:"pc-dialog"}).text("למה?"),$("<input>"),$("<button>").text("אישור").button(),$("<div>",{id:"pc-status"})))),token:mw.user.tokens.get("csrfToken"),addEvents:function(){$(".pc-icon").click(pagesCare.showPanel),$("#pc-close").click(pagesCare.destroy),$(".pca-opt").on("click",function(){this.checked&&(pagesCare.action=this.value,"msie"==$.client.profile().name?$("#pc-reason").show():$("#pc-reason").slideDown(function(){$(this).children("input").focus()}),$("#pc-custom").toggle(1==this.value))}),$("#pc-custom input").on("click",function(){this.checked&&($("#pc-custom textarea").toggle(2==this.value),"msie"!=$.client.profile().name&&$("#pc-custom textarea").focus())}),$("#pc-reason input").on({keyup:function(){$(this).next().toggle(!!this.value)},change:function(){pagesCare.reason=this.value}}),$("#pc-custom textarea").on("change",function(){pagesCare.userMsg=this.value}),$("#pc-reason button").click(pagesCare.run)},build:function(){var a=$(".newpage").parents("li, table"),b=$("<span>",{class:"pc-icon ui-icon ui-icon-transferthick-e-w script78",title:"טיפול מהיר"});a.before(b),pagesCare.panel.hide().appendTo("#mw-content-text"),pagesCare.addEvents()},deleteQuery:function(){pagesCare.sysopQuery(function(){pagesCare.done("בקשתך נשלחה בהצלחה!")})},destroy:function(){$("#pc-panel, #pc-reason, #pc-reason button, #pc-status, #pc-custom, #pc-custom textarea").hide(),$("#pc-form")[0].reset(),pagesCare.pageName=null,pagesCare.action=null,pagesCare.reason=null,pagesCare.userMsg=null},done:function(a){mw.util.jsMessage(a),pagesCare.destroy()},error:function(a){pagesCare.updateStatus(a,"red",!0)},move:function(){var a=this,b=pagesCare.pageName,c=pagesCare.user,d="משתמש:"+c+"/"+b;this.error=function(a){mw.addDialog({title:"ההעברה נכשלה",content:[$("<p>").text("אירעה שגיאה במהלך ביצוע ההעברה."),$("<h6>").text("פרטי השגיאה:"),$("<p>").css("direction","ltr").text(a)],buttons:{"אישור":function(){$("#mweDialog").dialog("close"),mw.util.jsMessage("ההעברה נכשלה")}}}),$(".ui-dialog .ui-dialog-buttonpane").css("text-align","center").children().css("float","none"),pagesCare.error("אירעה שגיאה")},this.notifyUser=function(){var a=$("#pcm-custom").is(":checked")?pagesCare.userMsg:"{{הועבר לארגז חול|"+b+"}}",d={action:"edit",appendtext:"\n\n=="+b+"==\n"+a+" ~~"+"~~",format:"json",summary:"הועבר לארגז חול",title:"שיחת משתמש:"+c,token:pagesCare.token};pagesCare.updateStatus("מודיע למשתמש"),$.post("/w/api.php",d,function(){return $.inArray("sysop",mw.config.get("wgUserGroups"))+1?pagesCare.done("הערך הועבר בהצלחה!"):void pagesCare.sysopQuery(function(){pagesCare.done("הערך הועבר בהצלחה!")},"הועבר לטיוטה של המשתמש",!0)})},this.parseDraft=function(){var b={action:"parse",format:"json",page:d,prop:"wikitext"};pagesCare.updateStatus("קובע תצורת טיוטה"),$.post("/w/api.php",b,function(b){var c="{{טיוטה פרטית}}\n",e=b.parse.wikitext["*"].replace("[[קטגוריה:","[[:קטגוריה:"),f=c+e,g={action:"edit",summary:"[["+pagesCare.currentLocation+"|סקריפט טיפול מהיר]]: קביעת תצורת טיוטה",text:f,title:d,token:pagesCare.token};$.post("/w/api.php",g,function(){a.notifyUser()})},"json")},this.send=function(){if($("#pcm-custom").is(":checked")&&!pagesCare.userMsg)return pagesCare.error("יש להזין הודעה למשתמש");var c={action:"move",format:"json",from:b,to:d,token:pagesCare.token,reason:"[["+pagesCare.currentLocation+"|סקריפט טיפול מהיר]]: "+pagesCare.reason};$("#pcm-mty").is(":checked")&&(c.movetalk=1),pagesCare.updateStatus("מעביר"),$.post("/w/api.php",c,function(b){return b.error?a.error(b.error.info):void a.parseDraft()},"json")}},showPanel:function(){var a=$(this).offset().top-135,b=$(this).next(),c=b.find(".mw-title a, .mw-contributions-title"),d=b.find(".mw-userlink").last();if(!d.length){if(!(!mw.config.get("wgNamespaceNumber")+1&&"תרומות"==mw.config.get("wgTitle").split("/")[0]))return;d=$("#contentSub a:first")}var e="משתמשת"==d.attr("title").split(":")[0]?"יוצרת":"יוצר";pagesCare.destroy(),pagesCare.pageName=c.text(),pagesCare.user=d.text(),$("#pc-caption").html(c.clone()),$("#pc-creator").text(e+": ").append(d.clone()),pagesCare.panel.show().css("top",a)},sysopQuery:function(a,b,c){var d=pagesCare.pageName,e=c?"{{ללא הפניה|"+d+"}}":"[["+d+"]]",f={action:"edit",appendtext:"\n* "+e+" - "+(b||pagesCare.reason)+". ~~"+"~~",section:1,summary:"/* בקשות מחיקה */ [["+d+"]]",title:"ויקיפדיה:בקשות ממפעילים",token:pagesCare.token};pagesCare.updateStatus("יוצר בקשת מחיקה"),$.post("/w/api.php",f,a)},run:function(){if(!pagesCare.reason)return pagesCare.error("יש לציין סיבה");switch(pagesCare.action){case"1":(new pagesCare.move).send();break;case"2":pagesCare.deleteQuery();break;default:pagesCare.error("לא נבחרה פעולה")}},updateStatus:function(a,b,c){$("#pc-status").show().css("color",b||"inherit").text(a+(c?"":"..."))}};$(function(){mw.loader.using("jquery.ui",pagesCare.build),importStylesheet(pagesCare.currentLocation+"/style.css")});