diff --git a/GanjooRazor/Pages/Search.cshtml b/GanjooRazor/Pages/Search.cshtml index d8fb0668..392176c0 100644 --- a/GanjooRazor/Pages/Search.cshtml +++ b/GanjooRazor/Pages/Search.cshtml @@ -195,12 +195,11 @@ else { - @if (Model.QueryIsSingleWord) + @if (Model.StatsAtTop && Model.QueryIsSingleWord) {
- + مشاهدهٔ بسامد واژگان «@Model.Query» به تفکیک بخش -
@@ -252,9 +251,22 @@ در هر قطعه ممکن است عبارت چند بار تکرار شده باشد. برای دستیابی به آمار با احتساب تکرارها بسامد واژگان را ببینید.
- } + @if (!Model.StatsAtTop && Model.QueryIsSingleWord) + { +
+ + مشاهدهٔ بسامد واژگان «@Model.Query» به تفکیک بخش + + +
+
+ +
+ } + + @@ -279,10 +291,10 @@ } } - @if (Model.QueryIsSingleWord) + @if (Model.StatsAtTop && Model.QueryIsSingleWord) { } diff --git a/GanjooRazor/Pages/Search.cshtml.cs b/GanjooRazor/Pages/Search.cshtml.cs index 7e63280b..5a65e5ec 100644 --- a/GanjooRazor/Pages/Search.cshtml.cs +++ b/GanjooRazor/Pages/Search.cshtml.cs @@ -13,7 +13,6 @@ using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Org.BouncyCastle.Asn1.Cmp; using RMuseum.Models.Ganjoor.ViewModels; using RMuseum.Services.Implementation; using RSecurityBackend.Models.Generic; @@ -169,6 +168,8 @@ namespace GanjooRazor.Pages } } + public bool StatsAtTop { get; set; } + public async Task OnGetAsync() { if (bool.Parse(Configuration["MaintenanceMode"])) @@ -241,6 +242,8 @@ namespace GanjooRazor.Pages CatFullTitle = ""; } + StatsAtTop = !string.IsNullOrEmpty(Request.Query["stats"]); + ViewData["GoogleAnalyticsCode"] = Configuration["GoogleAnalyticsCode"]; //todo: use html master layout or make it partial @@ -457,7 +460,7 @@ namespace GanjooRazor.Pages return htmlText; } - public async Task OnGetWordCountsByPoetAsync(string term, int poetId, int catId) + public async Task OnGetWordCountsByPoetAsync(string term, int poetId, int catId, bool blur) { if (term == null) return new BadRequestObjectResult("term is null"); term = term.Replace("\"", ""); @@ -498,7 +501,8 @@ namespace GanjooRazor.Pages Term = term, WordStats = wordCounts, Whole = catId == 0 && poetId == 0, - TotalCount = string.IsNullOrEmpty(countStr) ? 0 : int.Parse(countStr) + TotalCount = string.IsNullOrEmpty(countStr) ? 0 : int.Parse(countStr), + Blur = blur, } } }; diff --git a/GanjooRazor/Pages/_CategoryWordsCountByCatPartial.cshtml b/GanjooRazor/Pages/_CategoryWordsCountByCatPartial.cshtml index c9e47abd..a5db2986 100644 --- a/GanjooRazor/Pages/_CategoryWordsCountByCatPartial.cshtml +++ b/GanjooRazor/Pages/_CategoryWordsCountByCatPartial.cshtml @@ -1,6 +1,6 @@ @model GanjooRazor.Pages._CategoryWordsCountByCatPartialModel -@if (Model.WordStats.Length == 0) +@if (!Model.Blur || Model.WordStats.Length == 0) { diff --git a/GanjooRazor/Pages/_CategoryWordsCountByCatPartial.cshtml.cs b/GanjooRazor/Pages/_CategoryWordsCountByCatPartial.cshtml.cs index f9558241..55d515ea 100644 --- a/GanjooRazor/Pages/_CategoryWordsCountByCatPartial.cshtml.cs +++ b/GanjooRazor/Pages/_CategoryWordsCountByCatPartial.cshtml.cs @@ -9,6 +9,7 @@ namespace GanjooRazor.Pages public PoetOrCatWordStat[] WordStats { get; set; } public bool Whole { get; set; } public int TotalCount { get; set; } + public bool Blur { get; set; } public _CategoryWordsCountByCatTablePartialModel Model { @@ -19,7 +20,8 @@ namespace GanjooRazor.Pages Term = Term, WordStats = WordStats, Whole = Whole, - TotalCount = TotalCount + TotalCount = TotalCount, + Blur = Blur }; } } diff --git a/GanjooRazor/Pages/_CategoryWordsCountByCatTablePartial.cshtml.cs b/GanjooRazor/Pages/_CategoryWordsCountByCatTablePartial.cshtml.cs index da83a995..e26a41d7 100644 --- a/GanjooRazor/Pages/_CategoryWordsCountByCatTablePartial.cshtml.cs +++ b/GanjooRazor/Pages/_CategoryWordsCountByCatTablePartial.cshtml.cs @@ -9,6 +9,8 @@ namespace GanjooRazor.Pages public PoetOrCatWordStat[] WordStats { get; set; } public bool Whole { get; set; } public int TotalCount { get; set; } + + public bool Blur { get; set; } public string SectionName { get diff --git a/GanjooRazor/wwwroot/js/bk.js b/GanjooRazor/wwwroot/js/bk.js index c62e56fc..fdfc6815 100644 --- a/GanjooRazor/wwwroot/js/bk.js +++ b/GanjooRazor/wwwroot/js/bk.js @@ -1695,13 +1695,13 @@ function onSearchWordCounts(catId, poetId, totalWordCount) { }, 500); } -function loadWordCountsByPoet(term, poetId, catId) { +function loadWordCountsByCat(term, poetId, catId, blur) { var divParent = document.getElementById('wordcounts-placeholder'); var imgElementId = 'loadingwordcountsimg'; divParent.innerHTML = divParent.innerHTML + '
بارگذاری
'; $.ajax({ type: "GET", - url: '?Handler=WordCountsByPoet&term=' + term + '&poetId=' + poetId.toString() + '&catId=' + catId.toString(), + url: '?Handler=WordCountsByPoet&term=' + term + '&poetId=' + poetId.toString() + '&catId=' + catId.toString() + '&blur=' + blur.toString(), error: function () { if (document.getElementById("remove-this-wordcounts") != null) { document.getElementById("remove-this-wordcounts").remove();