Mercurial Hosting > nabble
comparison src/nabble/modules/ad/ad.naml @ 0:7ecd1a4ef557
add content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Mar 2019 19:15:52 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7ecd1a4ef557 |
---|---|
1 | |
2 <override_macro name="nabble_shared_scripts"> | |
3 <n.overridden/> | |
4 <n.array_of_user_ids var_name="site_admins" group="[n.administrators_group/]"/> | |
5 <script type="text/javascript"> | |
6 var isSafe = <n.is_ad_safe/>; | |
7 var Ads = Ads || {}; | |
8 Ads.text = { | |
9 daysLeft: '<t>Trial period ends in <t.number>$1</t.number> day(s)</t>', | |
10 removeAds: '<t>Remove Ads</t>', | |
11 buyCredits: '<t>Upgrade</t>' | |
12 }; | |
13 $(document).ready(function() { | |
14 if (Nabble.wasCreatedRecently && Nabble.currentCredits == 0 && isSafe) { | |
15 var s = '<div class="weak-color" style="text-align:center;margin:1em;font-size:80%">'; | |
16 s += Ads.text.daysLeft.replace(/\$1/,daysLeft)+' – '; | |
17 s += '<a href="[n.site_payment_path/]">'+(Nabble.isSafe?Ads.text.removeAds:Ads.text.buyCredits)+'</a>'; | |
18 s += '</div>'; | |
19 var isAdmin = Nabble.userId && site_admins.indexOf(Number(Nabble.userId)) >= 0; | |
20 isAdmin && $('div.nabble').append(s); | |
21 } | |
22 }); | |
23 </script> | |
24 <n.visible_for_admins selector="div.no-ads-message"/> | |
25 </override_macro> | |
26 | |
27 <macro name="show_ad" parameters="location" requires="servlet"> | |
28 <n.comment.> | |
29 WARNING: users are NOT allowed to change this macro in order to remove ads from their apps. | |
30 If you want to remove ads, please buy the premium subscription. Also, if you want to place your | |
31 own ads code, please put them in the 'show_custom_ads' macro (your ads will be displayed while | |
32 your premium subscription is active). Please DO NOT try dirty tricks to hide the ads. We may delete | |
33 your site at any time if you do that. | |
34 </n.comment.> | |
35 <n.if.has_ads> | |
36 <then> | |
37 <n.put_in_head.adbayes_script params="[n.adbayes_params_for.location/]"/> | |
38 <script type="text/javascript"> | |
39 Nabble.ads('<n.location/>'); | |
40 </script> | |
41 </then> | |
42 <else> | |
43 <script type="text/javascript"> | |
44 Nabble.noAds('<n.location/>'); | |
45 </script> | |
46 <n.show_custom_ads location="[n.location/]" /> | |
47 </else> | |
48 </n.if.has_ads> | |
49 </macro> | |
50 | |
51 <macro name="show_custom_ads" parameters="location" requires="servlet" > | |
52 <n.comment.> | |
53 Here you can place your own ads and make money with your Nabble application. | |
54 But please remember that you must pay for ad-free credits if you want to remove Nabble's ads. | |
55 </n.comment.> | |
56 </macro> | |
57 | |
58 <macro name="menu_premium_upgrade" requires="node"> | |
59 <n.if.is_in_command name="dropdown"> | |
60 <then> | |
61 dropdown.add('premiumUpgrade', '<n.javascript_string_encode.site_payment_link/>', 'display:none'); | |
62 </then> | |
63 <else> | |
64 <n.set_local_node.this_node/> | |
65 <n.if> | |
66 <condition> | |
67 <n.both> | |
68 <condition1.local_node.is_root/> | |
69 <condition2.both condition1="[n.visitor.can_edit.local_node/]" condition2="[n.not.is_paid_site/]"/> | |
70 </n.both> | |
71 </condition> | |
72 <then> | |
73 NabbleDropdown.show('premiumUpgrade'); | |
74 </then> | |
75 </n.if> | |
76 </else> | |
77 </n.if.is_in_command> | |
78 </macro> | |
79 | |
80 <macro name="ads_widget"> | |
81 <n.widget.> | |
82 <n.show_ad location="widget" /> | |
83 </n.widget.> | |
84 </macro> | |
85 | |
86 <override_macro name="sidebar_widget" requires="node_page,servlet"> | |
87 <n.overridden /> | |
88 <n.ads_widget /> | |
89 </override_macro> | |
90 | |
91 <override_macro name="topic_controls" requires="blog_topic_namespace"> | |
92 <n.overridden /> | |
93 <n.show_ad location="blog_topic"/> | |
94 </override_macro> | |
95 | |
96 <override_macro name="classic_message_cell" requires="node"> | |
97 <n.overridden /> | |
98 <n.if.not.is_blog_topic> | |
99 <then> | |
100 <n.if.is_first_element> | |
101 <then> | |
102 <n.show_ad location="first_classic_message"/> | |
103 </then> | |
104 </n.if.is_first_element> | |
105 <n.if.is_last_element> | |
106 <then> | |
107 <n.if.not.regex_matches pattern='1' text="[n.page_node.descendant_count/]"> | |
108 <then.show_ad location="last_classic_message"/> | |
109 </n.if.not.regex_matches> | |
110 </then> | |
111 </n.if.is_last_element> | |
112 </then> | |
113 </n.if.not.is_blog_topic> | |
114 </override_macro> | |
115 | |
116 <override_macro name="topic_rows" requires="node,forum_topic_namespace,list_view_namespace"> | |
117 <n.overridden /> | |
118 <n.show_ad location="list_bottom"/> | |
119 </override_macro> | |
120 | |
121 <override_macro name="topic_rows" requires="node,forum_topic_namespace,threaded_view_namespace"> | |
122 <n.overridden /> | |
123 <n.show_ad location="threaded_bottom"/> | |
124 </override_macro> | |
125 | |
126 <override_macro name="search_pagination" requires="search"> | |
127 <n.overridden /> | |
128 <n.show_ad location="search_bottom"/> | |
129 </override_macro> | |
130 | |
131 <override_macro name="search_results_header" requires="search"> | |
132 <n.overridden /> | |
133 <script type="text/javascript"> | |
134 var nabble_search_query = '<n.hide_null.get_parameter name="query"/>'; | |
135 </script> | |
136 <n.show_ad location="search_top"/> | |
137 </override_macro> | |
138 | |
139 <override_macro name="app_body_footer"> | |
140 <n.overridden/> | |
141 <n.show_ad location="app_bottom"/> | |
142 </override_macro> | |
143 | |
144 <override_macro name="topic_bottom"> | |
145 <n.overridden/> | |
146 <n.show_ad location="topic_bottom"/> | |
147 </override_macro> | |
148 | |
149 <macro name="ad_notice"> | |
150 <n.new_email.> | |
151 <n.send> | |
152 <to><n.root_node.owner.user_email/></to> | |
153 <subject><t><t.location.root_node.subject/> - Your credits are running out</t></subject> | |
154 <text_part> | |
155 <t>Dear user,</t> | |
156 | |
157 <t><t.location.root_node.subject/> is running out of credits.</t> | |
158 <t>Current Credits</t>: <t><t.number.current_credits/> Credits</t> | |
159 | |
160 <t>For a premium upgrade, please visit:</t> | |
161 <n.base_url/><n.site_payment_path/> | |
162 | |
163 <t>Regards,</t> | |
164 <t>The Nabble team</t> | |
165 </text_part> | |
166 <html_part> | |
167 <t>Dear user,</t><br/> | |
168 <br/> | |
169 <t><t.location.root_node.subject/> is running out of credits.</t><br/> | |
170 <t>Current Credits</t>: <t><t.number.current_credits/> Credits</t><br/> | |
171 <br/> | |
172 <t>For a premium upgrade, please visit:</t><br/> | |
173 <a href="[n.base_url/][n.site_payment_path/]"><n.base_url/><n.site_payment_path/></a><br/> | |
174 <br/> | |
175 <t>Regards,</t><br/> | |
176 <t>Nabble Team</t> | |
177 </html_part> | |
178 </n.send> | |
179 </n.new_email.> | |
180 </macro> | |
181 | |
182 <override_macro name="bottom_scripts"> | |
183 <n.as_html_comments.>Ad.<n.is_ad_safe/> | <n.current_credits/> credits</n.as_html_comments.> | |
184 <script type="text/javascript"> | |
185 Nabble.trk = Nabble.trk || {}; | |
186 Nabble.trk.safe = <n.is_ad_safe/>; | |
187 </script> | |
188 <n.overridden/> | |
189 </override_macro> | |
190 | |
191 <macro name="adbayes_script" parameters="params" requires="ad, servlet"> | |
192 <n.if.not.is_null.adbayes_link> | |
193 <then> | |
194 <script type="text/javascript" src="[n.adbayes_link/][n.hide_null.params/]"></script> | |
195 <script type="text/javascript"> | |
196 Nabble.adbayes(); | |
197 </script> | |
198 </then> | |
199 </n.if.not.is_null.adbayes_link> | |
200 </macro> | |
201 | |
202 <macro name="adbayes_params_for" dot_parameter="location" requires="ad, servlet"> | |
203 <n.switch. value="[n.location/]"> | |
204 <n.case. value="list_bottom"> | |
205 &canonical=<n.encode.use_url_encoder.regex_replace_all text="[n.current_url/]" pattern="-tc(\d+)" replacement="-td$1"/> | |
206 </n.case.> | |
207 <n.case. value="threaded_bottom"> | |
208 &canonical=<n.encode.use_url_encoder.regex_replace_all text="[n.current_url/]" pattern="-tt(\d+)" replacement="-td$1"/> | |
209 </n.case.> | |
210 <n.case. value="search_bottom"> | |
211 &text=<n.encode.use_url_encoder.get_parameter name="query"/> | |
212 </n.case.> | |
213 <n.case. value="search_top"> | |
214 &text=<n.encode.use_url_encoder.get_parameter name="query"/> | |
215 </n.case.> | |
216 </n.switch.> | |
217 </macro> | |
218 | |
219 <override_macro name="javascript_library" requires="servlet"> | |
220 <n.overridden/> | |
221 <n.compress.ad_javascript/> | |
222 </override_macro> | |
223 | |
224 <override_macro name="report_inappropriate_content_submit" requires="servlet"> | |
225 <n.if.is_ad_safe> | |
226 <then.overridden/> | |
227 </n.if.is_ad_safe> | |
228 </override_macro> | |
229 | |
230 <macro name="site_payment_link"> | |
231 <a href="[n.site_payment_path/]"><t>Premium upgrade</t></a> | |
232 </macro> | |
233 | |
234 <macro name="site_payment_path"> | |
235 /template/NamlServlet.jtp?macro=site_payment | |
236 </macro> | |
237 | |
238 <macro name="site_payment"> | |
239 <n.if.visitor.is_authenticated> | |
240 <then> | |
241 <n.redirect_to.site_payment_url/> | |
242 </then> | |
243 <else> | |
244 <n.login.>You must login to upgrade this site.</n.login.> | |
245 </else> | |
246 </n.if.visitor.is_authenticated> | |
247 </macro> | |
248 | |
249 <macro name="payment_confirmed"> | |
250 <n.html> | |
251 <head> | |
252 <meta name="robots" content="noindex,nofollow"/> | |
253 <n.title.><t>Payment Confirmation</t></n.title.> | |
254 </head> | |
255 <body> | |
256 <n.if.confirm_payment customer_id="[n.get_parameter name='c'/]" user="[n.get_parameter name='user'/]" key1="[n.get_parameter name='key1'/]" key2="[n.get_parameter name='key2'/]"> | |
257 <then> | |
258 <h1><t>Payment Confirmed</t></h1> | |
259 <p>Your payment has been confirmed. You can find payment options on your account settings page.</p> | |
260 </then> | |
261 <else> | |
262 <h1><t>Payment Failed</t></h1> | |
263 <p> | |
264 Sorry, but something went wrong with your payment. | |
265 You may send an email to <a href="mailto:payments@nabble.com">payments@nabble.com</a> if you need help. | |
266 </p> | |
267 </else> | |
268 </n.if.confirm_payment> | |
269 </body> | |
270 </n.html> | |
271 </macro> | |
272 | |
273 <override_macro name="authenticated_self_profile_header" requires="user"> | |
274 <n.overridden/> | |
275 <n.if.both condition1="[n.not.is_null.site_payment_cancellation_url/]" condition2="[n.is_paid_site/]"> | |
276 <then> | |
277 <div style="margin-top:.5em"> | |
278 <img src="/images/icon_info.png" class="image16" style="margin:0 1px"/> | |
279 <a href="[n.site_payment_cancellation_url/]" target="_top"><t>Cancel Payment Subscription</t></a> | |
280 </div> | |
281 </then> | |
282 </n.if.both> | |
283 </override_macro> | |
284 | |
285 <macro name="cancelled"> | |
286 <n.html> | |
287 <head> | |
288 <meta name="robots" content="noindex,nofollow"/> | |
289 <n.title.><t>Payment Subscription Cancelled</t></n.title.> | |
290 </head> | |
291 <body> | |
292 <n.update_status customer_id="[n.get_parameter name='c'/]"/> | |
293 <h1><t>Payment Subscription Cancelled</t></h1> | |
294 <p>Your payment subscription has been cancelled and your card has been removed from the billing cycle.</p> | |
295 </body> | |
296 </n.html> | |
297 </macro> |