Aggiunto recupero dati della PixelRatio

This commit is contained in:
Samuele E. Locatelli
2018-03-07 17:42:10 +01:00
parent edfde73ddd
commit 515aa10be9
4 changed files with 91 additions and 6 deletions
+21 -1
View File
@@ -116,7 +116,7 @@
<div class="list-group">
<div class="list-group-item bg-secondary">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">Browser size data</h5>
<h5 class="mb-1">Windows size data</h5>
<%--<small>3 days ago</small>--%>
</div>
<p class="mb-1">
@@ -124,6 +124,26 @@
</p>
<%--<small>Donec id elit non mi porta.</small>--%>
</div>
<div class="list-group-item bg-secondary">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">Screen size data</h5>
<%--<small>3 days ago</small>--%>
</div>
<p class="mb-1">
<pre class="bg-secondary text-warning"><%: paretoScreenSize %></pre>
</p>
<%--<small>Donec id elit non mi porta.</small>--%>
</div>
<div class="list-group-item bg-secondary">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">Pixel Ratio + Windows size data</h5>
<%--<small>3 days ago</small>--%>
</div>
<p class="mb-1">
<pre class="bg-secondary text-warning"><%: paretoWinPixRat %></pre>
</p>
<%--<small>Donec id elit non mi porta.</small>--%>
</div>
</div>
</div>
</div>
+43 -1
View File
@@ -74,7 +74,7 @@ namespace MoonProTablet
lblOut.Text = testo;
}
/// <summary>
/// Restitusice l'elenco pareto (decrescente) delle dimensioni browser registrate
/// Restitusice l'elenco pareto (decrescente) delle dimensioni FINESTRA browser registrate
/// </summary>
public string paretoBrowserSize
{
@@ -95,6 +95,48 @@ namespace MoonProTablet
}
}
/// <summary>
/// Restitusice l'elenco pareto (decrescente) delle dimensioni SCHERMO registrate
/// </summary>
public string paretoScreenSize
{
get
{
StringBuilder sb = new StringBuilder();
string redHash = memLayer.ML.redHash("COUNT:scr:*");
int numRec = memLayer.ML.redCountKey(redHash);
List<KeyValuePair<string, int>> kvp = memLayer.ML.redGetCounterByKey(redHash, memLayer.kvpOrderBy.ValDesc);
// riordino elenco
sb.AppendLine(string.Format("Trovate {0} combinazioni", numRec));
foreach (var item in kvp)
{
sb.AppendLine(string.Format("{0}: {1}", item.Key.Replace(memLayer.ML.redHash("COUNT:scr:"), ""), item.Value));
}
return sb.ToString();
}
}
/// <summary>
/// Restitusice l'elenco pareto (decrescente) delle dimensioni FINESTRA browser + PIXEL ratio registrate
/// </summary>
public string paretoWinPixRat
{
get
{
StringBuilder sb = new StringBuilder();
string redHash = memLayer.ML.redHash("COUNT:wpr:*");
int numRec = memLayer.ML.redCountKey(redHash);
List<KeyValuePair<string, int>> kvp = memLayer.ML.redGetCounterByKey(redHash, memLayer.kvpOrderBy.ValDesc);
// riordino elenco
sb.AppendLine(string.Format("Trovate {0} combinazioni", numRec));
foreach (var item in kvp)
{
sb.AppendLine(string.Format("{0}: {1}", item.Key.Replace(memLayer.ML.redHash("COUNT:wpr:"), ""), item.Value));
}
return sb.ToString();
}
}
/// <summary>
/// Formatta un numero da int a size in Kb/Mb/Gb/Tb
/// </summary>
/// <param name="rawSize"></param>
+13 -1
View File
@@ -8,11 +8,23 @@ function SetWidthHeight() {
//var height = $(window).height();
//var width = $(window).width();
//$(window).innerHeight() * $(window).devicePixelRatio();
//w = window.screen.width;
//h = window.screen.height;
//if (window.devicePixelRatio < 1) {
// w = window.screen.width / window.devicePixelRatio;
// h = window.screen.height / window.devicePixelRatio;
//}
$.ajax({
url: "./windowSize.ashx",
data: {
'Height': height,
'Width': width
'Width': width,
'PixRat': devicePixelRatio,
'scrWidth': screen.width,
'scrHeight': screen.height
},
contentType: "application/json; charset=utf-8",
dataType: "json"
+14 -3
View File
@@ -24,14 +24,25 @@ namespace MoonProTablet
var output = json.Serialize(new { isFirst = context.Session["BrowserWidth"] == null });
context.Response.Write(output);
context.Session["BrowserWidth"] = context.Request.QueryString["Width"];
context.Session["BrowserHeight"] = context.Request.QueryString["Height"];
string Width = context.Request.QueryString["Width"];
string Height = context.Request.QueryString["Height"];
string scrWidth = context.Request.QueryString["scrWidth"];
string scrHeight = context.Request.QueryString["scrHeight"];
string PixRat = context.Request.QueryString["PixRat"];
context.Session["BrowserWidth"] = Width;
context.Session["BrowserHeight"] = Height;
// salva in REDIS come conteggio INCREMENTALE...
if (memLayer.ML.CRB("RedEnab"))
{
string memName = string.Format("COUNT:wh:{0}x{1}", context.Request.QueryString["Width"], context.Request.QueryString["Height"]);
string memName = string.Format("COUNT:wh:{0}x{1}", Width, Height);
// conto +1 x la size nel contatore REDIS
long nCall = memLayer.ML.setRCntI(memLayer.ML.redHash(memName));
// conto anche SCHERMO...
memName = string.Format("COUNT:scr:{0}x{1}", scrWidth, scrHeight);
nCall = memLayer.ML.setRCntI(memLayer.ML.redHash(memName));
// salvo la PIXEL RATIO con WINDOWS...
memName = string.Format("COUNT:wpr:[{2}] {0}x{1}", Width, Height, PixRat);
nCall = memLayer.ML.setRCntI(memLayer.ML.redHash(memName));
}
}