Jeanzinh0

Staff page with image

May 21st, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 5.22 KB | None | 0 0
  1. {% set avaliablePositions = [] %}
  2.  
  3. {% block content %}
  4. <div id="content">
  5.         <div class="container">
  6.             <div class="row">
  7.                 <div class="panel-default panel-6">
  8.                     <div class="panel-body">
  9.                         <!-- Set all positions for Staffs. -->
  10.                         {% set avaliablePositions = avaliablePositions|merge([{ avatarConfig: 'action=sit&direction=4&head_direction=4&gesture=sml', left: '406px',  top: '89px' }]) %}
  11.                        {% set avaliablePositions = avaliablePositions|merge([{ avatarConfig: 'action=sit&direction=4&head_direction=4&gesture=sml', left: '565px',  top: '162px' }]) %}
  12.                        {% set avaliablePositions = avaliablePositions|merge([{ avatarConfig: 'action=sit', left: '114px',  top: '231px' }]) %}
  13.                        {% set avaliablePositions = avaliablePositions|merge([{ avatarConfig: '', left: '374px',  top: '289px' }]) %}
  14.                        {% set avaliablePositions = avaliablePositions|merge([{ avatarConfig: 'action=sit', left: '189px',  top: '189px' }]) %}
  15.                        {% set avaliablePositions = avaliablePositions|merge([{ avatarConfig: 'action=sit', left: '245px',  top: '166px' }]) %}
  16.                        {% set avaliablePositions = avaliablePositions|merge([{ avatarConfig: '', left: '467px',  top: '243px' }]) %}
  17.                        {% set avaliablePositions = avaliablePositions|merge([{ avatarConfig: '', left: '274px',  top: '276px' }]) %}
  18.                        {% set avaliablePositions = avaliablePositions|merge([{ avatarConfig: '', left: '180px',  top: '323px' }]) %}
  19.  
  20.                        <!-- Room background image. -->
  21.                        <div style="background: url({{ url.skin }}/assets/images/pages/staffs.png); width: 706px; height: 468px ">
  22.  
  23.                             <!-- 'About' is set to hidden when the page loads, but when a Staff is clicked, 'About' is set to visible. See more at openAbout function.  -->
  24.                             <div id="openAbout" style="visibility: hidden; background: #fff; position: absolute; border: 1px solid #e7e7e7; padding: 5px; width: 280px; box-shadow: 1px 1px 2px #e5e5e5">
  25.                                 <p id="aboutFigure" style="margin: 0; font-size: 14px">
  26.                                 </p>
  27.                                 <p id="aboutUsername" style="margin: 0; font-size: 14px"></p>
  28.                                 <p id="aboutOnline" style="margin: 0; font-size: 14px"></p>
  29.                                 <br>
  30.                                 <p id="aboutMotto" style="margin: 0; font-size: 14px"></p>
  31.                             </div>
  32.  
  33.                         <!-- Getting all ranks avaliables -->
  34.                         {% for rank in ranks %}
  35.  
  36.                             <!-- Setting the current loop index for ranks -->
  37.                             {% set rankLoop = loop.index0 %}
  38.  
  39.                             <!-- Getting all users in current rank -->
  40.                             {% for staff in rank.users %}
  41.  
  42.                             <!-- Setting the current loop index for staffs -->
  43.                             {% set staffLoop = loop.index0 %}
  44.                                 <div class="avatar-image" onclick="openAbout('{{ staff.username }}', '{{ staff.online }}', '{{ staff.look }}', '{{ staff.motto }}')" style='cursor: pointer;background:url({{ setting.avatar_image_url }}?figure={{ staff.look }}&size=b&{{ avaliablePositions[rankLoop+staffLoop].avatarConfig }}) center 3px no-repeat; margin-left:{{ avaliablePositions[rankLoop+staffLoop].left }}; margin-top: {{ avaliablePositions[rankLoop+staffLoop].top }}; position: absolute'></div>
  45.                             {% endfor %}
  46.                         {% endfor %}
  47.                     </div>
  48.                     </div>
  49.                 </div>
  50.  
  51.                 <script>
  52.                     //openAbout function is where the 'magic' happens
  53.                     function openAbout(name, online, look, motto)
  54.                     {
  55.                         //Check if the clicked staff is online, then set the image for the status
  56.                         var onlineImg = "habbo_offline_big.gif";
  57.                         if(online == '1')
  58.                             onlineImg = "habbo_online_anim_big.gif";
  59.  
  60.                         document.getElementById("openAbout").style.visibility = "visible"; //Set the div openAbout visible
  61.                         document.getElementById("aboutUsername").innerHTML = "<b>Username: </b>" + name; //Set the current name
  62.                         document.getElementById("aboutOnline").innerHTML = "<img src='{{ url.skin }}/assets/images/" + onlineImg + "'>"; //Set the current status
  63.                         document.getElementById("aboutMotto").innerHTML = "<b>Motto: </b>" + motto; //Set the current motto
  64.                         document.getElementById("aboutFigure").innerHTML = "<div style='width: 64px; height: 120px; cursor: pointer;background:url({{ setting.avatar_image_url }}?figure="+ look +"&size=b&&direction=4&head_direction=4) center 3px no-repeat; float: right;'></div>";//Set the current look
  65.  
  66.                     }
  67.                 </script>
  68.             <div class="clear"></div>
  69.         </div>
  70.     </div>
  71. {% endblock %}
Advertisement
Add Comment
Please, Sign In to add comment