/    Sign up×
Community /Pin to ProfileBookmark

help me analize this code

can you explain something in this code for me?
[url]http://www.twitch.tv/search?query=dryus#stq=dryus&stp=1[/url]
on line 327, the part where they display the videos is confusing to me
their variables for each video look like this {{path}}, {{thumbnail}}
where are these variables coming from? ive checked all the other .js files linked in the page and cant find another reference to them

[code]
<script id=’search-broadcasts’ type=’text/html’>
<li class=’broadcasts result archive video clearfix’>
<div class=’cap_and_profile’>
<a class=’thumb’ href='{{path}}’>
<img class=’cap’ src='{{thumbnail}}’>
<a class=’profile’ href='{{profilePath}}’>
<img class=’p50′ src='{{profileImage}}’>
</a>
</a>
</div>
<div class=’video_meta’>
<p class=’title’>
<img alt=’Recorded’ class=’video_type’ src=’/images/xarth/g/g18_camera-00000080.png’>
<a href='{{path}}’>
{{title}}
{{^title}}
Untitled Broadcast
{{/title}}
</a>
</p>
<p class=’video_stats search_topstats’>
<span class=’stat channelname’>
on
<a href='{{profilePath}}’>{{user}}</a>
{{#game}}
playing
<a href='{{gamePath}}’>{{game}}</a>
{{/game}}
</span>
</p>
<p class=’desc’>
<span class=’content’>{{description}}</span>
</p>
<p class=’video_stats’>
<span class=’stat time_ago’>
Recorded
<time datetime='{{startTime}}’></time>
</span>
<span class=’stat length’>{{length}}</span>
<span class=’stat views_count’>{{views}}</span>
</p>
</div>
</li>
</script>
<div class=’ad_leader search_leader’>
<div class=’advertisement’>
<div class=”ad_leader” id=”Twitch_DirLeaderv2_holder” name=”Twitch_DirLeaderv2″><div id=”Twitch_DirLeaderv2_load_text”></div></div>
<script>
//<![CDATA[
if (window.cbsiSlotConfigs == null) { window.cbsiSlotConfigs = {}; }
cbsiSlotConfigs[“Twitch_DirLeaderv2”] = {
‘SP’: ’15’,
‘POS’: ‘300’,
‘WIDTH’: ‘970’,
‘HEIGHT’: ’66’,
‘AD_SZ’: ‘728wX90h’,
‘CALLBACK’: {
onload: function(params) {
if (params.isBlank === “1”) {
$(“#Twitch_DirLeaderv2_holder”).parents().find(“.advertisement”).addClass(“hidden_ad”);
}
}
}
};
//]]>
</script>[/code]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@rnd_meAug 20.2012 — those are template variable placeholders. notice the non-js <script> block?

looks like a mustache or handlebars template to me, but there's lots of different ones...

the actual values typically come from an object, typically provided by jsonp/ajax.
Copy linkTweet thisAlerts:
@chopficaroauthorAug 20.2012 — ok so how do i find the values for those variables for a particular search? the browser knows what they are so there must be a way for me to get them by looking at the source code
×

Success!

Help @chopficaro spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...