about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-07-28T14·13+0300
committertazjin <tazjin@tvl.su>2022-07-28T15·16+0000
commit0f1cc9b2bc1a5b24a6d64c783519558395af74ce (patch)
tree188a70c8493c3a60fe6cf289389b9f617dffff83
parentca608d3e9c46c0c713c1fc0ee7e09a2c110c130c (diff)
feat(predlozhnik): monetize r/4335
might as well! if it manages to pay for a beer over the lifetime of
the site, it will have been worth it.

Change-Id: I31ba92ffd4d6e55687f5ee624c44d14d366d0e91
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5990
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
-rw-r--r--users/tazjin/predlozhnik/index.html4
-rw-r--r--users/tazjin/predlozhnik/src/main.rs22
2 files changed, 22 insertions, 4 deletions
diff --git a/users/tazjin/predlozhnik/index.html b/users/tazjin/predlozhnik/index.html
index 631cf4f6da..0252cca0dc 100644
--- a/users/tazjin/predlozhnik/index.html
+++ b/users/tazjin/predlozhnik/index.html
@@ -7,5 +7,9 @@
           href="https://unpkg.com/terminal.css@0.7.2/dist/terminal.min.css" />
     <link data-trunk rel="inline" href="index.css">
     <title>Предложник</title>
+
+    <!-- Yandex.RTB -->
+    <script>window.yaContextCb=window.yaContextCb||[]</script>
+    <script src="https://yandex.ru/ads/system/context.js" async></script>
   </head>
 </html>
diff --git a/users/tazjin/predlozhnik/src/main.rs b/users/tazjin/predlozhnik/src/main.rs
index 1d864a37b9..4f3d7fc605 100644
--- a/users/tazjin/predlozhnik/src/main.rs
+++ b/users/tazjin/predlozhnik/src/main.rs
@@ -248,10 +248,7 @@ impl Component for Модель {
             .map(|п| покажи_падеж(link, self, &вв, *п))
             .collect::<Html>();
 
-        let объяснение = вв
-            .объяснение
-            .map(|exp| exp)
-            .unwrap_or_else(|| html! {});
+        let объяснение = вв.объяснение.map(|exp| exp).unwrap_or_else(|| html! {});
 
         let footer = html! {
             <footer>
@@ -264,6 +261,22 @@ impl Component for Модель {
             </footer>
         };
 
+        let код_рекламы = r#"
+window.yaContextCb.push(()=>{
+  Ya.Context.AdvManager.render({
+    renderTo: 'yandex_rtb_R-A-1773485-1',
+    blockId: 'R-A-1773485-1'
+  })
+})
+"#;
+
+        let реклама = html! {
+            <div id="ad">
+              <div id="yandex_rtb_R-A-1773485-1"></div>
+              <script>{код_рекламы}</script>
+            </div>
+        };
+
         html! {
             <>
                 <div id="header">
@@ -284,6 +297,7 @@ impl Component for Модель {
 
                 {объяснение}
                 {footer}
+                {реклама}
             </>
         }
     }