summaryrefslogtreecommitdiff
path: root/template/banner.st
blob: 02759c5201a265bd4d33441e6e97b99913ad1476 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<div id="rapper7">
  <div id="header7">
  <div id="logoicons">
    <div id="logo7">
  <div align="center">
  <img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 /><style type='text/css'>
a.img_roll:link, .img_roll{
	width:130px;
	height:46px;
	display:block;
	background-image:url(http://dump.fm/static/img/dumppixel.png);
}
a.img_roll:hover{
	width:130px;
	height:46px;
	display:block;
	background-image:url(http://dump.fm/static/img/dumppixelhover.png);
}
</style>
<a class="img_roll" href="http://dump.fm/"></a>

  
  </div>
    </div>
    <div class="white">
      
      <div id="bar7">    
        <div style="float: left;">
          <div align="center">
            $if(user_nick)$


      <a href="http://dump.fm/log" ><img src="/static/img/log.gif"width="20px" height="20px">&#9827; Log</a>
        <a href="http://dump.fm/$user_nick$">$if(user_avatar)$<img src="$user_avatar$" width="19px" height="19px" />$else$<img src="/static/img/profile.gif"width="22px" height="22px" />$endif$&#9829; Profile</a>
                  <a href="http://dump.fm/directory"><img src="/static/img/directory.gif"width="20px" height="20px" />&#9824; Directory</a>
                   <a href="http://dump.fm/$user_nick$/favorites">&#10084; Favs</a> 
             <a href="http://dump.fm/browser"><img src="/static/img/image_draw.gif"/>&#9830; Image Search</a>
            
	    $else$
  

<a href="/register" id="registerlink">The coolest way to share pictures. Click here to get started!</a>
   
	    $endif$     

          </div>            	    
	  </div>
        </div>
      </div>
    </div>
$if(isadmin)$ 
<div id="searchbox">
<input type="text" name="search-query" id="search-query" value="search dump.fm" 
onblur="this.className = ''; resume_key_commands(); if (this.value == '') { this.value = default_search_text; this.style.color = '#c0c8d3'; }" onfocus="suspend_key_commands(); if (this.value == default_search_text) { this.value = ''; this.style.color = '#5c7480'; }" style="color: rgb(192, 200, 211);" class=""/>
<a href=# onclick="hideItem(searchresults);"><div class="search_icon"></div></a>
</div>
$endif$
    
    <div id="topic"></div>
           <div id="dumplist">
            $if(user_nick)$

       
       want a room in dump.fm? <a href="mailto:info@dump.fm">contact us!</a>$else$ let pictures do the talking $endif$ $if(isadmin)$ 
    <a href="http://news.dump.fm">- news</a> -  <a href="http://gossip.dump.fm">gossip</a> - <a href="http://art.dump.fm">art</a> - <a href="http://gif.dump.fm">gif</a> -  <a href="http://design.dump.fm">design</a> - <a href="http://fashion.dump.fm">fashion</a>


        -<a href="http://vip.dump.fm/">  VIP PIMP DEN (NO GIRLS ALLOWED) </a>
              $endif$
      </div>
$if(user_nick)$
          <div id="logout7" class="white">   
      <div align="center"> <a href="/logout"> Logout</a>       </div>$else$           <div id="toplogin" class="white">   $form_login()$</div> $endif$
<div id="searchresults"></div>
      
    </div>
    <div align="center"><br /></div>
    
  </div>
</div>
$if(isadmin)$ 
  <script>
    var term = ""
    var imagesPerPage = 25;
    var images = []
  
    function addScript(term){
      jQuery("#search-script").remove()
      jQuery("head").append("<scr"+"ipt src='/cmd/ghettosearch/"+term+"' id='search-script'></sc"+"ript>")
    }
    
    function setContent(x){
      jQuery("#searchresults").html(x)
    }
    
    function setMessage(x){
      jQuery("#message").html(x)
    }
    
    function searchError(error){
      setContent("")
      setMessage(error)
    }
    
    function renderPage(num){
      if (images.length > 0)
        setMessage("page " + (num + 1));
      var contentString = ''
      var start = num * imagesPerPage
      var imageCounter = 0
      for(var i = start; i < images.length; i++){
        if(imageCounter > imagesPerPage) break;
        contentString += '<a href="'+images[i]+'"target="_blank"><img src="'+images[i]+'"></a>'
        imageCounter += 1
      }
      contentString += '<br><br>'
      if(num > 0)
        contentString += '<a href="javascript:renderPage('+(num-1)+')"><h1>previous</h1></a> '
      if (images.length > start + imageCounter)
        contentString += ' <a href="javascript:renderPage('+(num+1)+')"><h1>next</h1></a>'
      setContent(contentString)
    }
    
    function searchResult(results){
      images = []
      var alreadyGot = {}
      if(results === null || results.length == 0) {
        setContent("")
        setMessage("no results found")        
      } else {
        for(var r = 0; r<results.length; r++){
          var content = results[r]['content']
          if (content.substring(0,6) == "<safe>") continue; // skip html posts
          var imageUrls = getImagesAsArray(content);
          for (var i=0; i<imageUrls.length; i++){
            var imageUrl = imageUrls[i];
            if (imageUrl in alreadyGot) continue;
            alreadyGot[imageUrl] = true
            var validImage = true;
            for(var t = 0; t<tokens.length; t++){
              if (imageUrl.toLowerCase().indexOf(tokens[t]) == -1) {
                validImage = false;
                break;
              }
            }
            if (validImage)
              images.push(imageUrl);
          }
        }
        if (images.length == 0) {
          setMessage("no results found")  
        }
        renderPage(0)
      }
    }
    
    var tokens = []
    
    function doSearch(){
      term = jQuery("#search-query").val().trim().toLowerCase()
      var rawTokens = term.split(" ")
      tokens = []
      for(var t = 0; t < rawTokens.length; t++) {
        if (rawTokens[t].length > 2)
        tokens.push(rawTokens[t])
      }
      if (tokens.length == 0) {
        setMessage("search query too small")
      } else {
        setMessage("searching for '"+tokens.join(" and ")+"'")
        addScript(tokens.join("+"))
      }
    }

    // only search every 800ms while someone is typing
    function keyHandler(){
      if (keyHandler.timeout) clearTimeout(keyHandler.timeout);
      keyHandler.timeout = setTimeout(doSearch, 800)
    }
    
    jQuery("#search-query").keyup(keyHandler)

  </script>
  $endif$