Last active
July 10, 2018 09:50
-
-
Save Amaimersion/47adaf04588014791e5835e6a5b0e445 to your computer and use it in GitHub Desktop.
Функции для генерации заголовка, взятые с 2ch.hk. Версия кэша swag – 35, MD5 всего файла swag – 13d9757cc5e9c9bb5128ec9d48df84c1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getTitle: function() { | |
var element = this.el(); | |
var title = $.trim(element.find('.post-title').text()); | |
if(!title) title = $.trim(element.find('.post-message:first').text()); | |
if(title.length > 50) title = title.substr(0,50) + '...' | |
return escapeHTML(title); | |
} | |
function escapeHTML(str) { | |
return (str+'') | |
.replace(/&/g, "&") | |
.replace(/</g, "<") | |
.replace(/>/g, ">") | |
.replace(/"/g, """) | |
.replace(/'/g, "'"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment