mustache-js-rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mustache-js-rails might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56d1fc6eb95a8b171e329818f06c5a188be53beb
4
- data.tar.gz: ffcb0eab2dddc337c074fae69849081c94c53368
3
+ metadata.gz: c3e1cd0d6a67d92f643fb3a05119d4b845a068d7
4
+ data.tar.gz: 1abff9d3ae9199596c18766fda243306a02be4dd
5
5
  SHA512:
6
- metadata.gz: c8b68ebc4f88469f4bd6bc59a06cc717875c733595af297327dbdb42d6a1d093c79a0734eb96878fc5489284ed1706e57eb53852575c90b3760813b0d8aa94a3
7
- data.tar.gz: 9834df72cdcd1ae66e4915cc7c03673f38fa3c9f40d85db81ad7e51ee289fbf309137f2589d450f9b56e8e151e003f3061fd7135e0f35e71f05aad30d4e4d40b
6
+ metadata.gz: 876b003a7f7c62adaa32b7738db56670ea80d6cbf1d708e830a35ff5626be06a60bb344da87a877e11ec2dea479e8e4d890e39769274b24d8a3165d11a62e170
7
+ data.tar.gz: 6f2a30e9e8ad3eab5a5d18f85341c91db4ec2b4ad1a9678e31936b86a25245cb0e06bedd5059448aca9093536e846e74a1db2df8acff44a93104857e57a1005d
@@ -1,3 +1,3 @@
1
1
  module MustacheJsRails
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,746 +1,213 @@
1
-
2
-
3
-
4
- <!DOCTYPE html>
5
- <html>
6
- <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
7
- <meta charset='utf-8'>
8
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
9
- <title>jquery-Mustache/jquery.mustache.js at v0.2.7 · jonnyreeves/jquery-Mustache · GitHub</title>
10
- <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
11
- <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
12
- <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png" />
13
- <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png" />
14
- <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" />
15
- <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" />
16
- <link rel="logo" type="image/svg" href="http://github-media-downloads.s3.amazonaws.com/github-logo.svg" />
17
- <link rel="assets" href="https://a248.e.akamai.net/assets.github.com/">
18
- <link rel="xhr-socket" href="/_sockets" />
19
-
20
-
21
-
22
- <meta name="msapplication-TileImage" content="/windows-tile.png" />
23
- <meta name="msapplication-TileColor" content="#ffffff" />
24
- <meta name="selected-link" value="repo_source" data-pjax-transient />
25
- <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" />
26
-
27
-
28
-
29
- <link rel="icon" type="image/x-icon" href="/favicon.ico" />
30
-
31
- <meta content="authenticity_token" name="csrf-param" />
32
- <meta content="MFBvnzikbPhLyIfg9epN1+ioGDTrXegUPxXTrMDlAkI=" name="csrf-token" />
33
-
34
- <link href="https://a248.e.akamai.net/assets.github.com/assets/github-0c2e6b2f619f4aafd0dc861f56d66b8fc3b130eb.css" media="all" rel="stylesheet" type="text/css" />
35
- <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-149b0b090f3d6d56cf335d40cbfa1b7a15869f26.css" media="all" rel="stylesheet" type="text/css" />
36
-
37
-
38
-
39
- <script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-4c434fa1705bf526e191eec0cd8fab1a5ce3e326.js" type="text/javascript"></script>
40
- <script src="https://a248.e.akamai.net/assets.github.com/assets/github-1d3dcfe418be5cc86b6add463632b9e2cfe0cd0d.js" type="text/javascript"></script>
41
-
42
- <meta http-equiv="x-pjax-version" content="5358865310447c79347ea30bb9fd8280">
43
-
44
- <link data-pjax-transient rel='permalink' href='/jonnyreeves/jquery-Mustache/blob/9b04e360b9718cde04f2f4c5b36f507303bce575/jquery.mustache.js'>
45
- <meta property="og:title" content="jquery-Mustache"/>
46
- <meta property="og:type" content="githubog:gitrepository"/>
47
- <meta property="og:url" content="https://github.com/jonnyreeves/jquery-Mustache"/>
48
- <meta property="og:image" content="https://secure.gravatar.com/avatar/b9fafe59efd9e0c582566860242dd7a4?s=420&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"/>
49
- <meta property="og:site_name" content="GitHub"/>
50
- <meta property="og:description" content="jquery-Mustache - Mustache templating plugin for jQuery"/>
51
- <meta property="twitter:card" content="summary"/>
52
- <meta property="twitter:site" content="@GitHub">
53
- <meta property="twitter:title" content="jonnyreeves/jquery-Mustache"/>
54
-
55
- <meta name="description" content="jquery-Mustache - Mustache templating plugin for jQuery" />
56
-
57
-
58
- <meta content="200185" name="octolytics-dimension-user_id" /><meta content="jonnyreeves" name="octolytics-dimension-user_login" /><meta content="3422568" name="octolytics-dimension-repository_id" /><meta content="jonnyreeves/jquery-Mustache" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="3422568" name="octolytics-dimension-repository_network_root_id" /><meta content="jonnyreeves/jquery-Mustache" name="octolytics-dimension-repository_network_root_nwo" />
59
- <link href="https://github.com/jonnyreeves/jquery-Mustache/commits/v0.2.7.atom" rel="alternate" title="Recent Commits to jquery-Mustache:v0.2.7" type="application/atom+xml" />
60
-
61
- </head>
62
-
63
-
64
- <body class="logged_out page-blob vis-public env-production ">
65
- <div id="wrapper">
66
-
67
-
68
-
69
-
70
-
71
-
72
- <div class="header header-logged-out">
73
- <div class="container clearfix">
74
-
75
- <a class="header-logo-wordmark" href="https://github.com/">Github</a>
76
-
77
- <div class="header-actions">
78
- <a class="button primary" href="/signup">Sign up</a>
79
- <a class="button" href="/login?return_to=%2Fjonnyreeves%2Fjquery-Mustache%2Fblob%2Fv0.2.7%2Fjquery.mustache.js">Sign in</a>
80
- </div>
81
-
82
- <div class="command-bar js-command-bar in-repository">
83
-
84
-
85
- <ul class="top-nav">
86
- <li class="explore"><a href="/explore">Explore</a></li>
87
- <li class="features"><a href="/features">Features</a></li>
88
- <li class="enterprise"><a href="http://enterprise.github.com/">Enterprise</a></li>
89
- <li class="blog"><a href="/blog">Blog</a></li>
90
- </ul>
91
- <form accept-charset="UTF-8" action="/search" class="command-bar-form" id="top_search_form" method="get">
92
- <a href="/search/advanced" class="advanced-search-icon tooltipped downwards command-bar-search" id="advanced_search" title="Advanced search"><span class="octicon octicon-gear "></span></a>
93
-
94
- <input type="text" data-hotkey="/ s" name="q" id="js-command-bar-field" placeholder="Search or type a command" tabindex="1" autocapitalize="off"
95
-
96
- data-repo="jonnyreeves/jquery-Mustache"
97
- data-branch="v0.2.7"
98
- data-sha="306e3ec6123b49cff44f42c422c24e895bac60d9"
99
- >
100
-
101
- <input type="hidden" name="nwo" value="jonnyreeves/jquery-Mustache" />
102
-
103
- <div class="select-menu js-menu-container js-select-menu search-context-select-menu">
104
- <span class="minibutton select-menu-button js-menu-target">
105
- <span class="js-select-button">This repository</span>
106
- </span>
107
-
108
- <div class="select-menu-modal-holder js-menu-content js-navigation-container">
109
- <div class="select-menu-modal">
110
-
111
- <div class="select-menu-item js-navigation-item selected">
112
- <span class="select-menu-item-icon octicon octicon-check"></span>
113
- <input type="radio" class="js-search-this-repository" name="search_target" value="repository" checked="checked" />
114
- <div class="select-menu-item-text js-select-button-text">This repository</div>
115
- </div> <!-- /.select-menu-item -->
116
-
117
- <div class="select-menu-item js-navigation-item">
118
- <span class="select-menu-item-icon octicon octicon-check"></span>
119
- <input type="radio" name="search_target" value="global" />
120
- <div class="select-menu-item-text js-select-button-text">All repositories</div>
121
- </div> <!-- /.select-menu-item -->
122
-
123
- </div>
124
- </div>
125
- </div>
126
-
127
- <span class="octicon help tooltipped downwards" title="Show command bar help">
128
- <span class="octicon octicon-question"></span>
129
- </span>
130
-
131
-
132
- <input type="hidden" name="ref" value="cmdform">
133
-
134
- <div class="divider-vertical"></div>
135
-
136
- </form>
137
- </div>
138
-
139
- </div>
140
- </div>
141
-
142
-
143
-
144
-
145
-
146
- <div class="site hfeed" itemscope itemtype="http://schema.org/WebPage">
147
- <div class="hentry">
148
-
149
- <div class="pagehead repohead instapaper_ignore readability-menu ">
150
- <div class="container">
151
- <div class="title-actions-bar">
152
-
153
-
154
- <ul class="pagehead-actions">
155
-
156
-
157
-
158
- <li>
159
- <a href="/login?return_to=%2Fjonnyreeves%2Fjquery-Mustache"
160
- class="minibutton with-count js-toggler-target star-button entice tooltipped upwards"
161
- title="You must be signed in to use this feature" rel="nofollow">
162
- <span class="octicon octicon-star"></span>Star
163
- </a>
164
- <a class="social-count js-social-count" href="/jonnyreeves/jquery-Mustache/stargazers">
165
- 76
166
- </a>
167
- </li>
168
- <li>
169
- <a href="/login?return_to=%2Fjonnyreeves%2Fjquery-Mustache"
170
- class="minibutton with-count js-toggler-target fork-button entice tooltipped upwards"
171
- title="You must be signed in to fork a repository" rel="nofollow">
172
- <span class="octicon octicon-git-branch"></span>Fork
173
- </a>
174
- <a href="/jonnyreeves/jquery-Mustache/network" class="social-count">
175
- 34
176
- </a>
177
- </li>
178
- </ul>
179
-
180
- <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
181
- <span class="repo-label"><span>public</span></span>
182
- <span class="mega-octicon octicon-repo"></span>
183
- <span class="author vcard">
184
- <a href="/jonnyreeves" class="url fn" itemprop="url" rel="author">
185
- <span itemprop="title">jonnyreeves</span>
186
- </a></span> /
187
- <strong><a href="/jonnyreeves/jquery-Mustache" class="js-current-repository">jquery-Mustache</a></strong>
188
- </h1>
189
- </div>
190
-
191
-
192
- <ul class="tabs">
193
- <li class="pulse-nav"><a href="/jonnyreeves/jquery-Mustache/pulse" class="js-selected-navigation-item " data-selected-links="pulse /jonnyreeves/jquery-Mustache/pulse" rel="nofollow"><span class="octicon octicon-pulse"></span></a></li>
194
- <li><a href="/jonnyreeves/jquery-Mustache/tree/v0.2.7" class="js-selected-navigation-item selected" data-selected-links="repo_source repo_downloads repo_commits repo_tags repo_branches /jonnyreeves/jquery-Mustache/tree/v0.2.7">Code</a></li>
195
- <li><a href="/jonnyreeves/jquery-Mustache/network" class="js-selected-navigation-item " data-selected-links="repo_network /jonnyreeves/jquery-Mustache/network">Network</a></li>
196
- <li><a href="/jonnyreeves/jquery-Mustache/pulls" class="js-selected-navigation-item " data-selected-links="repo_pulls /jonnyreeves/jquery-Mustache/pulls">Pull Requests <span class='counter'>1</span></a></li>
197
-
198
- <li><a href="/jonnyreeves/jquery-Mustache/issues" class="js-selected-navigation-item " data-selected-links="repo_issues /jonnyreeves/jquery-Mustache/issues">Issues <span class='counter'>7</span></a></li>
199
-
200
- <li><a href="/jonnyreeves/jquery-Mustache/wiki" class="js-selected-navigation-item " data-selected-links="repo_wiki /jonnyreeves/jquery-Mustache/wiki">Wiki</a></li>
201
-
202
-
203
- <li><a href="/jonnyreeves/jquery-Mustache/graphs" class="js-selected-navigation-item " data-selected-links="repo_graphs repo_contributors /jonnyreeves/jquery-Mustache/graphs">Graphs</a></li>
204
-
205
-
206
- </ul>
207
-
208
- <div class="tabnav">
209
-
210
- <span class="tabnav-right">
211
- <ul class="tabnav-tabs">
212
- <li><a href="/jonnyreeves/jquery-Mustache/tags" class="js-selected-navigation-item tabnav-tab" data-selected-links="repo_tags /jonnyreeves/jquery-Mustache/tags">Tags <span class="counter ">5</span></a></li>
213
- </ul>
214
- </span>
215
-
216
- <div class="tabnav-widget scope">
217
-
218
-
219
- <div class="select-menu js-menu-container js-select-menu js-branch-menu">
220
- <a class="minibutton select-menu-button js-menu-target" data-hotkey="w" data-ref="v0.2.7">
221
- <span class="octicon octicon-tag"></span>
222
- <i>tag:</i>
223
- <span class="js-select-button">v0.2.7</span>
224
- </a>
225
-
226
- <div class="select-menu-modal-holder js-menu-content js-navigation-container">
227
-
228
- <div class="select-menu-modal">
229
- <div class="select-menu-header">
230
- <span class="select-menu-title">Switch branches/tags</span>
231
- <span class="octicon octicon-remove-close js-menu-close"></span>
232
- </div> <!-- /.select-menu-header -->
233
-
234
- <div class="select-menu-filters">
235
- <div class="select-menu-text-filter">
236
- <input type="text" id="commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">
237
- </div>
238
- <div class="select-menu-tabs">
239
- <ul>
240
- <li class="select-menu-tab">
241
- <a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>
242
- </li>
243
- <li class="select-menu-tab">
244
- <a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>
245
- </li>
246
- </ul>
247
- </div><!-- /.select-menu-tabs -->
248
- </div><!-- /.select-menu-filters -->
249
-
250
- <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket css-truncate" data-tab-filter="branches">
251
-
252
- <div data-filterable-for="commitish-filter-field" data-filterable-type="substring">
253
-
254
- <div class="select-menu-item js-navigation-item ">
255
- <span class="select-menu-item-icon octicon octicon-check"></span>
256
- <a href="/jonnyreeves/jquery-Mustache/blob/0.2-dev/jquery.mustache.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.2-dev" rel="nofollow" title="0.2-dev">0.2-dev</a>
257
- </div> <!-- /.select-menu-item -->
258
- <div class="select-menu-item js-navigation-item ">
259
- <span class="select-menu-item-icon octicon octicon-check"></span>
260
- <a href="/jonnyreeves/jquery-Mustache/blob/0.3-dev/jquery.mustache.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="0.3-dev" rel="nofollow" title="0.3-dev">0.3-dev</a>
261
- </div> <!-- /.select-menu-item -->
262
- <div class="select-menu-item js-navigation-item ">
263
- <span class="select-menu-item-icon octicon octicon-check"></span>
264
- <a href="/jonnyreeves/jquery-Mustache/blob/master/jquery.mustache.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="master" rel="nofollow" title="master">master</a>
265
- </div> <!-- /.select-menu-item -->
266
- </div>
267
-
268
- <div class="select-menu-no-results">Nothing to show</div>
269
- </div> <!-- /.select-menu-list -->
270
-
271
-
272
- <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket css-truncate" data-tab-filter="tags">
273
- <div data-filterable-for="commitish-filter-field" data-filterable-type="substring">
274
-
275
- <div class="select-menu-item js-navigation-item selected">
276
- <span class="select-menu-item-icon octicon octicon-check"></span>
277
- <a href="/jonnyreeves/jquery-Mustache/blob/v0.2.7/jquery.mustache.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v0.2.7" rel="nofollow" title="v0.2.7">v0.2.7</a>
278
- </div> <!-- /.select-menu-item -->
279
- <div class="select-menu-item js-navigation-item ">
280
- <span class="select-menu-item-icon octicon octicon-check"></span>
281
- <a href="/jonnyreeves/jquery-Mustache/blob/v0.2.6/jquery.mustache.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v0.2.6" rel="nofollow" title="v0.2.6">v0.2.6</a>
282
- </div> <!-- /.select-menu-item -->
283
- <div class="select-menu-item js-navigation-item ">
284
- <span class="select-menu-item-icon octicon octicon-check"></span>
285
- <a href="/jonnyreeves/jquery-Mustache/blob/v0.2.5/jquery.mustache.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v0.2.5" rel="nofollow" title="v0.2.5">v0.2.5</a>
286
- </div> <!-- /.select-menu-item -->
287
- <div class="select-menu-item js-navigation-item ">
288
- <span class="select-menu-item-icon octicon octicon-check"></span>
289
- <a href="/jonnyreeves/jquery-Mustache/blob/v0.2.4/jquery.mustache.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v0.2.4" rel="nofollow" title="v0.2.4">v0.2.4</a>
290
- </div> <!-- /.select-menu-item -->
291
- <div class="select-menu-item js-navigation-item ">
292
- <span class="select-menu-item-icon octicon octicon-check"></span>
293
- <a href="/jonnyreeves/jquery-Mustache/blob/v0.2.3/jquery.mustache.js" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="v0.2.3" rel="nofollow" title="v0.2.3">v0.2.3</a>
294
- </div> <!-- /.select-menu-item -->
295
- </div>
296
-
297
- <div class="select-menu-no-results">Nothing to show</div>
298
-
299
- </div> <!-- /.select-menu-list -->
300
-
301
- </div> <!-- /.select-menu-modal -->
302
- </div> <!-- /.select-menu-modal-holder -->
303
- </div> <!-- /.select-menu -->
304
-
305
- </div> <!-- /.scope -->
306
-
307
- <ul class="tabnav-tabs">
308
- <li><a href="/jonnyreeves/jquery-Mustache/tree/v0.2.7" class="selected js-selected-navigation-item tabnav-tab" data-selected-links="repo_source /jonnyreeves/jquery-Mustache/tree/v0.2.7">Files</a></li>
309
- <li><a href="/jonnyreeves/jquery-Mustache/commits/v0.2.7" class="js-selected-navigation-item tabnav-tab" data-selected-links="repo_commits /jonnyreeves/jquery-Mustache/commits/v0.2.7">Commits</a></li>
310
- <li><a href="/jonnyreeves/jquery-Mustache/branches" class="js-selected-navigation-item tabnav-tab" data-selected-links="repo_branches /jonnyreeves/jquery-Mustache/branches" rel="nofollow">Branches <span class="counter ">3</span></a></li>
311
- </ul>
312
-
313
- </div>
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
- </div>
322
- </div><!-- /.repohead -->
323
-
324
- <div id="js-repo-pjax-container" class="container context-loader-container" data-pjax-container>
325
-
326
-
327
-
328
- <!-- blob contrib key: blob_contributors:v21:3c85194045e22247c16364d163697b53 -->
329
- <!-- blob contrib frag key: views10/v8/blob_contributors:v21:3c85194045e22247c16364d163697b53 -->
330
-
331
- <div id="slider">
332
- <div class="frame-meta">
333
-
334
- <p title="This is a placeholder element" class="js-history-link-replace hidden"></p>
335
-
336
- <a href="/jonnyreeves/jquery-Mustache/find/v0.2.7" class="js-slide-to" data-hotkey="t" style="display:none">Show File Finder</a>
337
-
338
- <div class="breadcrumb">
339
- <span class='bold'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/jonnyreeves/jquery-Mustache/tree/v0.2.7" class="js-slide-to" data-branch="v0.2.7" data-direction="back" itemscope="url"><span itemprop="title">jquery-Mustache</span></a></span></span><span class="separator"> / </span><strong class="final-path">jquery.mustache.js</strong> <span class="js-zeroclipboard zeroclipboard-button" data-clipboard-text="jquery.mustache.js" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
340
- </div>
341
-
342
-
343
-
344
- <div class="commit file-history-tease">
345
- <img class="main-avatar" height="24" src="https://secure.gravatar.com/avatar/b9fafe59efd9e0c582566860242dd7a4?s=140&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="24" />
346
- <span class="author"><a href="/jonnyreeves" rel="author">jonnyreeves</a></span>
347
- <time class="js-relative-date" datetime="2013-01-30T14:16:41-08:00" title="2013-01-30 14:16:41">January 30, 2013</time>
348
- <div class="commit-title">
349
- <a href="/jonnyreeves/jquery-Mustache/commit/9b04e360b9718cde04f2f4c5b36f507303bce575" class="message">Fixed Issue</a> <a href="https://github.com/jonnyreeves/jquery-Mustache/issues/16" class="issue-link" title="Work with all possible IDs">#16</a> <a href="/jonnyreeves/jquery-Mustache/commit/9b04e360b9718cde04f2f4c5b36f507303bce575" class="message">- changed addFromDom() selector logic.</a>
350
- </div>
351
-
352
- <div class="participation">
353
- <p class="quickstat"><a href="#blob_contributors_box" rel="facebox"><strong>1</strong> contributor</a></p>
354
-
355
- </div>
356
- <div id="blob_contributors_box" style="display:none">
357
- <h2 class="facebox-header">Users who have contributed to this file</h2>
358
- <ul class="facebox-user-list">
359
- <li class="facebox-user-list-item">
360
- <img height="24" src="https://secure.gravatar.com/avatar/b9fafe59efd9e0c582566860242dd7a4?s=140&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="24" />
361
- <a href="/jonnyreeves">jonnyreeves</a>
362
- </li>
363
- </ul>
364
- </div>
365
- </div>
366
-
367
-
368
- </div><!-- ./.frame-meta -->
369
-
370
- <div class="frames">
371
- <div class="frame" data-permalink-url="/jonnyreeves/jquery-Mustache/blob/9b04e360b9718cde04f2f4c5b36f507303bce575/jquery.mustache.js" data-title="jquery-Mustache/jquery.mustache.js at v0.2.7 · jonnyreeves/jquery-Mustache · GitHub" data-type="blob">
372
-
373
- <div id="files" class="bubble">
374
- <div class="file">
375
- <div class="meta">
376
- <div class="info">
377
- <span class="icon"><b class="octicon octicon-file-text"></b></span>
378
- <span class="mode" title="File Mode">file</span>
379
- <span>213 lines (188 sloc)</span>
380
- <span>6.671 kb</span>
381
- </div>
382
- <div class="actions">
383
- <div class="button-group">
384
- <a class="minibutton js-entice" href=""
385
- data-entice="You must be signed in and on a branch to make or propose changes">Edit</a>
386
- <a href="/jonnyreeves/jquery-Mustache/raw/v0.2.7/jquery.mustache.js" class="button minibutton " id="raw-url">Raw</a>
387
- <a href="/jonnyreeves/jquery-Mustache/blame/v0.2.7/jquery.mustache.js" class="button minibutton ">Blame</a>
388
- <a href="/jonnyreeves/jquery-Mustache/commits/v0.2.7/jquery.mustache.js" class="button minibutton " rel="nofollow">History</a>
389
- </div><!-- /.button-group -->
390
- </div><!-- /.actions -->
391
-
392
- </div>
393
- <div class="blob-wrapper data type-javascript js-blob-data">
394
- <table class="file-code file-diff">
395
- <tr class="file-code-line">
396
- <td class="blob-line-nums">
397
- <span id="L1" rel="#L1">1</span>
398
- <span id="L2" rel="#L2">2</span>
399
- <span id="L3" rel="#L3">3</span>
400
- <span id="L4" rel="#L4">4</span>
401
- <span id="L5" rel="#L5">5</span>
402
- <span id="L6" rel="#L6">6</span>
403
- <span id="L7" rel="#L7">7</span>
404
- <span id="L8" rel="#L8">8</span>
405
- <span id="L9" rel="#L9">9</span>
406
- <span id="L10" rel="#L10">10</span>
407
- <span id="L11" rel="#L11">11</span>
408
- <span id="L12" rel="#L12">12</span>
409
- <span id="L13" rel="#L13">13</span>
410
- <span id="L14" rel="#L14">14</span>
411
- <span id="L15" rel="#L15">15</span>
412
- <span id="L16" rel="#L16">16</span>
413
- <span id="L17" rel="#L17">17</span>
414
- <span id="L18" rel="#L18">18</span>
415
- <span id="L19" rel="#L19">19</span>
416
- <span id="L20" rel="#L20">20</span>
417
- <span id="L21" rel="#L21">21</span>
418
- <span id="L22" rel="#L22">22</span>
419
- <span id="L23" rel="#L23">23</span>
420
- <span id="L24" rel="#L24">24</span>
421
- <span id="L25" rel="#L25">25</span>
422
- <span id="L26" rel="#L26">26</span>
423
- <span id="L27" rel="#L27">27</span>
424
- <span id="L28" rel="#L28">28</span>
425
- <span id="L29" rel="#L29">29</span>
426
- <span id="L30" rel="#L30">30</span>
427
- <span id="L31" rel="#L31">31</span>
428
- <span id="L32" rel="#L32">32</span>
429
- <span id="L33" rel="#L33">33</span>
430
- <span id="L34" rel="#L34">34</span>
431
- <span id="L35" rel="#L35">35</span>
432
- <span id="L36" rel="#L36">36</span>
433
- <span id="L37" rel="#L37">37</span>
434
- <span id="L38" rel="#L38">38</span>
435
- <span id="L39" rel="#L39">39</span>
436
- <span id="L40" rel="#L40">40</span>
437
- <span id="L41" rel="#L41">41</span>
438
- <span id="L42" rel="#L42">42</span>
439
- <span id="L43" rel="#L43">43</span>
440
- <span id="L44" rel="#L44">44</span>
441
- <span id="L45" rel="#L45">45</span>
442
- <span id="L46" rel="#L46">46</span>
443
- <span id="L47" rel="#L47">47</span>
444
- <span id="L48" rel="#L48">48</span>
445
- <span id="L49" rel="#L49">49</span>
446
- <span id="L50" rel="#L50">50</span>
447
- <span id="L51" rel="#L51">51</span>
448
- <span id="L52" rel="#L52">52</span>
449
- <span id="L53" rel="#L53">53</span>
450
- <span id="L54" rel="#L54">54</span>
451
- <span id="L55" rel="#L55">55</span>
452
- <span id="L56" rel="#L56">56</span>
453
- <span id="L57" rel="#L57">57</span>
454
- <span id="L58" rel="#L58">58</span>
455
- <span id="L59" rel="#L59">59</span>
456
- <span id="L60" rel="#L60">60</span>
457
- <span id="L61" rel="#L61">61</span>
458
- <span id="L62" rel="#L62">62</span>
459
- <span id="L63" rel="#L63">63</span>
460
- <span id="L64" rel="#L64">64</span>
461
- <span id="L65" rel="#L65">65</span>
462
- <span id="L66" rel="#L66">66</span>
463
- <span id="L67" rel="#L67">67</span>
464
- <span id="L68" rel="#L68">68</span>
465
- <span id="L69" rel="#L69">69</span>
466
- <span id="L70" rel="#L70">70</span>
467
- <span id="L71" rel="#L71">71</span>
468
- <span id="L72" rel="#L72">72</span>
469
- <span id="L73" rel="#L73">73</span>
470
- <span id="L74" rel="#L74">74</span>
471
- <span id="L75" rel="#L75">75</span>
472
- <span id="L76" rel="#L76">76</span>
473
- <span id="L77" rel="#L77">77</span>
474
- <span id="L78" rel="#L78">78</span>
475
- <span id="L79" rel="#L79">79</span>
476
- <span id="L80" rel="#L80">80</span>
477
- <span id="L81" rel="#L81">81</span>
478
- <span id="L82" rel="#L82">82</span>
479
- <span id="L83" rel="#L83">83</span>
480
- <span id="L84" rel="#L84">84</span>
481
- <span id="L85" rel="#L85">85</span>
482
- <span id="L86" rel="#L86">86</span>
483
- <span id="L87" rel="#L87">87</span>
484
- <span id="L88" rel="#L88">88</span>
485
- <span id="L89" rel="#L89">89</span>
486
- <span id="L90" rel="#L90">90</span>
487
- <span id="L91" rel="#L91">91</span>
488
- <span id="L92" rel="#L92">92</span>
489
- <span id="L93" rel="#L93">93</span>
490
- <span id="L94" rel="#L94">94</span>
491
- <span id="L95" rel="#L95">95</span>
492
- <span id="L96" rel="#L96">96</span>
493
- <span id="L97" rel="#L97">97</span>
494
- <span id="L98" rel="#L98">98</span>
495
- <span id="L99" rel="#L99">99</span>
496
- <span id="L100" rel="#L100">100</span>
497
- <span id="L101" rel="#L101">101</span>
498
- <span id="L102" rel="#L102">102</span>
499
- <span id="L103" rel="#L103">103</span>
500
- <span id="L104" rel="#L104">104</span>
501
- <span id="L105" rel="#L105">105</span>
502
- <span id="L106" rel="#L106">106</span>
503
- <span id="L107" rel="#L107">107</span>
504
- <span id="L108" rel="#L108">108</span>
505
- <span id="L109" rel="#L109">109</span>
506
- <span id="L110" rel="#L110">110</span>
507
- <span id="L111" rel="#L111">111</span>
508
- <span id="L112" rel="#L112">112</span>
509
- <span id="L113" rel="#L113">113</span>
510
- <span id="L114" rel="#L114">114</span>
511
- <span id="L115" rel="#L115">115</span>
512
- <span id="L116" rel="#L116">116</span>
513
- <span id="L117" rel="#L117">117</span>
514
- <span id="L118" rel="#L118">118</span>
515
- <span id="L119" rel="#L119">119</span>
516
- <span id="L120" rel="#L120">120</span>
517
- <span id="L121" rel="#L121">121</span>
518
- <span id="L122" rel="#L122">122</span>
519
- <span id="L123" rel="#L123">123</span>
520
- <span id="L124" rel="#L124">124</span>
521
- <span id="L125" rel="#L125">125</span>
522
- <span id="L126" rel="#L126">126</span>
523
- <span id="L127" rel="#L127">127</span>
524
- <span id="L128" rel="#L128">128</span>
525
- <span id="L129" rel="#L129">129</span>
526
- <span id="L130" rel="#L130">130</span>
527
- <span id="L131" rel="#L131">131</span>
528
- <span id="L132" rel="#L132">132</span>
529
- <span id="L133" rel="#L133">133</span>
530
- <span id="L134" rel="#L134">134</span>
531
- <span id="L135" rel="#L135">135</span>
532
- <span id="L136" rel="#L136">136</span>
533
- <span id="L137" rel="#L137">137</span>
534
- <span id="L138" rel="#L138">138</span>
535
- <span id="L139" rel="#L139">139</span>
536
- <span id="L140" rel="#L140">140</span>
537
- <span id="L141" rel="#L141">141</span>
538
- <span id="L142" rel="#L142">142</span>
539
- <span id="L143" rel="#L143">143</span>
540
- <span id="L144" rel="#L144">144</span>
541
- <span id="L145" rel="#L145">145</span>
542
- <span id="L146" rel="#L146">146</span>
543
- <span id="L147" rel="#L147">147</span>
544
- <span id="L148" rel="#L148">148</span>
545
- <span id="L149" rel="#L149">149</span>
546
- <span id="L150" rel="#L150">150</span>
547
- <span id="L151" rel="#L151">151</span>
548
- <span id="L152" rel="#L152">152</span>
549
- <span id="L153" rel="#L153">153</span>
550
- <span id="L154" rel="#L154">154</span>
551
- <span id="L155" rel="#L155">155</span>
552
- <span id="L156" rel="#L156">156</span>
553
- <span id="L157" rel="#L157">157</span>
554
- <span id="L158" rel="#L158">158</span>
555
- <span id="L159" rel="#L159">159</span>
556
- <span id="L160" rel="#L160">160</span>
557
- <span id="L161" rel="#L161">161</span>
558
- <span id="L162" rel="#L162">162</span>
559
- <span id="L163" rel="#L163">163</span>
560
- <span id="L164" rel="#L164">164</span>
561
- <span id="L165" rel="#L165">165</span>
562
- <span id="L166" rel="#L166">166</span>
563
- <span id="L167" rel="#L167">167</span>
564
- <span id="L168" rel="#L168">168</span>
565
- <span id="L169" rel="#L169">169</span>
566
- <span id="L170" rel="#L170">170</span>
567
- <span id="L171" rel="#L171">171</span>
568
- <span id="L172" rel="#L172">172</span>
569
- <span id="L173" rel="#L173">173</span>
570
- <span id="L174" rel="#L174">174</span>
571
- <span id="L175" rel="#L175">175</span>
572
- <span id="L176" rel="#L176">176</span>
573
- <span id="L177" rel="#L177">177</span>
574
- <span id="L178" rel="#L178">178</span>
575
- <span id="L179" rel="#L179">179</span>
576
- <span id="L180" rel="#L180">180</span>
577
- <span id="L181" rel="#L181">181</span>
578
- <span id="L182" rel="#L182">182</span>
579
- <span id="L183" rel="#L183">183</span>
580
- <span id="L184" rel="#L184">184</span>
581
- <span id="L185" rel="#L185">185</span>
582
- <span id="L186" rel="#L186">186</span>
583
- <span id="L187" rel="#L187">187</span>
584
- <span id="L188" rel="#L188">188</span>
585
- <span id="L189" rel="#L189">189</span>
586
- <span id="L190" rel="#L190">190</span>
587
- <span id="L191" rel="#L191">191</span>
588
- <span id="L192" rel="#L192">192</span>
589
- <span id="L193" rel="#L193">193</span>
590
- <span id="L194" rel="#L194">194</span>
591
- <span id="L195" rel="#L195">195</span>
592
- <span id="L196" rel="#L196">196</span>
593
- <span id="L197" rel="#L197">197</span>
594
- <span id="L198" rel="#L198">198</span>
595
- <span id="L199" rel="#L199">199</span>
596
- <span id="L200" rel="#L200">200</span>
597
- <span id="L201" rel="#L201">201</span>
598
- <span id="L202" rel="#L202">202</span>
599
- <span id="L203" rel="#L203">203</span>
600
- <span id="L204" rel="#L204">204</span>
601
- <span id="L205" rel="#L205">205</span>
602
- <span id="L206" rel="#L206">206</span>
603
- <span id="L207" rel="#L207">207</span>
604
- <span id="L208" rel="#L208">208</span>
605
- <span id="L209" rel="#L209">209</span>
606
- <span id="L210" rel="#L210">210</span>
607
- <span id="L211" rel="#L211">211</span>
608
- <span id="L212" rel="#L212">212</span>
609
- <span id="L213" rel="#L213">213</span>
610
-
611
- </td>
612
- <td class="blob-line-code">
613
- <div class="highlight"><pre><div class='line' id='LC1'><span class="cm">/*! jQuery Mustache - v0.2.7 - 2013-01-30</span></div><div class='line' id='LC2'><span class="cm">* https://github.com/jonnyreeves/jquery-Mustache</span></div><div class='line' id='LC3'><span class="cm">* Copyright (c) 2013 Jonny Reeves; Licensed MIT */</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'><span class="cm">/*global jQuery, window */</span></div><div class='line' id='LC6'><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">$</span><span class="p">,</span> <span class="nb">window</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="s1">&#39;use strict&#39;</span><span class="p">;</span></div><div class='line' id='LC8'><br/></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">var</span> <span class="nx">templateMap</span> <span class="o">=</span> <span class="p">{},</span></div><div class='line' id='LC10'> <span class="nx">instance</span> <span class="o">=</span> <span class="kc">null</span><span class="p">,</span></div><div class='line' id='LC11'> <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span></div><div class='line' id='LC12'> <span class="c1">// Should an error be thrown if an attempt is made to render a non-existent template. If false, the</span></div><div class='line' id='LC13'> <span class="c1">// operation will fail silently.</span></div><div class='line' id='LC14'> <span class="nx">warnOnMissingTemplates</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span></div><div class='line' id='LC15'><br/></div><div class='line' id='LC16'> <span class="c1">// Should an error be thrown if an attempt is made to overwrite a template which has already been added.</span></div><div class='line' id='LC17'> <span class="c1">// If true the original template will be overwritten with the new value.</span></div><div class='line' id='LC18'> <span class="nx">allowOverwrite</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span></div><div class='line' id='LC19'><br/></div><div class='line' id='LC20'> <span class="c1">// The &#39;type&#39; attribute which you use to denoate a Mustache Template in the DOM; eg:</span></div><div class='line' id='LC21'> <span class="c1">// `&lt;script type=&quot;text/html&quot; id=&quot;my-template&quot;&gt;&lt;/script&gt;`</span></div><div class='line' id='LC22'> <span class="nx">domTemplateType</span><span class="o">:</span> <span class="s1">&#39;text/html&#39;</span><span class="p">,</span></div><div class='line' id='LC23'><br/></div><div class='line' id='LC24'> <span class="c1">// Specifies the `dataType` attribute used when external templates are loaded.</span></div><div class='line' id='LC25'> <span class="nx">externalTemplateDataType</span><span class="o">:</span> <span class="s1">&#39;text&#39;</span></div><div class='line' id='LC26'> <span class="p">};</span></div><div class='line' id='LC27'><br/></div><div class='line' id='LC28'> <span class="kd">function</span> <span class="nx">getMustache</span><span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC29'> <span class="c1">// Lazily retrieve Mustache from the window global if it hasn&#39;t been defined by</span></div><div class='line' id='LC30'> <span class="c1">// the User.</span></div><div class='line' id='LC31'> <span class="k">if</span> <span class="p">(</span><span class="nx">instance</span> <span class="o">===</span> <span class="kc">null</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC32'> <span class="nx">instance</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">Mustache</span><span class="p">;</span></div><div class='line' id='LC33'> <span class="k">if</span> <span class="p">(</span><span class="nx">instance</span> <span class="o">===</span> <span class="k">void</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC34'> <span class="nx">$</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s2">&quot;Failed to locate Mustache instance, are you sure it has been loaded?&quot;</span><span class="p">);</span></div><div class='line' id='LC35'> <span class="p">}</span></div><div class='line' id='LC36'> <span class="p">}</span></div><div class='line' id='LC37'> <span class="k">return</span> <span class="nx">instance</span><span class="p">;</span></div><div class='line' id='LC38'> <span class="p">}</span></div><div class='line' id='LC39'><br/></div><div class='line' id='LC40'> <span class="cm">/**</span></div><div class='line' id='LC41'><span class="cm"> * Returns true if the supplied templateName has been added.</span></div><div class='line' id='LC42'><span class="cm"> */</span></div><div class='line' id='LC43'> <span class="kd">function</span> <span class="nx">has</span><span class="p">(</span><span class="nx">templateName</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC44'> <span class="k">return</span> <span class="nx">templateMap</span><span class="p">[</span><span class="nx">templateName</span><span class="p">]</span> <span class="o">!==</span> <span class="k">void</span> <span class="mi">0</span><span class="p">;</span></div><div class='line' id='LC45'> <span class="p">}</span></div><div class='line' id='LC46'><br/></div><div class='line' id='LC47'> <span class="cm">/**</span></div><div class='line' id='LC48'><span class="cm"> * Registers a template so that it can be used by $.Mustache.</span></div><div class='line' id='LC49'><span class="cm"> *</span></div><div class='line' id='LC50'><span class="cm"> * @param templateName A name which uniquely identifies this template.</span></div><div class='line' id='LC51'><span class="cm"> * @param templateHtml The HTML which makes us the template; this will be rendered by Mustache when render()</span></div><div class='line' id='LC52'><span class="cm"> * is invoked.</span></div><div class='line' id='LC53'><span class="cm"> * @throws If options.allowOverwrite is false and the templateName has already been registered.</span></div><div class='line' id='LC54'><span class="cm"> */</span></div><div class='line' id='LC55'> <span class="kd">function</span> <span class="nx">add</span><span class="p">(</span><span class="nx">templateName</span><span class="p">,</span> <span class="nx">templateHtml</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC56'> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">options</span><span class="p">.</span><span class="nx">allowOverwrite</span> <span class="o">&amp;&amp;</span> <span class="nx">has</span><span class="p">(</span><span class="nx">templateName</span><span class="p">))</span> <span class="p">{</span></div><div class='line' id='LC57'> <span class="nx">$</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s1">&#39;TemplateName: &#39;</span> <span class="o">+</span> <span class="nx">templateName</span> <span class="o">+</span> <span class="s1">&#39; is already mapped.&#39;</span><span class="p">);</span></div><div class='line' id='LC58'> <span class="k">return</span><span class="p">;</span></div><div class='line' id='LC59'> <span class="p">}</span></div><div class='line' id='LC60'> <span class="nx">templateMap</span><span class="p">[</span><span class="nx">templateName</span><span class="p">]</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">trim</span><span class="p">(</span><span class="nx">templateHtml</span><span class="p">);</span></div><div class='line' id='LC61'> <span class="p">}</span></div><div class='line' id='LC62'><br/></div><div class='line' id='LC63'> <span class="cm">/**</span></div><div class='line' id='LC64'><span class="cm"> * Adds one or more tempaltes from the DOM using either the supplied templateElementIds or by retrieving all script</span></div><div class='line' id='LC65'><span class="cm"> * tags of the &#39;domTemplateType&#39;. Templates added in this fashion will be registered with their elementId value.</span></div><div class='line' id='LC66'><span class="cm"> *</span></div><div class='line' id='LC67'><span class="cm"> * @param [...templateElementIds] List of element id&#39;s present on the DOM which contain templates to be added; </span></div><div class='line' id='LC68'><span class="cm"> * if none are supplied all script tags that are of the same type as the </span></div><div class='line' id='LC69'><span class="cm"> * `options.domTemplateType` configuration value will be added.</span></div><div class='line' id='LC70'><span class="cm"> */</span></div><div class='line' id='LC71'> <span class="kd">function</span> <span class="nx">addFromDom</span><span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC72'> <span class="kd">var</span> <span class="nx">templateElementIds</span><span class="p">;</span></div><div class='line' id='LC73'><br/></div><div class='line' id='LC74'> <span class="c1">// If no args are supplied, all script blocks will be read from the document.</span></div><div class='line' id='LC75'> <span class="k">if</span> <span class="p">(</span><span class="nx">arguments</span><span class="p">.</span><span class="nx">length</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC76'> <span class="nx">templateElementIds</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;script[type=&quot;&#39;</span> <span class="o">+</span> <span class="nx">options</span><span class="p">.</span><span class="nx">domTemplateType</span> <span class="o">+</span> <span class="s1">&#39;&quot;]&#39;</span><span class="p">).</span><span class="nx">map</span><span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC77'> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">id</span><span class="p">;</span></div><div class='line' id='LC78'> <span class="p">});</span></div><div class='line' id='LC79'> <span class="p">}</span></div><div class='line' id='LC80'> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC81'> <span class="nx">templateElementIds</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">makeArray</span><span class="p">(</span><span class="nx">arguments</span><span class="p">);</span></div><div class='line' id='LC82'> <span class="p">}</span></div><div class='line' id='LC83'><br/></div><div class='line' id='LC84'> <span class="nx">$</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="nx">templateElementIds</span><span class="p">,</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC85'> <span class="kd">var</span> <span class="nx">templateElement</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="k">this</span><span class="p">);</span></div><div class='line' id='LC86'><br/></div><div class='line' id='LC87'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="nx">templateElement</span> <span class="o">===</span> <span class="kc">null</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC88'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">$</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s1">&#39;No such elementId: #&#39;</span> <span class="o">+</span> <span class="k">this</span><span class="p">);</span></div><div class='line' id='LC89'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC90'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC91'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">add</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">$</span><span class="p">(</span><span class="nx">templateElement</span><span class="p">).</span><span class="nx">html</span><span class="p">());</span></div><div class='line' id='LC92'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC93'> <span class="p">});</span></div><div class='line' id='LC94'> <span class="p">}</span></div><div class='line' id='LC95'><br/></div><div class='line' id='LC96'> <span class="cm">/**</span></div><div class='line' id='LC97'><span class="cm"> * Removes a template, the contents of the removed Template will be returned.</span></div><div class='line' id='LC98'><span class="cm"> *</span></div><div class='line' id='LC99'><span class="cm"> * @param templateName The name of the previously registered Mustache template that you wish to remove.</span></div><div class='line' id='LC100'><span class="cm"> * @returns String which represents the raw content of the template.</span></div><div class='line' id='LC101'><span class="cm"> */</span></div><div class='line' id='LC102'> <span class="kd">function</span> <span class="nx">remove</span><span class="p">(</span><span class="nx">templateName</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC103'> <span class="kd">var</span> <span class="nx">result</span> <span class="o">=</span> <span class="nx">templateMap</span><span class="p">[</span><span class="nx">templateName</span><span class="p">];</span></div><div class='line' id='LC104'> <span class="k">delete</span> <span class="nx">templateMap</span><span class="p">[</span><span class="nx">templateName</span><span class="p">];</span></div><div class='line' id='LC105'> <span class="k">return</span> <span class="nx">result</span><span class="p">;</span></div><div class='line' id='LC106'> <span class="p">}</span></div><div class='line' id='LC107'><br/></div><div class='line' id='LC108'> <span class="cm">/**</span></div><div class='line' id='LC109'><span class="cm"> * Removes all templates and tells Mustache to flush its cache.</span></div><div class='line' id='LC110'><span class="cm"> */</span></div><div class='line' id='LC111'> <span class="kd">function</span> <span class="nx">clear</span><span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC112'> <span class="nx">templateMap</span> <span class="o">=</span> <span class="p">{};</span></div><div class='line' id='LC113'> <span class="nx">getMustache</span><span class="p">().</span><span class="nx">clearCache</span><span class="p">();</span></div><div class='line' id='LC114'> <span class="p">}</span></div><div class='line' id='LC115'><br/></div><div class='line' id='LC116'> <span class="cm">/**</span></div><div class='line' id='LC117'><span class="cm"> * Renders a previously added Mustache template using the supplied templateData object. Note if the supplied</span></div><div class='line' id='LC118'><span class="cm"> * templateName doesn&#39;t exist an empty String will be returned.</span></div><div class='line' id='LC119'><span class="cm"> */</span></div><div class='line' id='LC120'> <span class="kd">function</span> <span class="nx">render</span><span class="p">(</span><span class="nx">templateName</span><span class="p">,</span> <span class="nx">templateData</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC121'> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">has</span><span class="p">(</span><span class="nx">templateName</span><span class="p">))</span> <span class="p">{</span></div><div class='line' id='LC122'> <span class="k">if</span> <span class="p">(</span><span class="nx">options</span><span class="p">.</span><span class="nx">warnOnMissingTemplates</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC123'> <span class="nx">$</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s1">&#39;No template registered for: &#39;</span> <span class="o">+</span> <span class="nx">templateName</span><span class="p">);</span></div><div class='line' id='LC124'> <span class="p">}</span></div><div class='line' id='LC125'> <span class="k">return</span> <span class="s1">&#39;&#39;</span><span class="p">;</span></div><div class='line' id='LC126'> <span class="p">}</span></div><div class='line' id='LC127'> <span class="k">return</span> <span class="nx">getMustache</span><span class="p">().</span><span class="nx">to_html</span><span class="p">(</span><span class="nx">templateMap</span><span class="p">[</span><span class="nx">templateName</span><span class="p">],</span> <span class="nx">templateData</span><span class="p">,</span> <span class="nx">templateMap</span><span class="p">);</span></div><div class='line' id='LC128'> <span class="p">}</span></div><div class='line' id='LC129'><br/></div><div class='line' id='LC130'> <span class="cm">/**</span></div><div class='line' id='LC131'><span class="cm"> * Loads the external Mustache templates located at the supplied URL and registers them for later use. This method</span></div><div class='line' id='LC132'><span class="cm"> * returns a jQuery Promise and also support an `onComplete` callback.</span></div><div class='line' id='LC133'><span class="cm"> *</span></div><div class='line' id='LC134'><span class="cm"> * @param url URL of the external Mustache template file to load.</span></div><div class='line' id='LC135'><span class="cm"> * @param onComplete Optional callback function which will be invoked when the templates from the supplied URL</span></div><div class='line' id='LC136'><span class="cm"> * have been loaded and are ready for use.</span></div><div class='line' id='LC137'><span class="cm"> * @returns jQuery deferred promise which will complete when the templates have been loaded and are</span></div><div class='line' id='LC138'><span class="cm"> * ready for use.</span></div><div class='line' id='LC139'><span class="cm"> */</span></div><div class='line' id='LC140'> <span class="kd">function</span> <span class="nx">load</span><span class="p">(</span><span class="nx">url</span><span class="p">,</span> <span class="nx">onComplete</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC141'> <span class="k">return</span> <span class="nx">$</span><span class="p">.</span><span class="nx">ajax</span><span class="p">({</span></div><div class='line' id='LC142'> <span class="nx">url</span><span class="o">:</span> <span class="nx">url</span><span class="p">,</span></div><div class='line' id='LC143'> <span class="nx">dataType</span><span class="o">:</span> <span class="nx">options</span><span class="p">.</span><span class="nx">externalTemplateDataType</span></div><div class='line' id='LC144'> <span class="p">}).</span><span class="nx">done</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">templates</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC145'> <span class="nx">$</span><span class="p">(</span><span class="nx">templates</span><span class="p">).</span><span class="nx">filter</span><span class="p">(</span><span class="s1">&#39;script&#39;</span><span class="p">).</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">i</span><span class="p">,</span> <span class="nx">el</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC146'> <span class="nx">add</span><span class="p">(</span><span class="nx">el</span><span class="p">.</span><span class="nx">id</span><span class="p">,</span> <span class="nx">$</span><span class="p">(</span><span class="nx">el</span><span class="p">).</span><span class="nx">html</span><span class="p">());</span></div><div class='line' id='LC147'> <span class="p">});</span></div><div class='line' id='LC148'><br/></div><div class='line' id='LC149'> <span class="k">if</span> <span class="p">(</span><span class="nx">$</span><span class="p">.</span><span class="nx">isFunction</span><span class="p">(</span><span class="nx">onComplete</span><span class="p">))</span> <span class="p">{</span></div><div class='line' id='LC150'> <span class="nx">onComplete</span><span class="p">();</span></div><div class='line' id='LC151'> <span class="p">}</span></div><div class='line' id='LC152'> <span class="p">});</span></div><div class='line' id='LC153'> <span class="p">}</span></div><div class='line' id='LC154'><br/></div><div class='line' id='LC155'> <span class="cm">/**</span></div><div class='line' id='LC156'><span class="cm"> * Returns an Array of templateNames which have been registered and can be retrieved via</span></div><div class='line' id='LC157'><span class="cm"> * $.Mustache.render() or $(element).mustache().</span></div><div class='line' id='LC158'><span class="cm"> */</span></div><div class='line' id='LC159'> <span class="kd">function</span> <span class="nx">templates</span><span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC160'> <span class="k">return</span> <span class="nx">$</span><span class="p">.</span><span class="nx">map</span><span class="p">(</span><span class="nx">templateMap</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">value</span><span class="p">,</span> <span class="nx">key</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC161'> <span class="k">return</span> <span class="nx">key</span><span class="p">;</span></div><div class='line' id='LC162'> <span class="p">});</span></div><div class='line' id='LC163'> <span class="p">}</span></div><div class='line' id='LC164'><br/></div><div class='line' id='LC165'> <span class="c1">// Expose the public methods on jQuery.Mustache</span></div><div class='line' id='LC166'> <span class="nx">$</span><span class="p">.</span><span class="nx">Mustache</span> <span class="o">=</span> <span class="p">{</span></div><div class='line' id='LC167'> <span class="nx">options</span><span class="o">:</span> <span class="nx">options</span><span class="p">,</span></div><div class='line' id='LC168'> <span class="nx">load</span><span class="o">:</span> <span class="nx">load</span><span class="p">,</span></div><div class='line' id='LC169'> <span class="nx">add</span><span class="o">:</span> <span class="nx">add</span><span class="p">,</span></div><div class='line' id='LC170'> <span class="nx">addFromDom</span><span class="o">:</span> <span class="nx">addFromDom</span><span class="p">,</span></div><div class='line' id='LC171'> <span class="nx">remove</span><span class="o">:</span> <span class="nx">remove</span><span class="p">,</span></div><div class='line' id='LC172'> <span class="nx">clear</span><span class="o">:</span> <span class="nx">clear</span><span class="p">,</span></div><div class='line' id='LC173'> <span class="nx">render</span><span class="o">:</span> <span class="nx">render</span><span class="p">,</span></div><div class='line' id='LC174'> <span class="nx">templates</span><span class="o">:</span> <span class="nx">templates</span><span class="p">,</span></div><div class='line' id='LC175'> <span class="nx">instance</span><span class="o">:</span> <span class="nx">instance</span></div><div class='line' id='LC176'> <span class="p">};</span></div><div class='line' id='LC177'><br/></div><div class='line' id='LC178'> <span class="cm">/**</span></div><div class='line' id='LC179'><span class="cm"> * Renders one or more viewModels into the current jQuery element.</span></div><div class='line' id='LC180'><span class="cm"> *</span></div><div class='line' id='LC181'><span class="cm"> * @param templateName The name of the Mustache template you wish to render, Note that the</span></div><div class='line' id='LC182'><span class="cm"> * template must have been previously loaded and / or added.</span></div><div class='line' id='LC183'><span class="cm"> * @param templateData One or more JavaScript objects which will be used to render the Mustache</span></div><div class='line' id='LC184'><span class="cm"> * template.</span></div><div class='line' id='LC185'><span class="cm"> * @param options.method jQuery method to use when rendering, defaults to &#39;append&#39;.</span></div><div class='line' id='LC186'><span class="cm"> */</span></div><div class='line' id='LC187'> <span class="nx">$</span><span class="p">.</span><span class="nx">fn</span><span class="p">.</span><span class="nx">mustache</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">templateName</span><span class="p">,</span> <span class="nx">templateData</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC188'> <span class="kd">var</span> <span class="nx">settings</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">extend</span><span class="p">({</span></div><div class='line' id='LC189'> <span class="nx">method</span><span class="o">:</span> <span class="s1">&#39;append&#39;</span></div><div class='line' id='LC190'> <span class="p">},</span> <span class="nx">options</span><span class="p">);</span></div><div class='line' id='LC191'><br/></div><div class='line' id='LC192'> <span class="kd">var</span> <span class="nx">renderTemplate</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">obj</span><span class="p">,</span> <span class="nx">viewModel</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC193'> <span class="nx">$</span><span class="p">(</span><span class="nx">obj</span><span class="p">)[</span><span class="nx">settings</span><span class="p">.</span><span class="nx">method</span><span class="p">](</span><span class="nx">render</span><span class="p">(</span><span class="nx">templateName</span><span class="p">,</span> <span class="nx">viewModel</span><span class="p">));</span></div><div class='line' id='LC194'> <span class="p">};</span></div><div class='line' id='LC195'><br/></div><div class='line' id='LC196'> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC197'> <span class="kd">var</span> <span class="nx">element</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span></div><div class='line' id='LC198'><br/></div><div class='line' id='LC199'> <span class="c1">// Render a collection of viewModels.</span></div><div class='line' id='LC200'> <span class="k">if</span> <span class="p">(</span><span class="nx">$</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">templateData</span><span class="p">))</span> <span class="p">{</span></div><div class='line' id='LC201'> <span class="nx">$</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="nx">templateData</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC202'> <span class="nx">renderTemplate</span><span class="p">(</span><span class="nx">element</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span></div><div class='line' id='LC203'> <span class="p">});</span></div><div class='line' id='LC204'> <span class="p">}</span></div><div class='line' id='LC205'><br/></div><div class='line' id='LC206'> <span class="c1">// Render a single viewModel.</span></div><div class='line' id='LC207'> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC208'> <span class="nx">renderTemplate</span><span class="p">(</span><span class="nx">element</span><span class="p">,</span> <span class="nx">templateData</span><span class="p">);</span></div><div class='line' id='LC209'> <span class="p">}</span></div><div class='line' id='LC210'> <span class="p">});</span></div><div class='line' id='LC211'> <span class="p">};</span></div><div class='line' id='LC212'><br/></div><div class='line' id='LC213'><span class="p">}(</span><span class="nx">jQuery</span><span class="p">,</span> <span class="nb">window</span><span class="p">));</span></div></pre></div>
614
- </td>
615
- </tr>
616
- </table>
617
- </div>
618
-
619
- </div>
620
- </div>
621
-
622
- <a href="#jump-to-line" rel="facebox[.linejump]" data-hotkey="l" class="js-jump-to-line" style="display:none">Jump to Line</a>
623
- <div id="jump-to-line" style="display:none">
624
- <form accept-charset="UTF-8" class="js-jump-to-line-form">
625
- <input class="linejump-input js-jump-to-line-field" type="text" placeholder="Jump to line&hellip;">
626
- <button type="submit" class="button">Go</button>
627
- </form>
628
- </div>
629
-
630
- </div>
631
- </div>
632
- </div>
633
-
634
- <div id="js-frame-loading-template" class="frame frame-loading large-loading-area" style="display:none;">
635
- <img class="js-frame-loading-spinner" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-128.gif" height="64" width="64">
636
- </div>
637
-
638
-
639
- </div>
640
- </div>
641
- <div class="modal-backdrop"></div>
642
- </div>
643
-
644
- <div id="footer-push"></div><!-- hack for sticky footer -->
645
- </div><!-- end of wrapper - hack for sticky footer -->
646
-
647
- <!-- footer -->
648
- <div id="footer">
649
- <div class="container clearfix">
650
-
651
- <dl class="footer_nav">
652
- <dt>GitHub</dt>
653
- <dd><a href="/about">About us</a></dd>
654
- <dd><a href="/blog">Blog</a></dd>
655
- <dd><a href="/contact">Contact &amp; support</a></dd>
656
- <dd><a href="http://enterprise.github.com/">GitHub Enterprise</a></dd>
657
- <dd><a href="http://status.github.com/">Site status</a></dd>
658
- </dl>
659
-
660
- <dl class="footer_nav">
661
- <dt>Applications</dt>
662
- <dd><a href="http://mac.github.com/">GitHub for Mac</a></dd>
663
- <dd><a href="http://windows.github.com/">GitHub for Windows</a></dd>
664
- <dd><a href="http://eclipse.github.com/">GitHub for Eclipse</a></dd>
665
- <dd><a href="http://mobile.github.com/">GitHub mobile apps</a></dd>
666
- </dl>
667
-
668
- <dl class="footer_nav">
669
- <dt>Services</dt>
670
- <dd><a href="http://get.gaug.es/">Gauges: Web analytics</a></dd>
671
- <dd><a href="http://speakerdeck.com">Speaker Deck: Presentations</a></dd>
672
- <dd><a href="https://gist.github.com">Gist: Code snippets</a></dd>
673
- <dd><a href="http://jobs.github.com/">Job board</a></dd>
674
- </dl>
675
-
676
- <dl class="footer_nav">
677
- <dt>Documentation</dt>
678
- <dd><a href="http://help.github.com/">GitHub Help</a></dd>
679
- <dd><a href="http://developer.github.com/">Developer API</a></dd>
680
- <dd><a href="http://github.github.com/github-flavored-markdown/">GitHub Flavored Markdown</a></dd>
681
- <dd><a href="http://pages.github.com/">GitHub Pages</a></dd>
682
- </dl>
683
-
684
- <dl class="footer_nav">
685
- <dt>More</dt>
686
- <dd><a href="http://training.github.com/">Training</a></dd>
687
- <dd><a href="/edu">Students &amp; teachers</a></dd>
688
- <dd><a href="http://shop.github.com">The Shop</a></dd>
689
- <dd><a href="/plans">Plans &amp; pricing</a></dd>
690
- <dd><a href="http://octodex.github.com/">The Octodex</a></dd>
691
- </dl>
692
-
693
- <hr class="footer-divider">
694
-
695
-
696
- <p class="right">&copy; 2013 <span title="0.04669s from fe4.rs.github.com">GitHub</span>, Inc. All rights reserved.</p>
697
- <a class="left" href="/">
698
- <span class="mega-octicon octicon-mark-github"></span>
699
- </a>
700
- <ul id="legal">
701
- <li><a href="/site/terms">Terms of Service</a></li>
702
- <li><a href="/site/privacy">Privacy</a></li>
703
- <li><a href="/security">Security</a></li>
704
- </ul>
705
-
706
- </div><!-- /.container -->
707
-
708
- </div><!-- /.#footer -->
709
-
710
-
711
- <div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
712
- <div class="fullscreen-container js-fullscreen-container">
713
- <div class="textarea-wrap">
714
- <textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>
715
- <div class="suggester-container">
716
- <div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester"
717
- data-url="/jonnyreeves/jquery-Mustache/suggestions/commit">
718
- </div>
719
- </div>
720
- </div>
721
- </div>
722
- <div class="fullscreen-sidebar">
723
- <a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">
724
- <span class="mega-octicon octicon-screen-normal"></span>
725
- </a>
726
- <a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards"
727
- title="Switch themes">
728
- <span class="octicon octicon-color-mode"></span>
729
- </a>
730
- </div>
731
- </div>
732
-
733
-
734
-
735
- <div id="ajax-error-message" class="flash flash-error">
736
- <span class="octicon octicon-alert"></span>
737
- <a href="#" class="octicon octicon-remove-close close ajax-error-dismiss"></a>
738
- Something went wrong with that request. Please try again.
739
- </div>
740
-
741
-
742
- <span id='server_response_time' data-time='0.04705' data-host='fe4'></span>
743
-
744
- </body>
745
- </html>
746
-
1
+ /*! jQuery Mustache - v0.2.7 - 2013-01-30
2
+ * https://github.com/jonnyreeves/jquery-Mustache
3
+ * Copyright (c) 2013 Jonny Reeves; Licensed MIT */
4
+
5
+ /*global jQuery, window */
6
+ (function ($, window) {
7
+ 'use strict';
8
+
9
+ var templateMap = {},
10
+ instance = null,
11
+ options = {
12
+ // Should an error be thrown if an attempt is made to render a non-existent template. If false, the
13
+ // operation will fail silently.
14
+ warnOnMissingTemplates: false,
15
+
16
+ // Should an error be thrown if an attempt is made to overwrite a template which has already been added.
17
+ // If true the original template will be overwritten with the new value.
18
+ allowOverwrite: true,
19
+
20
+ // The 'type' attribute which you use to denoate a Mustache Template in the DOM; eg:
21
+ // `<script type="text/html" id="my-template"></script>`
22
+ domTemplateType: 'text/html',
23
+
24
+ // Specifies the `dataType` attribute used when external templates are loaded.
25
+ externalTemplateDataType: 'text'
26
+ };
27
+
28
+ function getMustache() {
29
+ // Lazily retrieve Mustache from the window global if it hasn't been defined by
30
+ // the User.
31
+ if (instance === null) {
32
+ instance = window.Mustache;
33
+ if (instance === void 0) {
34
+ $.error("Failed to locate Mustache instance, are you sure it has been loaded?");
35
+ }
36
+ }
37
+ return instance;
38
+ }
39
+
40
+ /**
41
+ * Returns true if the supplied templateName has been added.
42
+ */
43
+ function has(templateName) {
44
+ return templateMap[templateName] !== void 0;
45
+ }
46
+
47
+ /**
48
+ * Registers a template so that it can be used by $.Mustache.
49
+ *
50
+ * @param templateName A name which uniquely identifies this template.
51
+ * @param templateHtml The HTML which makes us the template; this will be rendered by Mustache when render()
52
+ * is invoked.
53
+ * @throws If options.allowOverwrite is false and the templateName has already been registered.
54
+ */
55
+ function add(templateName, templateHtml) {
56
+ if (!options.allowOverwrite && has(templateName)) {
57
+ $.error('TemplateName: ' + templateName + ' is already mapped.');
58
+ return;
59
+ }
60
+ templateMap[templateName] = $.trim(templateHtml);
61
+ }
62
+
63
+ /**
64
+ * Adds one or more tempaltes from the DOM using either the supplied templateElementIds or by retrieving all script
65
+ * tags of the 'domTemplateType'. Templates added in this fashion will be registered with their elementId value.
66
+ *
67
+ * @param [...templateElementIds] List of element id's present on the DOM which contain templates to be added;
68
+ * if none are supplied all script tags that are of the same type as the
69
+ * `options.domTemplateType` configuration value will be added.
70
+ */
71
+ function addFromDom() {
72
+ var templateElementIds;
73
+
74
+ // If no args are supplied, all script blocks will be read from the document.
75
+ if (arguments.length === 0) {
76
+ templateElementIds = $('script[type="' + options.domTemplateType + '"]').map(function () {
77
+ return this.id;
78
+ });
79
+ }
80
+ else {
81
+ templateElementIds = $.makeArray(arguments);
82
+ }
83
+
84
+ $.each(templateElementIds, function() {
85
+ var templateElement = document.getElementById(this);
86
+
87
+ if (templateElement === null) {
88
+ $.error('No such elementId: #' + this);
89
+ }
90
+ else {
91
+ add(this, $(templateElement).html());
92
+ }
93
+ });
94
+ }
95
+
96
+ /**
97
+ * Removes a template, the contents of the removed Template will be returned.
98
+ *
99
+ * @param templateName The name of the previously registered Mustache template that you wish to remove.
100
+ * @returns String which represents the raw content of the template.
101
+ */
102
+ function remove(templateName) {
103
+ var result = templateMap[templateName];
104
+ delete templateMap[templateName];
105
+ return result;
106
+ }
107
+
108
+ /**
109
+ * Removes all templates and tells Mustache to flush its cache.
110
+ */
111
+ function clear() {
112
+ templateMap = {};
113
+ getMustache().clearCache();
114
+ }
115
+
116
+ /**
117
+ * Renders a previously added Mustache template using the supplied templateData object. Note if the supplied
118
+ * templateName doesn't exist an empty String will be returned.
119
+ */
120
+ function render(templateName, templateData) {
121
+ if (!has(templateName)) {
122
+ if (options.warnOnMissingTemplates) {
123
+ $.error('No template registered for: ' + templateName);
124
+ }
125
+ return '';
126
+ }
127
+ return getMustache().to_html(templateMap[templateName], templateData, templateMap);
128
+ }
129
+
130
+ /**
131
+ * Loads the external Mustache templates located at the supplied URL and registers them for later use. This method
132
+ * returns a jQuery Promise and also support an `onComplete` callback.
133
+ *
134
+ * @param url URL of the external Mustache template file to load.
135
+ * @param onComplete Optional callback function which will be invoked when the templates from the supplied URL
136
+ * have been loaded and are ready for use.
137
+ * @returns jQuery deferred promise which will complete when the templates have been loaded and are
138
+ * ready for use.
139
+ */
140
+ function load(url, onComplete) {
141
+ return $.ajax({
142
+ url: url,
143
+ dataType: options.externalTemplateDataType
144
+ }).done(function (templates) {
145
+ $(templates).filter('script').each(function (i, el) {
146
+ add(el.id, $(el).html());
147
+ });
148
+
149
+ if ($.isFunction(onComplete)) {
150
+ onComplete();
151
+ }
152
+ });
153
+ }
154
+
155
+ /**
156
+ * Returns an Array of templateNames which have been registered and can be retrieved via
157
+ * $.Mustache.render() or $(element).mustache().
158
+ */
159
+ function templates() {
160
+ return $.map(templateMap, function (value, key) {
161
+ return key;
162
+ });
163
+ }
164
+
165
+ // Expose the public methods on jQuery.Mustache
166
+ $.Mustache = {
167
+ options: options,
168
+ load: load,
169
+ add: add,
170
+ addFromDom: addFromDom,
171
+ remove: remove,
172
+ clear: clear,
173
+ render: render,
174
+ templates: templates,
175
+ instance: instance
176
+ };
177
+
178
+ /**
179
+ * Renders one or more viewModels into the current jQuery element.
180
+ *
181
+ * @param templateName The name of the Mustache template you wish to render, Note that the
182
+ * template must have been previously loaded and / or added.
183
+ * @param templateData One or more JavaScript objects which will be used to render the Mustache
184
+ * template.
185
+ * @param options.method jQuery method to use when rendering, defaults to 'append'.
186
+ */
187
+ $.fn.mustache = function (templateName, templateData, options) {
188
+ var settings = $.extend({
189
+ method: 'append'
190
+ }, options);
191
+
192
+ var renderTemplate = function (obj, viewModel) {
193
+ $(obj)[settings.method](render(templateName, viewModel));
194
+ };
195
+
196
+ return this.each(function () {
197
+ var element = this;
198
+
199
+ // Render a collection of viewModels.
200
+ if ($.isArray(templateData)) {
201
+ $.each(templateData, function () {
202
+ renderTemplate(element, this);
203
+ });
204
+ }
205
+
206
+ // Render a single viewModel.
207
+ else {
208
+ renderTemplate(element, templateData);
209
+ }
210
+ });
211
+ };
212
+
213
+ }(jQuery, window));
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mustache-js-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik