forked from alombarte/juanked.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
233 lines (187 loc) · 8.15 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta robots="noindex,nofollow">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="./wallpapers.js"></script>
<script src="https://mustache.github.io/extras/mustache.js"></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', 'UA-83597810-1', 'auto');
ga('send', 'pageview');
</script>
<script language="javascript">
$( document ).ready(function() {
// images variable is in "wallpapers.js":
buildImagesList(images);
preview();
$("input[name=ImageUrl]").change(function(){
preview();
});
$("#CustomImageURL").change(function(){
if ( $('#CustomImageURL') != '' ) {
$('#RadioCustom').prop( "checked", true );
preview();
}
});
});
function buildImagesList(images)
{
var randomElement = Math.floor(Math.random() * (images.length));
var images_vars = {
"images": images,
"random": images[randomElement]["url"]
}
var render = $('#imagesList').html();
render = Mustache.render(render, images_vars);
$('#imagesList').html(render);
}
function preview() {
$('#preview').attr('src',getSelectedImage());
previewCode();
}
function getSelectedImage() {
var selected_image = $('input[name=ImageUrl]:checked').val();
if ( selected_image == '' ) {
selected_image = $('#CustomImageURL').val();
}
return selected_image;
}
function hashCode(str) {
len = str.length;
hash = 0;
for(i=1; i<=len; i++){
char = str.charCodeAt((i-1));
hash += char*Math.pow(31,(len-i));
hash = hash & hash; //javascript limitation to force to 32 bits
}
return hash;
}
function getOSCommands(os) {
var command = '';
var os_commands = {
'ubuntu': [
"gsettings set org.gnome.desktop.background picture-uri file:////tmp/{{Output}}",
'gnome-screensaver-command --lock',
'exit'
],
'osx': [
'osascript -e \'tell application "System Events" to set picture of every desktop to ("/tmp/{{Output}}" as POSIX file as alias)\'',
'pmset displaysleepnow',
'exit'
],
'windows': [
'copy /y %TEMP%\\{{Output}} %appdata%\\Microsoft\\Windows\\Themes\\TranscodedWallpaper.jpg',
'REG ADD "HKCU\\Control Panel\\Desktop" /V Wallpaper /T REG_SZ /F /D %TEMP%\\{{Output}}',
'REG ADD "HKCU\\Software\\Microsoft\\Internet Explorer\\Desktop\\General" /V WallpaperSource /T REG_SZ /F /D %TEMP%\\{{Output}}',
'RUNDLL32.EXE USER32.DLL, UpdatePerUserSystemParameters 1, True"',
'exit'
]
};
if(typeof os_commands[os] === 'undefined') {
return;
}
for (var i = 0, len = os_commands[os].length; i < len; i++) {
command += ' && ' + os_commands[os][i];
}
return command;
}
function previewCode(){
var selected_image = getSelectedImage();
if ( '' == selected_image ) {
return;
}
var view = {
ImageURL: selected_image,
Output: hashCode(selected_image)
};
curl = 'curl -o /tmp/{{Output}} "{{ImageURL}}"';
startw = 'start "" /b %SystemRoot%\\System32\\cmd.exe /q /c "certutil.exe -urlcache -split -f "{{ImageURL}}" %TEMP%\\{{Output}}';
templateOS = curl + getOSCommands( 'osx' );
templateUbuntu = curl + getOSCommands( 'ubuntu' );
templateWindows = startw + getOSCommands( 'windows' );
templateOS = Mustache.render(templateOS, view);
templateUbuntu = Mustache.render(templateUbuntu, view);
templateWindows = Mustache.render(templateWindows, view);
$('#scriptOS').html(templateOS);
$('#scriptUbuntu').html(templateUbuntu);
$('#scriptWindows').html(templateWindows);
}
</script>
</head>
<body>
<div class="container">
<div class="row">
<h3><img src="juanked.png" alt="Juanked!" /></h3>
</div>
<div class="row">
<h2>Set your colleague wallpaper via command line</h2>
<p><strong>Your colleague left for a minute and forgot to lock the desktop?</strong>... and knows how dangerous and unfortunate is leaving computers unprotected at their own luck?
It's an oportunity for you to set a reminder. Paste the command below in a terminal and wait for your colleague to return. Either be you or someone else, it's important to not disclose
who is the author of the juanking to the victim. "<strong>You've been juanked!</strong>" </p>
<p>The command will download the image and <strong>set the wallpaper in all screens</strong>, and finally will lock the computer.</p>
<div class="form-horizontal">
<div class="form-group">
<div class="col-sm-2 control-label">
<label for="replacementCmd"> Choose wallpaper</label>
<br />
<img src="" width="100%" id="preview" />
<p><small>Depending on your browser and the returned HTTP status code some images might appear broken.</small></p>
</div>
<div class="col-sm-10" id="imagesList">
{{#images}}
<div class="radio">
<label>
<input type="radio" name="ImageUrl" value="{{url}}" />
{{title}}
</label>
</div>
{{/images}}
<div class="radio">
<label>
<input type="radio" name="ImageUrl" value="{{random}}" checked="checked" />
<strong>Random pick</strong>
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="ImageUrl" value="" id="RadioCustom">
Custom...
</label>
<input type="text" class="form-control" id="CustomImageURL" value="">
<span class="help-block">Path to wallpaper image</span>
</div>
</div>
</div>
</div>
</div>
<hr/>
<div class="row">
<p>Paste in the terminal...</p>
<h2>OS X</h2>
<textarea class="form-control" id="scriptOS"></textarea>
</div>
<div class="row">
<h2>Ubuntu</h2>
<textarea class="form-control" id="scriptUbuntu"></textarea>
</div>
<div class="row">
<h2>Windows</h2>
<textarea class="form-control" id="scriptWindows" style="height: 96px;"></textarea>
</div>
<div class="row" style="height: 64px;"></div>
<a href="https://github.com/alombarte/juanked.com"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
</div>
</body>
</html>