+
+////// BEGIN HIDE STICKER PACK FUNCTIONALITY
+
+// Hide sticker packs functionality
+// /* hide Heromals pack*/
+// a[data-id="633721996647110"] {display:none !important}
+
+function fbpInsertedStickerStoreHandler(records) { //event // mutationObserverRef
+//try{
+ var q,p,tempnode;
+ if(records.length) {
+ for(q=0;q<records.length;q++) {
+ //if(records[q].addedNodes.length)
+ for(p=0;p<records[q].addedNodes.length;p++) {
+ tempnode=records[q].addedNodes[p];
+ if(tempnode.nodeName=='DIV') //console.log(tempnode);
+ if(tempnode.getAttribute && tempnode.getAttribute("class")=="_10 uiLayer _4-hy _3qw") {
+ if(document.getElementById('pagelet_sticker_store_dialog')) {
+ if(debug)
+ console.log('found sticker store!!');
+ managestickerpacks();
+ }
+ }
+ }
+ }
+ }
+//} catch(e) {
+// console.log("something wrong in inserted stickerstorehandler: " + e);
+//}
+}
+
+function hidestickerpacks() {
+ if(debug) {
+ console.log("\nhidestickerpacks function");
+ console.log("typeof fbpoptsobj:" + typeof(fbpoptsobj));
+ console.log("typeof fbpoptsobj.stickerpacks:" + typeof(fbpoptsobj.stickerpacks));
+ console.log("stickerpack ids in fbpoptsobj:\"" + fbpoptsobj.stickerpacks +"\"");
+ }
+ if((typeof(fbpoptsobj)=='undefined') || typeof(fbpoptsobj.stickerpacks)=='undefined') {
+ if(debug)
+ console.log("fbpoptsobj is not yet defined");
+ fbpoptsobj.stickerpacks='';
+ //return;
+ }
+ var spar=fbpoptsobj.stickerpacks.split(',');
+ var stickerpackstyles='';
+ if(spar.length && (spar[0]!=''))
+ for(var i=0;i<spar.length;i++)
+ stickerpackstyles+= 'a[data-id="' + spar[i] + '"] {display:none} ';
+ else
+ ; //console.log('array was empty');
+ if(debug)
+ console.log(stickerpackstyles);
+ stickerpackstyle=document.getElementById('stickerpackstyle');
+ stickerpackstyle.textContent=stickerpackstyles;
+}
+
+function hidestickerpackclick(e) {
+ //console.log('clicked it');
+ var spid=e.target.getAttribute('id');
+ if(debug) {
+ console.log("\nhidestickerpackclick function");
+ }
+
+ if(e.target.checked) {
+ if(!fbpoptsobj.stickerpacks.match("'" + spid +"'")) {
+ if(fbpoptsobj.stickerpacks.length)
+ fbpoptsobj.stickerpacks+=',' + spid;
+ else
+ fbpoptsobj.stickerpacks+= spid;
+ }
+ }
+ else {
+ fbpoptsobj.stickerpacks=fbpoptsobj.stickerpacks.replace(spid,'');
+ fbpoptsobj.stickerpacks=fbpoptsobj.stickerpacks.replace(/,,/,',');
+ fbpoptsobj.stickerpacks=fbpoptsobj.stickerpacks.replace(/(^,|,$)/,'');
+ }
+ //console.log(fbpoptsobj.stickerpacks);
+
+ //save prefs obj to localstorage
+ fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
+
+ hidestickerpacks();
+}
+
+// BEGIN init stickerpack variables
+var stickerpackstyle;
+var stickyobject={};
+
+function managestickerpacks() {
+
+ // BEGIN cache current stickerpacks
+ if(typeof(stickyobject.ready)=='undefined') {
+ var stickerpackbar=document.getElementsByClassName('_590r');
+ if(!stickerpackbar.length) {
+ console.log('couldnt find stickerpack bar, maybe the class name has changed');
+ return;
+ }
+
+ var stickypacks=stickerpackbar[0].getElementsByClassName('_55bn')
+ if(!stickypacks.length) {
+ console.log('couldnt find individual sticker packs in stickerpack bar, maybe the class name has changed')
+ return;
+ }
+
+ for(var i=0;i<stickypacks.length-1;i++) {
+ if(debug)
+ console.log(stickypacks[i].getAttribute('aria-label') + ':' + stickypacks[i].getAttribute('data-id'))
+ stickyobject[stickypacks[i].getAttribute('aria-label')]=stickypacks[i].getAttribute('data-id');
+ }
+ }
+ stickyobject.ready=1;
+ // END cache current stickerpacks
+
+ var spboxes=document.getElementsByClassName('_5b2l');
+ if(!spboxes.length) {
+ console.log('didnt find the stickerpack boxes in the stickerstore')
+ return;
+ }
+ if(!spboxes[0].getElementsByClassName('_5b2r').length) {
+ console.log('we didnt find the stickerpack names in the stickerpack store, maybe the class name has changed.')
+ return;
+ }
+
+ var spcheckboxspan=document.createElement('span');
+ spcheckboxspan.setAttribute('title','Hide sticker pack with with FB Purity.');
+ var sptextnode=document.createTextNode(' Hide');
+ spcheckboxspan.appendChild(sptextnode);
+ var spcheckbox=document.createElement('input');
+ spcheckbox.setAttribute('type','checkbox');
+ spcheckbox.setAttribute('style','vertical-align:middle');
+ spcheckboxspan.appendChild(spcheckbox);
+
+ for(var i=0;i<spboxes.length;i++) {
+ if(typeof (stickyobject[ spboxes[i].getElementsByClassName('_5b2r')[0].textContent ])!='undefined') {
+ spboxes[i].getElementsByClassName('mts rfloat')[0].appendChild(spcheckboxspan.cloneNode(1));
+ spboxes[i].getElementsByTagName('input')[0].setAttribute('id',stickyobject[spboxes[i].getElementsByClassName('_5b2r')[0].textContent]);
+ spboxes[i].getElementsByTagName('input')[0].addEventListener('click',hidestickerpackclick,false);
+ if(fbpoptsobj && fbpoptsobj.stickerpacks && fbpoptsobj.stickerpacks.length)
+ if(fbpoptsobj.stickerpacks.match(stickyobject[spboxes[i].getElementsByClassName('_5b2r')[0].textContent]))
+ spboxes[i].getElementsByTagName('input')[0].checked=true;
+ }
+ }
+} // end managestickerpacks function
+
+////// END HIDE STICKER PACK FUNCTIONALITY
+