PageSourceSearch

https://cdn.ribblr.com/assets/t20261001092330-r-yarn-ios/js/common/common.js

js ribblr.com collected 2026-10-01 12:32:33 UTC 8,513 bytes, 1 lines download raw bytes

1var imageUploading=!1,lastRand=0;function convertHeicIfNeeded(e){var n=/\.(heic|heif)$/i.test(e.name)||e.type==="image/heic"||e.type==="image/heif";if(!n)return Promise.resolve(e);function t(){return heic2any({blob:e,toType:"image/jpeg",quality:.92}).then(function(t){return new File([t],e.name.replace(/\.[^.]+$/,".jpg"),{type:"image/jpeg"})})}return typeof heic2any!="undefined"?t():new Promise(function(e,n){var s=document.createElement("script");s.src="https://cdn.jsdelivr.net/npm/[email protected]/dist/heic2any.min.js",s.onload=function(){t().then(e).catch(n)},s.onerror=n,document.head.appendChild(s)})}window.rbTextBytes=window.rbTextBytes||function(e){var t=e==null?"":String(e);try{return new Blob([t]).size}catch{return t.length}},window.rbClipBytes=window.rbClipBytes||function(e,t){if(n=e==null?"":String(e),rbTextBytes(n)<=t)return n;for(var n,o,s=0,i=n.length;s<i;)o=s+i+1>>1,rbTextBytes(n.substring(0,o))<=t?s=o:i=o-1;return n.substring(0,s)};function genFileName(e,t){var n=new Date,s=n.getUTCDay().toString()+n.getUTCMonth().toString()+n.getUTCHours().toString()+n.getUTCMinutes().toString()+n.getUTCSeconds().toString()+n.getUTCMilliseconds().toString()+Math.floor(Math.random()*1e4).toString();return s==lastRand&&(s+="0"),lastRand=s,s=t+"-"+parseInt(s).toString(36)+"."+e,s.toLowerCase()}function getExt(e){var t=e.split(".").pop().toLowerCase();return t}function b64toBlob(e,t,n){t=t||"",n=n||512;for(var s,i,a,l,d,r=atob(e),c=[],o=0;o<r.length;o+=n){for(i=r.slice(o,o+n),a=new Array(i.length),s=0;s<i.length;s++)a[s]=i.charCodeAt(s);l=new Uint8Array(a),c.push(l)}return d=new Blob(c,{type:t}),d}function removeImg(e,t){$.ajax({url:"/db_api",type:"post",data:{magic:"O4d@",id:e,img_id:t,pattern_id,cmd:"img_rm"}}).done(function(e){e=="0"||$.alert({title:"Error",content:e,backgroundDismissAnimation:"glow",useBootstrap:!1})}).fail(function(e){$.alert({title:"Internet connection Error!",content:"Please check your internet connection. Do NOT refresh, as Ribbuild will update once the Internet is back. "+e,backgroundDismissAnimation:"glow",useBootstrap:!1}),console.log(e)})}function Orientation(e){if(n=new DataView(e),n.getUint16(0,!1)!=65496)return-2;for(var n,s,o,i,a,r=n.byteLength,t=2;t<r;)if(i=n.getUint16(t,!1),t+=2,i==65505){{if(n.getUint32(t+=2,!1)!=1165519206)return-1;s=n.getUint16(t+=6,!1)==18761,t+=n.getUint32(t+4,s),a=n.getUint16(t,s),t+=2;
1for(o=0;o<a;o++)if(n.getUint16(t+o*12,s)==274)return n.getUint16(t+o*12+8,s)}}else if((i&65280)!=65280)break;else t+=n.getUint16(t,!1);return-1}function ShrinkNload(e,t,n,s){var o,i,c,l,r=1024,a="#img"+t;switch(s){case 1:r=1920,a="#dots"+t;break;case 2:a="#logo_icon";break;case 22:a="#status_icon";break;case 3:r=1920,a="#banner_icon";break;case 4:r=1920,a=".j_upload";break;case 5:a="#camera_icon";break;case 99:a="#profile_icon";break}c=$(a).html(),o=new Image,o.src=e,i=document.createElement("canvas"),i.id="thisCanvas",l=i.getContext("2d"),o.onerror=function(e){console.error("Image failed to load.",e),$.alert({title:"Error",content:"Image might be too large to upload. Try and reduce it (e.g. about 500 pixels width) and upload again",backgroundDismissAnimation:"glow",useBootstrap:!1})},o.onload=function(){var d,u,h,m,f,p,e=1;switch(o.height>o.width?o.height>r&&(e=o.height/r):o.width>r&&(e=o.width/r),n=-1,n){case 3:rotation=180*Math.PI/180,i.width=o.width/e,i.height=o.height/e;break;case 6:o.height>o.width?(rotation=0*Math.PI/180,i.width=o.width/e,i.height=o.height/e):(rotation=90*Math.PI/180,i.width=o.height/e,i.height=o.width/e);break;case 8:o.height>o.width?(rotation=0*Math.PI/180,i.width=o.width/e,i.height=o.height/e):(rotation=270*Math.PI/180,i.width=o.height/e,i.height=o.width/e);break;default:rotation=0*Math.PI/180,i.width=o.width/e,i.height=o.height/e;break}if(l.translate(i.width/2,i.height/2),l.rotate(rotation),l.scale(1/e,1/e),l.drawImage(o,-o.width/2,-o.height/2),h=i.toDataURL().split(";"),f=h[0].split(":")[1],p=h[1].split(",")[1],m=b64toBlob(p,f),m.size>3e7)return $.alert({title:"Note",content:"File size acceeds 30MB. Try a smaller file"+errorThrown,backgroundDismissAnimation:"glow",useBootstrap:!1}),!1;switch(d=new FormData,d.append("file",m),s){case 1:u=img_id_arr[t],u!=""&&removeImg(0,u),u=genFileName("png","body"),img_id_arr[t]=u,typeof rbUpdateMediaPreview=="function"&&rbUpdateMediaPreview(t),d.append("id",id_arr[t]),d.append("cmd","img_add"),$(a).css("font-size","10px");break;case 2:u="logo.png",d.append("cmd","logo_add");break;case 22:u="status.png",d.append("cmd","logo_add");break;case 3:u="banner.png",d.append("cmd","logo_add");break;case 4:u=genFileName("png","j"),d.append("cmd","journal_upload"),$(a).css("font-size","1.1em");break;case 5:u="st-"+stashId[t]+"-0.png",d.append("stash_id",stashId[t]),d.append("cmd","stash_img_add"),stashImg[t]=u;break;case 99:u="profile.png",d.append("cmd","logo_add"),pattern_id=0;break}d.append("filename",u),d.append("which",s),d.append("magic","O4d@"),d.append("pattern_id",pattern_id),$.ajax({url:"/db_api",type:"post",data:d,contentType:!1,cache:!1,processData:!1,xhr:function(){var e=new window.XMLHttpRequest;return e.upload.addEventListener("progress",function(e){if(e.lengthComputable){s==5&&($(".my_stash_info").html(infocircle_svg+"Analyzing your photo. Please wait up to 60 seconds..."),$("#stash_img_edit").addClass("containerloading"));var t=e.loaded/e.total,t=parseInt(t*100);$(a).html(t+"%"),t===100&&(s==5?$(a).html("Analyzing"):$(a).html("saving"))}},!1),e},complete:function(){}}).done(function(e){if(console.log("commmon.js #"+s),s==5){$(a).html(c),$("#edit_photo_src").attr("src",i.toDataURL()),$("#edit_photo_info").hide(),$("#camera_icon, .stash_edit_in").show(),$("#edit_photo_src").css("opacity",1),$("#stash_img_edit").removeClass("containerloading"),$(".my_stash_info").html(infocircle_svg+"Photo analyzed successfully! We have filled all the information from your photo.");let n=JSON.parse(e);tagify&&(tagify.removeAllTags(),tagify.addTags(n.tags),n.note&&(stashNote[t]=n.note,$("#stash_note").val(typeof noteQuotes=="function"?noteQuotes(n.note):n.note)))}else if(e=="0")switch(s){case 1:$(a).html('<span id="first_dot"></span><span id="second_dot"></span><span id="third_dot"></span>').css("font-size","18px"),$("#floating"+t).css("opacity","0.9").css("background","linear-gradient(45deg, var(--gradient1) 30%, var(--gradient2))"),$("#floating"+t).removeClass("is-activate"),isMobile?$("#li-img-src").attr("src",i.toDataURL()):($("#large-img").css("background-image","url("+i.toDataURL()+")"),$("#large-img",window.parent.document).html(""),$("#large-img").css("display","inline"),typeof window.rbEnsureLargeImageFlip=="function"&&window.rbEnsureLargeImageFlip()),$("#video").css("display","none"),$("#cover11, #cover12, #cover21, #cover22").css("display","none"),typeof window.rbForceOpenMedia=="function"&&window.rbForceOpenMedia(t,"png"),typeof window.rbRecordMediaHistory=="function"&&window.rbRecordMediaHistory();break;case 2:$(a).html(c),$("#logo_img").attr("src",i.toDataURL());break;case 22:$(a).html(c),$("#status_img").attr("src",i.toDataURL());break;case 3:$(a).html(c),$("#banner_img").attr("src",i.toDataURL());break;case 4:$(a).html('<img src="'+i.toDataURL()+'" alt="show image">'),j_file=u,imageUploading=!1;break;case 99:$(a).html(c),$("#profile-img").attr("src",i.toDataURL())}else switch(s==4&&(imageUploading=!1),$.alert({title:"Error",content:"image not uploaded ("+e+")",backgroundDismissAnimation:"glow",useBootstrap:!1}),s){case 1:$(a).html('<span id="first_dot"></span><span id="second_dot"></span><span id="third_dot"></span>').css("font-size","18px"),$("#floating"+t).css("opacity","0.9").css("background","linear-gradient(45deg, var(--gradient1) 30%, var(--gradient2))"),$("#floating"+t).removeClass("is-activate");break;default:$(a).html(c)}}).fail(function(e,t){$.confirm({title:"Internet connection failed!",content:"Internet error, image was not be uploaded. Please try again to verify.",backgroundDismissAnimation:"glow",autoClose:"closeAction|5000",buttons:{closeAction:{text:" OK "}},useBootstrap:!1}),console.log("common.js upload image failed! "+t),console.log(e)})}}(function(e){e.fn.inputFilter=function(e){return this.on("input keydown keyup mousedown mouseup select contextmenu drop",function(){e(this.value)?(this.oldValue=this.value,this.oldSelectionStart=this.selectionStart,this.oldSelectionEnd=this.selectionEnd):this.hasOwnProperty("oldValue")?(this.value=this.oldValue,this.setSelectionRange(this.oldSelectionStart,this.oldSelectionEnd)):this.value=""})}})(jQuery)

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.