mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-01-31 12:23:48 +01:00
Board directory, board search, script escapes.
#467 - Now escapes HTML in the title. #467 - hashChange is now captured and assumed to be a tag. Comma dillimitation turns into multiple tags. Signed-off-by: 8n-tech <8n-tech@users.noreply.github.com>
This commit is contained in:
parent
aa370fe797
commit
2edebbf438
@ -47,7 +47,13 @@ if (isset( $_GET['lang'] ) && $_GET['lang'] != "" && isset($config['languages'][
|
||||
|
||||
// Include what tag?
|
||||
if (isset( $_GET['tags'] ) && $_GET['tags'] != "") {
|
||||
$search['tags'] = explode( " ", $_GET['tags'] );
|
||||
if (!is_array($_GET['tags'])) {
|
||||
$search['tags'] = explode( " ", (string) $_GET['tags'] );
|
||||
}
|
||||
else {
|
||||
$search['tags'] = $_GET['tags'];
|
||||
}
|
||||
|
||||
$search['tags'] = array_splice( $search['tags'], 0, 5 );
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,10 @@
|
||||
.on( 'submit', selectors['search'], searchForms, boardlist.events.searchSubmit )
|
||||
// Submit click
|
||||
.on( 'click', selectors['search-submit'], searchForms, boardlist.events.searchSubmit );
|
||||
|
||||
|
||||
$(window)
|
||||
.on( 'hashchange', searchForms, boardlist.events.hashChange );
|
||||
|
||||
$searchSubmit.prop( 'disabled', false );
|
||||
}
|
||||
}
|
||||
@ -265,6 +268,26 @@
|
||||
boardlist.submit( parameters );
|
||||
},
|
||||
|
||||
hashChange : function(event) {
|
||||
if (window.location.hash != "") {
|
||||
// Turns "#porn,tits" into "porn tits" for easier search results.
|
||||
var tags = window.location.hash.substr(1, window.location.hash.length).split(","),
|
||||
hash = tags.join(" ");
|
||||
}
|
||||
else {
|
||||
var tags = [],
|
||||
hash = ""
|
||||
}
|
||||
|
||||
$( boardlist.options.selector['search-tag'], boardlist.$boardlist ).val( hash );
|
||||
$( boardlist.options.selector['tag-list'], boardlist.$boardlist ).html("");
|
||||
$( boardlist.options.selector['board-body'], boardlist.$boardlist ).html("");
|
||||
|
||||
boardlist.submit( { 'tags' : tags } );
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
searchSubmit : function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
@ -330,6 +353,10 @@
|
||||
|
||||
boardlist.$boardlist = $boardlist;
|
||||
boardlist.bind.form();
|
||||
|
||||
if (window.location.hash != "") {
|
||||
$(window).trigger( 'hashchange' );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -5,10 +5,10 @@
|
||||
<a href='/{{board['uri']}}/'>/{{board['uri']}}/</a>
|
||||
{% if board['sfw'] %}<i class="fa fa-briefcase board-sfw" title="SFW"></i>{% endif %}
|
||||
</div></td>
|
||||
<td class="board-title"><div class="board-cell" title="Created {{board['time']}} ({{board['ago']}} ago)">{{ board['title'] }}</div></td>
|
||||
<td class="board-title"><div class="board-cell" title="Created {{board['time']}}">{{board['title']|e}}</div></td>
|
||||
<td class="board-pph"><div class="board-cell">{{board['pph']}}</td>
|
||||
<td class="board-max"><div class="board-cell">{{board['posts_total']}}</td>
|
||||
<td class="board-unique"><div class="board-cell">{{board['active']}}</td>
|
||||
<td class="board-tags"><div class="board-cell">{% for tag in board.tags %}<a class="tag-link" href="{{ tag_query }}{{ tag }}">{{ tag }}</a>{% endfor %}</div></td>
|
||||
<td class="board-tags"><div class="board-cell">{% for tag in board.tags %}<a class="tag-link" href="{{tag_query}}{{tag|e}}">{{tag|e}}</a>{% endfor %}</div></td>
|
||||
</tr>
|
||||
{% endfor %}
|
Loading…
x
Reference in New Issue
Block a user