-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstamath.min.js
1 lines (1 loc) · 1.41 KB
/
instamath.min.js
1
function instamath_load(e){if(e.dataset.src){var t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===this.readyState&&200===this.status){delete e.dataset.src;var a=new Uint8Array(t.response),r=String.fromCharCode.apply(null,a),s=btoa(r);e.src="data:image/jpeg;base64,"+s}},t.open("GET","https://try.readme.io/"+e.dataset.src,!0),t.responseType="arraybuffer",t.send()}}Object.defineProperty(Object.prototype,"instamath",{value:function(e){if(e.user){var t=this,a=new XMLHttpRequest;a.onreadystatechange=function(){if(4===this.readyState&&200===this.status){var r=JSON.parse(a.responseText.match(/window._sharedData = (.*);/)[1]),s=e.limit?e.limit:12,o=0,n="";switch(s>=1&&s<=12||(s=12),e.resolution){case 150:o=0;break;case 240:o=1;break;case 320:o=2;break;case 480:o=3;break;case 640:o=4;break;default:e.resolution=150}for(var i=r.entry_data.ProfilePage[0].graphql.user.edge_owner_to_timeline_media,c=0;c<s&&c<i.count;c++){var d=i.edges[c].node;d.is_video?s<12&&(s+=1):n+='<a href="https://www.instagram.com/p/'+d.shortcode+'/"><img src="https://via.placeholder.com/'+e.resolution+'/FFFFFF/FFFFFF" data-src="'+d.thumbnail_resources[o].src+'" onload="instamath_load(this)"></a>'}void 0===t.length?t.innerHTML=n:t.html(n),e.after&&e.after()}},a.open("GET","https://images"+~~(3333*Math.random())+"-focus-opensocial.googleusercontent.com/gadgets/proxy?container=none&url=https://www.instagram.com/"+e.user+"/",!0),a.send()}},enumerable:!1});