currently have coded twitter widget using api. websites need change layout , html structure outputted.
currently build html so:
// generate html var $con; $con = $("<div>", { "class" : "tweet" }) .append($("<div>", { "class" : "twocol" }) .append($("<div>", { "class" : "tweet-profile-photo" }) .append($("<img>", { "src" : obj.user.profile_image_url, "class" : "responsive-img" })) ) ) .append(($("<div>", { "class" : "tencol last" }) .append(($("<div>", { "class" : "tweet-head" }) .append($("<div>", { "class" : "eightcol" }) .append($("<div>", { "class" : "tweet-name" }) .append(obj.user.name) ) .append($("<div>", { "class" : "tweet-to-from" })) )) .append($("<div>", { "class" : "fourcol last tweet-date" }) .append(((settings.disabledate===true)?"":fulldate)) ) )) .append($("<div>", { "class" : "twelvecol tweet-text" }) .append($("<span>") .append(text) ) ) .append($("<div>", { "class" : "tweet-footer" }) .append($("<div>", { "class" : "twelvecol", "style" : "display:none;" }) .append($("<i>", { "class" : "fa fa-retweet", "aria-hidden" : "true" })) .append($("<span>", { "class" : "tweet-retweeted" })) ) ) ); $(container).append($con);
as stated above, need change layout , outputted, there way can make kind of template, make different header, different template body of each tweet. can send javascript , populate html content.
any ideas on how this? thinking xaml or along them lines, it's keep object based , not searching strings or that.
try jquery templates, simple, did job, i've worked , had results.
short presentation here
later edit: seems has been migrated jsrender
later-later edit: lightweight javascript-only version here: javascript template engine in 20 lines
Comments
Post a Comment