Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions common.blocks/yandex-metrica/yandex-metrica.bemhtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,16 @@ block('yandex-metrica').replace()(function() {
' var n = d.getElementsByTagName("script")[0],',
' s = d.createElement("script"),',
' f = function () { n.parentNode.insertBefore(s, n); };',
' s.type = "text/javascript";',
' s.async = true;',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text/javascript is default value

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, but why Metrica provides this attribute? May be it brings value for using in old browsers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should care for such old browsers.

' s.src = "https://mc.yandex.ru/metrika/watch.js";',
'',
' if (w.opera == "[object Opera]") {',
' d.addEventListener("DOMContentLoaded", f, false);',
' } else { f(); }',
'})(document, window, "yandex_metrika_callbacks");'
].join('\n');
].join('');

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should safe ~35 bytes :)

noScriptContent = {
tag : 'div',
content : {
tag : 'img',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

div is default value

attrs : {
Expand Down
4 changes: 1 addition & 3 deletions common.blocks/yandex-metrica/yandex-metrica.bh.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,16 @@ module.exports = function (bh) {
' var n = d.getElementsByTagName("script")[0],',
' s = d.createElement("script"),',
' f = function () { n.parentNode.insertBefore(s, n); };',
' s.type = "text/javascript";',
' s.async = true;',
' s.src = "https://mc.yandex.ru/metrika/watch.js";',
'',
' if (w.opera == "[object Opera]") {',
' d.addEventListener("DOMContentLoaded", f, false);',
' } else { f(); }',
'})(document, window, "yandex_metrika_callbacks");'
].join('\n');
].join('');

noScriptContent = {
tag : 'div',
content : {
tag : 'img',
attrs : {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<script>(function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter12345 = new Ya.Metrika({"id":"12345"}); } catch(e) { } }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = "https://mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); }})(document, window, "yandex_metrika_callbacks");</script><noscript><div><img src="//mc.yandex.ru/watch/12345" style="position:absolute; left:-9999px;"/></div></noscript>
<script>(function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter12345 = new Ya.Metrika({"id":"12345"}); } catch(e) { } }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.async = true; s.src = "https://mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); }})(document, window, "yandex_metrika_callbacks");</script><noscript><div><img src="//mc.yandex.ru/watch/12345" style="position:absolute; left:-9999px;"/></div></noscript>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
var n = d.getElementsByTagName("script")[0],
s = d.createElement("script"),
f = function () { n.parentNode.insertBefore(s, n); };
s.type = "text/javascript";
s.async = true;
s.src = "https://mc.yandex.ru/metrika/watch.js";

Expand Down