Advertisement
ndfjay

genFriends

Sep 6th, 2017
695
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var sTag = document.scripts[document.scripts.length-1];
  2. var parentTag = sTag.parentNode;
  3.  
  4. function genFriends(s){
  5.     this.friends = (s.friends ? s.friends : [])
  6.     this.styleDef = {
  7.         scale: (s.scale ? s.scale : "1"),
  8.         radius: (s.radius ? s.radius : "0px"),
  9.         spacing: (s.spacing ? s.spacing : "5px"),
  10.         overlay: (s.overlay ? s.overlay : "#000"),
  11.         opacity: (s.opacity ? s.opacity : "0"),
  12.         color: (s.color ? s.color : "#fff"),
  13.         font: (s.font ? s.font : "Poiret One")
  14.     }
  15.     this.CSSStyle = `
  16.     <style>
  17.     #fpic{
  18.         width: 100%;
  19.         height: 100%;
  20.         font-family: '`+this.styleDef.font+`';
  21.         color: `+this.styleDef.color+`;
  22.         text-alin: center;
  23.         background: `+this.styleDef.overlay+`;
  24.         border-radius: `+this.styleDef.radius+`;
  25.         opacity: 0;
  26.         transition: opacity .4s ease-in;
  27.         -moz-transition: opacity .4s ease-in;
  28.         -webkit-transition: opacity .4s ease-in;
  29.         -o-transition: opacity .4s ease-in;
  30.         cursor: context-menu;
  31.     }
  32.     #fpic:hover{
  33.         opacity: `+this.styleDef.opacity+`;
  34.         transition: opacity .4s ease-in;
  35.         -moz-transition: opacity .4s ease-in;
  36.         -webkit-transition: opacity .4s ease-in;
  37.         -o-transition: opacity .4s ease-in;
  38.         cursor: pointer;
  39.     }
  40.     </style>`;
  41.     this.template = ``;
  42.    
  43.     this.friends.forEach(function(val, index, arr){
  44.         this.style = "background-size: cover; background-repeat: no-repeat; background-image: url(https://www.imvu.com/catalog/web_av_pic.php?av="+val+"); width: calc(160px * "+this.styleDef.scale+"); height: calc(220px * "+this.styleDef.scale+"); border-radius: "+this.styleDef.radius+"; margin-left: "+this.styleDef.spacing+"; margin-bottom: "+this.styleDef.spacing+"; float: left";
  45.                 this.template = this.template + `
  46.                 <div style="`+this.style+`">
  47.                     <div id="fpic" onclick="window.open('https://avatars.imvu.com/${val}', '_blank')">
  48.                         <div style="position: relative; top: calc(50% - 15px);">`+val+`</div>
  49.                     </div>
  50.                 </div>`
  51.             });
  52.     $(parentTag).append(this.CSSStyle + this.template);
  53.     return this.CSSStyle + this.template
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement