Skip to content

Commit f9a0c83

Browse files
author
Rick Butterfield
committed
Add API controllers to check page size
1 parent 7f10023 commit f9a0c83

17 files changed

+446
-203
lines changed

src/Umbraco.Community.Sustainability.TestSite/Umbraco.Community.Sustainability.TestSite.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
<ImplicitUsings>enable</ImplicitUsings>
55
<Nullable>enable</Nullable>
66
</PropertyGroup>
7+
<ItemGroup>
8+
<Content Include="App_Plugins\Umbraco.Community.Sustainability\js\page-tracker.js">
9+
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
10+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
11+
</Content>
12+
</ItemGroup>
713

814
<ItemGroup>
915
<PackageReference Include="Umbraco.Cms" Version="10.0.0" />
Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
@using Umbraco.Cms.Web.Common.PublishedModels;
2+
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.Home>
3+
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
4+
@{
5+
Layout = null;
6+
}
7+
8+
<script src="https://unpkg.com/@@tgwf/co2@latest/dist/iife/index.js"></script>
9+
10+
<html>
11+
<head></head>
12+
<body>
13+
<img src="https://placehold.it/800x600" alt="AN 800 by 600 placeholder image" />
14+
15+
<h1>Didn't melt fairer keepsakes since Fellowship elsewhere.</h1>
16+
<p>Woodlands payment Osgiliath tightening. Barad-dur follow belly comforts tender tough bell? Many that live deserve death. Some that die deserve life. Outwitted teatime grasp defeated before stones reflection corset seen animals Saruman's call?</p>
17+
<h2>Tad survive ensnare joy mistake courtesy Bagshot Row.</h2>
18+
<p>Ligulas step drops both? You shall not pass! Tender respectable success Valar impressive unfriendly bloom scraped? Branch hey-diddle-diddle pony trouble'll sleeping during jump Narsil.</p>
19+
<h3>North valor overflowing sort Iáve mister kingly money?</h3>
20+
<p>Curse you and all the halflings! Deserted anytime Lake-town burned caves balls. Smoked lthilien forbids Thrain?</p>
21+
<ul>
22+
<li>Adamant.</li>
23+
<li>Southfarthing!</li>
24+
<li>Witch-king.</li>
25+
<li>Precious.</li>
26+
<li>Gaffer's!</li>
27+
</ul>
28+
<ul>
29+
<li>Excuse tightening yet survives two cover Undómiel city ablaze.</li>
30+
<li>Keepsakes deeper clouds Buckland position 21 lied bicker fountains ashamed.</li>
31+
<li>Women rippling cold steps rules Thengel finer.</li>
32+
<li>Portents close Havens endured irons hundreds handle refused sister?</li>
33+
<li>Harbor Grubbs fellas riddles afar!</li>
34+
</ul>
35+
<h3>Narsil enjoying shattered bigger leaderless retrieve dreamed dwarf.</h3>
36+
<p>Ravens wonder wanted runs me crawl gaining lots faster! Khazad-dum surprise baby season ranks. I bid you all a very fond farewell.</p>
37+
<ol>
38+
<li>Narsil.</li>
39+
<li>Elros.</li>
40+
<li>Arwen Evenstar.</li>
41+
<li>Maggot's?</li>
42+
<li>Bagginses?</li>
43+
</ol>
44+
<ol>
45+
<li>Concerning Hobbits l golf air fifth bell prolonging camp.</li>
46+
<li>Grond humble rods nearest mangler.</li>
47+
<li>Enormity Lórien merry gravy stayed move.</li>
48+
<li>Diversion almost notion furs between fierce laboring Nazgûl ceaselessly parent.</li>
49+
<li>Agree ruling um wasteland Bagshot Row expect sleep.</li>
50+
</ol>
51+
<h3>Ere answering track forests shards roof!</h3>
52+
<p>Delay freezes Gollum. Let the Ring-bearer decide. Bagshot Row chokes pole pauses immediately orders taught éored musing three-day? Disease rune repel source fire Goblinses already?</p>
53+
<table>
54+
<thead>
55+
<tr>
56+
<th></th>
57+
<th>Dangers</th>
58+
<th>Playing</th>
59+
<th>Window</th>
60+
<th>Meaning</th>
61+
<th>Pace</th>
62+
</tr>
63+
</thead>
64+
<tbody>
65+
<tr>
66+
<td>Current</td>
67+
<td>living</td>
68+
<td>odds</td>
69+
<td>charged</td>
70+
<td>heads</td>
71+
<td>felt</td>
72+
</tr>
73+
<tr>
74+
<td>Inn</td>
75+
<td>climbing</td>
76+
<td>destroying</td>
77+
<td>overhead</td>
78+
<td>roll</td>
79+
<td>mud</td>
80+
</tr>
81+
<tr>
82+
<td>Breath</td>
83+
<td>relevant</td>
84+
<td>éored</td>
85+
<td>hinges</td>
86+
<td>year</td>
87+
<td>signed</td>
88+
</tr>
89+
<tr>
90+
<td>Accept</td>
91+
<td>threads</td>
92+
<td>name</td>
93+
<td>fitted</td>
94+
<td>precious</td>
95+
<td>attacked</td>
96+
</tr>
97+
<tr>
98+
<td>Chief</td>
99+
<td>sails</td>
100+
<td>first-born</td>
101+
<td>pottery</td>
102+
<td>lever</td>
103+
<td>antagonize</td>
104+
</tr>
105+
<tr>
106+
<td>Unoccupied</td>
107+
<td>victorious</td>
108+
<td>means</td>
109+
<td>lovely</td>
110+
<td>humble</td>
111+
<td>force</td>
112+
</tr>
113+
</tbody>
114+
<tfoot>
115+
<tr>
116+
<td>kinsmen</td>
117+
<td>give</td>
118+
<td>walking</td>
119+
<td>thousand</td>
120+
<td>manners</td>
121+
<td>burning</td>
122+
</tr>
123+
</tfoot>
124+
</table>
125+
<h4>Afraid smithy Fellowship debt carven hooks.</h4>
126+
<p>What about second breakfast? Nags runt near Lindir lock discover level? Andûril breathe waited flatten union.</p>
127+
<blockquote>
128+
<p>You shall be the Fellowship of the Ring.</p>
129+
<footer>—Númenor, <cite>sweeter burned verse</cite></footer>
130+
</blockquote>
131+
<h5>Should Shirelings extraordinary spends poison's willing enchantment.</h5>
132+
<p>I think we should get off the road. Penalty sight splintered Misty Mountain mithril? Unrest lasts rode league bears absence Bracegirdle athletic contract nice parent slowed?</p>
133+
<pre>Pardon Concerning Hobbits rune goblins? Twitching figure including rightful Thorin's level! Worth tubers threats Hornburg deadliest? Unfold thumping shh wants Homely!</pre>
134+
<h6>Improve drops absolutely tight deceit potent Treebeard startled!</h6>
135+
<p>J.R.R. Tolkien 3000 uttered veins <q>roaring winds moaning flaming</q>. Meddle <ins>measure pure</ins> Samwise Gamgee business! <sub>Lied</sub> mistake Proudfoots pon. Instance 80 <dfn>morbid ceremonial plunge</dfn> Anor mad. Questions shells hangs noble Proudfoots <var>throws</var>. <mark>Rampart damage</mark> questions Chubbs 3000 conjurer? Single tempt peasants <strong>Bolg Athelas Mordor Wraiths Azog Undómiel</strong> mangler? <samp>Nori Giants Undómiel Rivendell</samp> spike posts took. Fool's Underhill boarded <cite>vanishing twilight unheard-of</cite>. <abbr>Presence</abbr> Dunland lamb lair. Barricade <sup>didn't</sup> feelings purring vine Morgoth. Distract Giants nearing champion <kbd>T</kbd>. Clothing titles quick bother <em>Arod Gloin Beren</em> troop? Balls crashing bastards <small>arrives precisely rascal</small> stubbornness Snowbourn. Hobbitses rose barren <a>strengths tested mirrors moonlight password</a> center? Remade <x-code>free filthy</x-code> breaking respect amuse Arod? Vengeance <del>Elessar Wolves</del> posts remain doorway said! <time>Suspects</time> fight Merry hungers locked yelp.</p>
136+
<hr>
137+
<dl>
138+
<dt>Abandon</dt>
139+
<dd>Tact flies disturber thinking hospitality Elros act vest handy ranks.</dd>
140+
<dt>Devil</dt>
141+
<dd>Boneses spilled Caradhras hungry pace lanterns glory haunted shone forging.</dd>
142+
<dd>Unprotected Beorn's fireworks dream journey beacon dwells gnaws key.</dd>
143+
<dt>Happened</dt>
144+
<dd>Known wanna fifth Bill hell knew she scale.</dd>
145+
<dd>Missing vanish taken colleague sway voice tricks 13 Grimbold.</dd>
146+
<dd>Thereof skills kingsfoil innocent riding light Thorin Oakenshield won.</dd>
147+
</dl>
148+
<form>
149+
<fieldset>
150+
<legend>Blind kitchen</legend>
151+
<div>
152+
<label>Text</label>
153+
<input type="text">
154+
</div>
155+
<div>
156+
<label>Email</label>
157+
<input type="email">
158+
</div>
159+
<div>
160+
<label>Password</label>
161+
<input type="password">
162+
</div>
163+
<div>
164+
<label>Url</label>
165+
<input type="url">
166+
</div>
167+
<div>
168+
<label>Number</label>
169+
<input type="number">
170+
</div>
171+
<div>
172+
<label>Tel</label>
173+
<input type="tel">
174+
</div>
175+
<div>
176+
<label>Search</label>
177+
<input type="search">
178+
</div>
179+
<div>
180+
<label>Time</label>
181+
<input type="time">
182+
</div>
183+
<div>
184+
<label>Date</label>
185+
<input type="date">
186+
</div>
187+
<div>
188+
<label>Datetime-local</label>
189+
<input type="datetime-local">
190+
</div>
191+
<div>
192+
<label>Week</label>
193+
<input type="week">
194+
</div>
195+
<div>
196+
<label>Textarea</label>
197+
<textarea></textarea>
198+
</div>
199+
</fieldset>
200+
<fieldset>
201+
<legend>Chasm mountains mountainside</legend>
202+
<div>
203+
<label>Month</label>
204+
<input type="month">
205+
</div>
206+
<div>
207+
<label><input type="checkbox" name="checkbox">sharp decided</label>
208+
</div>
209+
<div>
210+
<label>Color</label>
211+
<input type="color">
212+
</div>
213+
<div>
214+
<label>File</label>
215+
<input type="file">
216+
</div>
217+
<div>
218+
<label>Hidden</label>
219+
<input type="hidden">
220+
</div>
221+
<div>
222+
<label>Image</label>
223+
<input type="image">
224+
</div>
225+
<div>
226+
<label>bags moment's darkest hastens highest spot</label>
227+
<label><input type="radio" name="radio">sakes is</label>
228+
<label><input type="radio" name="radio">tomb vines</label>
229+
<label><input type="radio" name="radio">tricksy plain</label>
230+
</div>
231+
<div>
232+
<label>Range</label>
233+
<input type="range">
234+
</div>
235+
<div>
236+
<input type="button" value="Button">
237+
</div>
238+
<div>
239+
<input type="reset" value="Reset">
240+
</div>
241+
<div>
242+
<input type="submit" value="Submit">
243+
</div>
244+
<button>works tilled entered</button>
245+
<div>
246+
<label>Select</label>
247+
<select>
248+
<optgroup label="dragon's poring squash">
249+
<option>ending</option>
250+
<option>always</option>
251+
<option>spears</option>
252+
</optgroup>
253+
<optgroup label="suffer night's pain">
254+
<option>diamond</option>
255+
<option>unprotected</option>
256+
<option>consider</option>
257+
</optgroup>
258+
</select>
259+
</div>
260+
</fieldset>
261+
</form>
262+
263+
</body>
264+
</html>
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/Umbraco.Community.Sustainability/ContentApps/SustainabilityContentApp.cs

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,28 @@
66

77
namespace Umbraco.Community.Sustainability.ContentApps
88
{
9-
public class SustainabilityAppComponent : IComposer
10-
{
11-
public void Compose(IUmbracoBuilder builder)
9+
public class SustainabilityContentApp : IContentAppFactory
1210
{
13-
// Add our word counter content app into the composition aka into the DI
14-
builder.ContentApps().Append<SustainabilityContentApp>();
15-
}
16-
}
17-
18-
public class SustainabilityContentApp : IContentAppFactory
19-
{
20-
public ContentApp? GetContentAppFor(object source, IEnumerable<IReadOnlyUserGroup> userGroups)
21-
{
22-
// Only show app on content items
23-
if (!(source is IContent))
24-
return null;
11+
public ContentApp? GetContentAppFor(object source, IEnumerable<IReadOnlyUserGroup> userGroups)
12+
{
13+
// Only show app on content items
14+
if (!(source is IContent))
15+
return null;
2516

26-
var content = ((IContent)source);
17+
var content = (IContent)source;
2718

28-
// Only show app on content items with template
29-
if (content.TemplateId is null)
30-
return null;
19+
// Only show app on content items with template
20+
if (content.TemplateId is null)
21+
return null;
3122

32-
return new ContentApp
33-
{
34-
Alias = "sustainabilityCheck",
35-
Name = "Emissions",
36-
Icon = "icon-flowerpot",
37-
View = "/App_Plugins/SustainabilityCheck/views/sustainability-check.html",
38-
Weight = 0
39-
};
23+
return new ContentApp
24+
{
25+
Alias = "sustainabilityCheck",
26+
Name = "Emissions",
27+
Icon = "icon-flowerpot",
28+
View = "/App_Plugins/Umbraco.Community.Sustainability/views/sustainability-check.html",
29+
Weight = 0
30+
};
31+
}
4032
}
41-
}
4233
}

0 commit comments

Comments
 (0)