docs: #337 upgrade google analytics script to its latest one

This commit is contained in:
Hamid Reza Mohammadi 2022-06-30 21:44:46 +04:30
parent 59a7391a07
commit 777429ea21
9 changed files with 284 additions and 311 deletions

View File

@ -155,166 +155,163 @@
<script src="~/dist/jplayer/jquery.jplayer.min.js"></script>
<script src="~/dist/add-on/jplayer.playlist.min.js"></script>
<script>
var verses = [];
var verses = [];
@{
<text>
@Html.Raw($" var normaltext = { (Model.Poem.Verses.Where(v => v.VersePosition == RMuseum.Models.Ganjoor.VersePosition.Paragraph).Any() ? "true" : "false") }")
</text>
for (int i = 0; i < Model.Poem.Verses.Length; i++)
{
@{
<text>
@Html.Raw($"verses[{i}] = '{Model.Poem.Verses[i].Text}';")
@Html.Raw($" var normaltext = { (Model.Poem.Verses.Where(v => v.VersePosition == RMuseum.Models.Ganjoor.VersePosition.Paragraph).Any() ? "true" : "false") }")
</text>
for (int i = 0; i < Model.Poem.Verses.Length; i++)
{
<text>
@Html.Raw($"verses[{i}] = '{Model.Poem.Verses[i].Text}';")
</text>
}
}
}
function prepareclip(xmlfilename, poemtitle, auartist, oggurl, mp3url, verseArray) {
var verseStart = [];
var verseEnd = [];
var verseIndex = [];
var nLastHighlight = -1;
var vCount = 0;
function prepareclip(xmlfilename, poemtitle, auartist, oggurl, mp3url, verseArray) {
var verseStart = [];
var verseEnd = [];
var verseIndex = [];
var nLastHighlight = -1;
var vCount = 0;
audioxmlfiles[0] = xmlfilename;
audioxmlfiles[0] = xmlfilename;
var jlist = new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
}, [
{
title: poemtitle,
artist: auartist,
mp3: mp3url
},
],
{
setmedia: function (event) {
var jlist = new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
}, [
{
title: poemtitle,
artist: auartist,
mp3: mp3url
},
],
{
setmedia: function(event) {
$.ajax({
type: "GET",
url: audioxmlfiles[jlist.current],
dataType: "xml",
success: function (xml) {
var nOneSecondBugFix = 2000;
$(xml).find('OneSecondBugFix').each(function () {
nOneSecondBugFix = parseInt($(xml).find('OneSecondBugFix').text());
$.ajax({
type: "GET",
url: audioxmlfiles[jlist.current],
dataType: "xml",
success: function(xml) {
var nOneSecondBugFix = 2000;
$(xml).find('OneSecondBugFix').each(function() {
nOneSecondBugFix = parseInt($(xml).find('OneSecondBugFix').text());
});
var v = 0;
$(xml).find('SyncInfo').each(function() {
verseStart[v] = parseInt($(this).find('AudioMiliseconds').text()) / nOneSecondBugFix;
verseIndex[v] = parseInt($(this).find('VerseOrder').text());
if (v > 0)
verseEnd[v - 1] = verseStart[v];
v++;
});
v--;
if (v > 1)
verseEnd[v] = verseStart[v] + 2 * (verseEnd[v - 1] - verseStart[v - 1]);
vCount = v;
}
});
var v = 0;
$(xml).find('SyncInfo').each(function () {
verseStart[v] = parseInt($(this).find('AudioMiliseconds').text()) / nOneSecondBugFix;
verseIndex[v] = parseInt($(this).find('VerseOrder').text());
if (v > 0)
verseEnd[v - 1] = verseStart[v];
v++;
});
v--;
if (v > 1)
verseEnd[v] = verseStart[v] + 2 * (verseEnd[v - 1] - verseStart[v - 1]);
vCount = v;
}
},
timeupdate: function(event) { // 4Hz
var curTime = event.jPlayer.status.currentTime;
if (curTime > 0) {
if (normaltext == true) {
for (i = 0; i <= vCount; i++) {
if (curTime >= verseStart[i] && curTime <= verseEnd[i]) {
if (nLastHighlight != verseIndex[i]) {
$('#title1').hide();
$('#title2').hide();
$('#title3').hide();
$('#title4').hide();
$('#normal').text(verseArray[verseIndex[i]]);
$('#verse1div').css("visibility", "hidden");
$('#verse2div').css("visibility", "hidden");
$('#verse1div').hide();
$('#verse2div').hide();
$('#normaldiv').css("visibility", "visible");
}
nLastHighlight = verseIndex[i];
break;
}
}
}
else {
for (i = 0; i <= vCount; i += 2) {
if (curTime >= verseStart[i] && curTime <= verseEnd[i]) {
if (nLastHighlight != verseIndex[i]) {
$('#title1').hide();
$('#title2').hide();
$('#title3').hide();
$('#title4').hide();
$('#verse1').text(verseArray[verseIndex[i]]);
$('#verse2').text(verseArray[verseIndex[i] + 1]);
$('#normaldiv').css("visibility", "hidden");
$('#normaldiv').hide();
$('#verse1div').css("visibility", "visible");
$('#verse2div').css("visibility", "visible");
}
nLastHighlight = verseIndex[i];
break;
}
}
}
}
},
ended: function(event) { // 4Hz
},
swfPath: "dist/jplayer",
supplied: "mp3",
wmode: "window",
useStateClassSkin: true,
autoBlur: false,
smoothPlayBar: true,
keyEnabled: true,
remainingDuration: true,
toggleDuration: true
});
return jlist;
},
timeupdate: function (event) { // 4Hz
var curTime = event.jPlayer.status.currentTime;
if (curTime > 0) {
if (normaltext == true) {
for (i = 0; i <= vCount; i++) {
if (curTime >= verseStart[i] && curTime <= verseEnd[i]) {
}
if (nLastHighlight != verseIndex[i]) {
//<![CDATA[
$(document).ready(function() {
$('#title1').hide();
$('#title2').hide();
$('#title3').hide();
$('#title4').hide();
$('#normal').text(verseArray[verseIndex[i]]);
$('#verse1div').css("visibility", "hidden");
$('#verse2div').css("visibility", "hidden");
$('#verse1div').hide();
$('#verse2div').hide();
$('#normaldiv').css("visibility", "visible");
}
nLastHighlight = verseIndex[i];
break;
}
}
}
else {
for (i = 0; i <= vCount; i += 2) {
if (curTime >= verseStart[i] && curTime <= verseEnd[i]) {
prepareclip('@Html.Raw($"{GanjooRazor.APIRoot.InternetUrl}/api/audio/file/{Model.Recitation.Id}.xml")', '@Model.Recitation.AudioTitle',
'به خوانش @Model.Recitation.AudioArtist', '', '@Model.Recitation.Mp3Url', verses);
if (nLastHighlight != verseIndex[i]) {
$('#title1').hide();
$('#title2').hide();
$('#title3').hide();
$('#title4').hide();
$('#verse1').text(verseArray[verseIndex[i]]);
$('#verse2').text(verseArray[verseIndex[i] + 1]);
$('#normaldiv').css("visibility", "hidden");
$('#normaldiv').hide();
$('#verse1div').css("visibility", "visible");
$('#verse2div').css("visibility", "visible");
}
nLastHighlight = verseIndex[i];
break;
}
}
}
}
},
ended: function (event) { // 4Hz
},
swfPath: "dist/jplayer",
supplied: "mp3",
wmode: "window",
useStateClassSkin: true,
autoBlur: false,
smoothPlayBar: true,
keyEnabled: true,
remainingDuration: true,
toggleDuration: true
});
return jlist;
}
//<![CDATA[
$(document).ready(function () {
prepareclip('@Html.Raw($"{GanjooRazor.APIRoot.InternetUrl}/api/audio/file/{Model.Recitation.Id}.xml")', '@Model.Recitation.AudioTitle',
'به خوانش @Model.Recitation.AudioArtist', '', '@Model.Recitation.Mp3Url', verses);
});
//]]>
});
//]]>
</script>
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
{
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=@(ViewData["GoogleAnalyticsCode"])"></script>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', '@ViewData["GoogleAnalyticsCode"]', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '@ViewData["GoogleAnalyticsCode"]');
</script>
}
}

View File

@ -48,7 +48,7 @@
<input type="submit" value="بیاب" />
</form>
</div><!-- .actionbox -->
</div>
</div>
<!-- #hdr2 -->
@ -109,17 +109,14 @@
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
{
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=@(ViewData["GoogleAnalyticsCode"])"></script>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', '@ViewData["GoogleAnalyticsCode"]', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '@ViewData["GoogleAnalyticsCode"]');
</script>
}
}

View File

@ -85,7 +85,7 @@
<input type="submit" value="بیاب" />
</form>
</div><!-- .actionbox -->
</div>
</div>
<!-- #hdr2 -->
@ -97,47 +97,47 @@
<div class="related-images-frame padding-20px">
<form method="get" id="searchcommentsform">
<input type="text" name="w" id="w" class="width-100per" value="@Model.Query" placeholder="جستجو در @Model.Title" />
@if(Model.Profile != null)
@if (Model.Profile != null)
{
<input type="hidden" id="userid" name="userid" value="@Model.Profile.Id" />
}
<input type="submit" class="width-100per margin-top-5px" value="جستجو در @Model.Title" />
</form>
</div><!-- related-images-frame -->
</div> <!-- sitem actionbo -->
<div class="poem">
<h2>
<a href="@Model.HomeLink">
@Model.Title
</a>
</h2>
@if (Model.Profile != null)
{
<div class="text-align-center">
<small><a href="/hashieha">همهٔ حاشیه‌ها</a></small>
</div>
<div id="profile">
<p>
@Model.Profile.NickName
</div> <!-- sitem actionbo -->
<div class="poem">
<h2>
<a href="@Model.HomeLink">
@Model.Title
</a>
</h2>
@if (Model.Profile != null)
{
<div class="text-align-center">
<small><a href="/hashieha">همهٔ حاشیه‌ها</a></small>
</div>
<div id="profile">
<p>
@Model.Profile.NickName
@if (!string.IsNullOrEmpty(Model.Profile.Website))
@if (!string.IsNullOrEmpty(Model.Profile.Website))
{
<a href="@Model.Profile.Website">🌐</a>
}
@if (Model.CanAdministerUsers)
{
<a href="/Admin/ExamineUser?id=@Model.Profile.Id">#</a>
}
</p>
@if (!string.IsNullOrEmpty(Model.Profile.Bio))
{
<a href="@Model.Profile.Website">🌐</a>
}
@if (Model.CanAdministerUsers)
{
<a href="/Admin/ExamineUser?id=@Model.Profile.Id">#</a>
}
</p>
@if (!string.IsNullOrEmpty(Model.Profile.Bio))
{
@Html.Raw(Model.Profile.Bio)
}
</div>
<hr />
}
}
</div>
<hr />
}
@if (Model.Comments.Count == 0)
{
<p>حاشیه‌ای با مشخصات مورد نظر شما پیدا نشد.</p>
@ -145,37 +145,37 @@
else
foreach (var comment in Model.Comments)
{
<p>
@if (comment.UserId == null)
{
@comment.AuthorName
}
else
{
<a href="/hashieha/?userid=@comment.UserId">@comment.AuthorName</a>
}
<small>
در @comment.CommentDate.ToFriendlyPersianDateTextify()
@if (comment.InReplyTo != null)
{
<text>
@(" ")در پاسخ به @comment.InReplyTo.AuthorName
</text>
}
</small>
@(" ")دربارهٔ <a href="@comment.Poem.UrlSlug#comment-@comment.Id">@comment.Poem.Title</a>:
</p>
@if (comment.CoupletIndex != -1)
<p>
@if (comment.UserId == null)
{
<div class="commentquote">
@comment.CoupletSummary
</div>
@comment.AuthorName
}
<blockquote>
@Html.Raw(comment.HtmlComment)
</blockquote>
<div class="spacer">&nbsp;</div>
<hr />
else
{
<a href="/hashieha/?userid=@comment.UserId">@comment.AuthorName</a>
}
<small>
در @comment.CommentDate.ToFriendlyPersianDateTextify()
@if (comment.InReplyTo != null)
{
<text>
@(" ")در پاسخ به @comment.InReplyTo.AuthorName
</text>
}
</small>
@(" ")دربارهٔ <a href="@comment.Poem.UrlSlug#comment-@comment.Id">@comment.Poem.Title</a>:
</p>
@if (comment.CoupletIndex != -1)
{
<div class="commentquote">
@comment.CoupletSummary
</div>
}
<blockquote>
@Html.Raw(comment.HtmlComment)
</blockquote>
<div class="spacer">&nbsp;</div>
<hr />
}
</div>
@ -197,17 +197,14 @@
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
{
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=@(ViewData["GoogleAnalyticsCode"])"></script>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', '@ViewData["GoogleAnalyticsCode"]', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '@ViewData["GoogleAnalyticsCode"]');
</script>
}
}

View File

@ -22,7 +22,7 @@
</script>
<script src="/js/bk.js?version=29"></script>
@if(Model.GanjoorPage != null && Model.GanjoorPage.NoIndex)
@if (Model.GanjoorPage != null && Model.GanjoorPage.NoIndex)
{
<meta name="robots" content="noindex, nofollow" />
}
@ -33,11 +33,11 @@
}
else
{
<link rel="canonical" href="@Model.CanonicalUrl" />
<link rel="canonical" href="@Model.CanonicalUrl" />
if (Model.IsPoemPage)
{
<script>
$(document).ready(function () {
$(document).ready(function() {
checkWebShareSupport();
btshmr(@Model.GanjoorPage.Id);
checkIfBookmarked(@Model.GanjoorPage.Id);
@ -68,18 +68,18 @@
var nLastHighlight = -1;
var vCount = 0;
var _setXml = function (xmlUrl) {
var _setXml = function(xmlUrl) {
$.ajax({
type: "GET",
url: xmlUrl,
dataType: "xml",
success: function (xml) {
success: function(xml) {
var nOneSecondBugFix = 2000;
$(xml).find('OneSecondBugFix').each(function () {
$(xml).find('OneSecondBugFix').each(function() {
nOneSecondBugFix = parseInt($(xml).find('OneSecondBugFix').text());
});
var v = 0;
$(xml).find('SyncInfo').each(function () {
$(xml).find('SyncInfo').each(function() {
verseStart[v] = parseInt($(this).find('AudioMiliseconds').text()) / nOneSecondBugFix;
verseIndex[v] = parseInt($(this).find('VerseOrder').text());
if (v > 0)
@ -94,7 +94,7 @@
});
}
var _trackTimeChanged = function (audio) {
var _trackTimeChanged = function(audio) {
var currentTime = audio.currentTime;
if (currentTime > 0) {
@ -118,8 +118,8 @@
@foreach (var recitation in Model.GanjoorPage.Poem.Recitations)
{
<text>
narrators.push('@Html.Raw(recitation.AudioArtist)');
audioxmlfiles.push('@($"{GanjooRazor.APIRoot.InternetUrl}/api/audio/file/{recitation.Id}.xml")');
narrators.push('@Html.Raw(recitation.AudioArtist)');
audioxmlfiles.push('@($"{GanjooRazor.APIRoot.InternetUrl}/api/audio/file/{recitation.Id}.xml")');
</text>
}
</script>
@ -152,8 +152,8 @@
if (!string.IsNullOrEmpty(Model.PinterestUrl))
{
<script>
$(function () {
$("a").attr('href', function (i, h) {
$(function() {
$("a").attr('href', function(i, h) {
if (h != null) {
return h + (h.indexOf('?') != -1 ? "&pinterest_url=@Html.Raw(Model.PinterestUrl)" : "?pinterest_url=@Html.Raw(Model.PinterestUrl)");
}
@ -171,10 +171,10 @@
var userNotifiedOnEditInsteadOfComment = false;
function createInformationNotification() {
tinymce.activeEditor.notificationManager.open({
text: 'تمنا می‌کنیم که به جای گوشزد کردن خطاهای املایی و تایپی در حاشیه‌ها از دکمهٔ «ویرایش» استفاده کنید و خطا را تصحیح کنید.',
type: 'info'
});
tinymce.activeEditor.notificationManager.open({
text: 'تمنا می‌کنیم که به جای گوشزد کردن خطاهای املایی و تایپی در حاشیه‌ها از دکمهٔ «ویرایش» استفاده کنید و خطا را تصحیح کنید.',
type: 'info'
});
}
tinymce.init({
@ -189,37 +189,34 @@
paste_strip_class_attributes: true,
a11y_advanced_options: true,
setup: function(editor) {
editor.on('tap', function(e) {
if(userNotifiedOnEditInsteadOfComment == false){
userNotifiedOnEditInsteadOfComment = true;
createInformationNotification();
}
},
);
editor.on('click', function(e) {
if(userNotifiedOnEditInsteadOfComment == false){
userNotifiedOnEditInsteadOfComment = true;
createInformationNotification();
}
},
);
editor.on('tap', function(e) {
if (userNotifiedOnEditInsteadOfComment == false) {
userNotifiedOnEditInsteadOfComment = true;
createInformationNotification();
}
},
);
editor.on('click', function(e) {
if (userNotifiedOnEditInsteadOfComment == false) {
userNotifiedOnEditInsteadOfComment = true;
createInformationNotification();
}
},
);
},
});
</script>
}
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
{
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=@(ViewData["GoogleAnalyticsCode"])"></script>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', '@ViewData["GoogleAnalyticsCode"]', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '@ViewData["GoogleAnalyticsCode"]');
</script>
}

View File

@ -42,7 +42,7 @@
color: '#300',
}
$.getJSON(myGeoJSONPath, function (data) {
$.getJSON(myGeoJSONPath, function(data) {
var map = L.map('map').setView([34, 53.6880], 5);
@ -59,13 +59,13 @@
poetsgroups = @(Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.PoetGroupsWithBirthPlaces, Newtonsoft.Json.Formatting.Indented)));
var popup = new L.Popup();
oms.addListener('click', function (marker) {
oms.addListener('click', function(marker) {
var poetDesc = marker.desc;
var index = $('#rangeInput').val();
for (var i = 0; i < poetsgroups[index].Poets.length; i++) {
if (poetsgroups[index].Poets[i].Name == marker.desc) {
poetDesc = '<a target="_blank" href="' + poetsgroups[index].Poets[i].FullUrl+'">' + poetsgroups[index].Poets[i].Name + '</a>'
poetDesc = '<a target="_blank" href="' + poetsgroups[index].Poets[i].FullUrl + '">' + poetsgroups[index].Poets[i].Name + '</a>'
break;
}
}
@ -104,8 +104,8 @@
}
});
$(function () {
$('#rangeInput').on('input change', function () {
$(function() {
$('#rangeInput').on('input change', function() {
var val = $(this).val();
if (val >= 0 && val < poetsgroups.length) {
$('#rangeText').text(poetsgroups[val].Name);
@ -142,7 +142,7 @@
@if (!string.IsNullOrEmpty(Model.LastError))
{
<p>@Model.LastError</p>
<p>@Model.LastError</p>
}
else
{
@ -158,17 +158,14 @@
</div>
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
{
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=@(ViewData["GoogleAnalyticsCode"])"></script>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', '@ViewData["GoogleAnalyticsCode"]', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '@ViewData["GoogleAnalyticsCode"]');
</script>
}
}

View File

@ -205,17 +205,14 @@
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
{
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=@(ViewData["GoogleAnalyticsCode"])"></script>
<script>
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', '@ViewData["GoogleAnalyticsCode"]', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '@ViewData["GoogleAnalyticsCode"]');
</script>
}
}

View File

@ -84,7 +84,7 @@
<input type="submit" value="بیاب" />
</form>
</div><!-- .actionbox -->
</div>
</div>
<!-- #hdr2 -->
@ -156,7 +156,7 @@
</form>
</div><!-- related-images-frame -->
</div> <!-- comments-like-div -->
</div> <!-- comments-like-div -->
@if (Model.Poems == null)
{
<div class="sitem">
@ -164,7 +164,7 @@
</div>
}
else
if (Model.Poems.Count == 0)
if (Model.Poems.Count == 0)
{
<div class="sitem">
<p>شعری با مشخصات مورد نظر شما پیدا نشد.</p>
@ -207,17 +207,14 @@
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
{
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=@(ViewData["GoogleAnalyticsCode"])"></script>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', '@ViewData["GoogleAnalyticsCode"]', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '@ViewData["GoogleAnalyticsCode"]');
</script>
}
}

View File

@ -64,7 +64,7 @@
</select>
<script>
$('#languages').change(
function () {
function() {
var langId = $('#languages option:selected').val();
location.href = '/Trans?p=@Model.PoemId&lang=' + String(langId);
}
@ -121,17 +121,14 @@
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
{
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=@(ViewData["GoogleAnalyticsCode"])"></script>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', '@ViewData["GoogleAnalyticsCode"]', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '@ViewData["GoogleAnalyticsCode"]');
</script>
}
</body>

View File

@ -32,17 +32,14 @@
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
{
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=@(ViewData["GoogleAnalyticsCode"])"></script>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', '@ViewData["GoogleAnalyticsCode"]', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '@ViewData["GoogleAnalyticsCode"]');
</script>
}
</body>