Skip to content
This repository was archived by the owner on Oct 13, 2024. It is now read-only.

Commit b9e08ad

Browse files
committed
style: semicolons
1 parent 7f4ccb7 commit b9e08ad

File tree

2 files changed

+76
-76
lines changed

2 files changed

+76
-76
lines changed

Contents/Resources/web/js/plexauth.js

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ var p = {
44
name: 'Unknown',
55
version: 'Unknown',
66
os: 'Unknown'
7-
}
7+
};
88
if (typeof platform !== 'undefined') {
9-
p.name = platform.name
10-
p.version = platform.version
11-
p.os = platform.os.toString()
9+
p.name = platform.name;
10+
p.version = platform.version;
11+
p.os = platform.os.toString();
1212
}
1313

1414
function getPlexHeaders(clientID) {
@@ -24,16 +24,16 @@ function getPlexHeaders(clientID) {
2424
'X-Plex-Device-Name': p.name + ' (Themerr)',
2525
'X-Plex-Device-Screen-Resolution': window.screen.width + 'x' + window.screen.height,
2626
'X-Plex-Language': 'en'
27-
}
27+
};
2828
}
2929

3030
function encodeData(data) {
3131
return Object.keys(data).map(function (key) {
32-
return [key, data[key]].map(encodeURIComponent).join("=")
33-
}).join("&")
32+
return [key, data[key]].map(encodeURIComponent).join("=");
33+
}).join("&");
3434
}
3535

36-
var plex_oauth_window = null
36+
var plex_oauth_window = null;
3737
const plex_oauth_loader = '<style>' +
3838
'.login-loader-container {' +
3939
'font-family: "Open Sans", Arial, sans-serif;' +
@@ -73,98 +73,98 @@ const plex_oauth_loader = '<style>' +
7373
'<br>' +
7474
'Redirecting to the Plex login page...' +
7575
'</div>' +
76-
'</div>'
76+
'</div>';
7777

7878
function closePlexOAuthWindow() {
7979
if (plex_oauth_window) {
80-
plex_oauth_window.close()
80+
plex_oauth_window.close();
8181
}
8282
}
8383

8484
function getKeyPath(key, path) {
85-
var key_path = key
85+
var key_path = key;
8686
if (path !== false) {
87-
key_path = `${key_path}_${window.location.pathname}`
87+
key_path = `${key_path}_${window.location.pathname}`;
8888
}
89-
return key_path
89+
return key_path;
9090
}
9191

9292
function setLocalStorage(key, value, path) {
93-
var key_path = getKeyPath(key, path)
94-
localStorage.setItem(key_path, value)
93+
var key_path = getKeyPath(key, path);
94+
localStorage.setItem(key_path, value);
9595
}
9696

9797
function getLocalStorage(key, default_value, path) {
98-
var key_path = getKeyPath(key, path)
99-
var value = localStorage.getItem(key_path)
98+
var key_path = getKeyPath(key, path);
99+
var value = localStorage.getItem(key_path);
100100
if (value !== null) {
101-
return value
101+
return value;
102102
} else if (default_value !== undefined) {
103-
setLocalStorage(key, default_value, path)
104-
return default_value
103+
setLocalStorage(key, default_value, path);
104+
return default_value;
105105
}
106106
}
107107

108108
function uuidv4() {
109109
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
110-
var cryptoObj = window.crypto || window.msCrypto // for IE 11
111-
return (c ^ cryptoObj.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
112-
})
110+
var cryptoObj = window.crypto || window.msCrypto; // for IE 11
111+
return (c ^ cryptoObj.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
112+
});
113113
}
114114

115115
getPlexOAuthPin = function (clientID) {
116-
var x_plex_headers = getPlexHeaders(clientID)
117-
var deferred = $.Deferred()
116+
var x_plex_headers = getPlexHeaders(clientID);
117+
var deferred = $.Deferred();
118118

119119
$.ajax({
120120
url: 'https://plex.tv/api/v2/pins?strong=true',
121121
type: 'POST',
122122
headers: x_plex_headers,
123123
success: function (data) {
124-
deferred.resolve({ pin: data.id, code: data.code })
124+
deferred.resolve({ pin: data.id, code: data.code });
125125
},
126126
error: function () {
127-
closePlexOAuthWindow()
128-
deferred.reject()
127+
closePlexOAuthWindow();
128+
deferred.reject();
129129
}
130-
})
131-
return deferred
132-
}
130+
});
131+
return deferred;
132+
};
133133

134134
function PopupCenter(url, title, w, h) {
135135
// Fixes dual-screen position Most browsers Firefox
136-
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : window.screenX
137-
var dualScreenTop = window.screenTop != undefined ? window.screenTop : window.screenY
136+
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : window.screenX;
137+
var dualScreenTop = window.screenTop != undefined ? window.screenTop : window.screenY;
138138

139-
var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width
140-
var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height
139+
var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
140+
var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
141141

142-
var left = ((width / 2) - (w / 2)) + dualScreenLeft
143-
var top = ((height / 2) - (h / 2)) + dualScreenTop
144-
var newWindow = window.open(url, title, `scrollbars=yes, width=${w}, height=${h}, top=${top}, left=${left}`)
142+
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
143+
var top = ((height / 2) - (h / 2)) + dualScreenTop;
144+
var newWindow = window.open(url, title, `scrollbars=yes, width=${w}, height=${h}, top=${top}, left=${left}`);
145145

146146
// Puts focus on the newWindow
147147
if (window.focus) {
148-
newWindow.focus()
148+
newWindow.focus();
149149
}
150150

151-
return newWindow
151+
return newWindow;
152152
}
153153

154-
var polling = null
154+
var polling = null;
155155

156156
function PlexOAuth(success, error, pre, clientID) {
157157
if (typeof pre === "function") {
158-
pre()
158+
pre();
159159
}
160-
closePlexOAuthWindow()
161-
plex_oauth_window = PopupCenter('', 'Plex-OAuth', 600, 700)
162-
$(plex_oauth_window.document.body).html(plex_oauth_loader)
160+
closePlexOAuthWindow();
161+
plex_oauth_window = PopupCenter('', 'Plex-OAuth', 600, 700);
162+
$(plex_oauth_window.document.body).html(plex_oauth_loader);
163163

164164
getPlexOAuthPin(clientID).then(function (data) {
165-
var x_plex_headers = getPlexHeaders(clientID)
166-
const pin = data.pin
167-
const code = data.code
165+
var x_plex_headers = getPlexHeaders(clientID);
166+
const pin = data.pin;
167+
const code = data.code;
168168

169169
var oauth_params = {
170170
'clientID': x_plex_headers['X-Plex-Client-Identifier'],
@@ -178,9 +178,9 @@ function PlexOAuth(success, error, pre, clientID) {
178178
'context[device][screenResolution]': x_plex_headers['X-Plex-Device-Screen-Resolution'],
179179
'context[device][layout]': 'desktop',
180180
'code': code
181-
}
181+
};
182182

183-
plex_oauth_window.location = `https://app.plex.tv/auth/#!?${encodeData(oauth_params)}`
183+
plex_oauth_window.location = `https://app.plex.tv/auth/#!?${encodeData(oauth_params)}`;
184184
polling = pin;
185185

186186
(function poll() {
@@ -190,32 +190,32 @@ function PlexOAuth(success, error, pre, clientID) {
190190
headers: x_plex_headers,
191191
success: function (data) {
192192
if (data.authToken) {
193-
closePlexOAuthWindow()
193+
closePlexOAuthWindow();
194194
if (typeof success === "function") {
195-
success(data.authToken)
195+
success(data.authToken);
196196
}
197197
}
198198
},
199199
error: function (jqXHR, textStatus, errorThrown) {
200200
if (textStatus !== "timeout") {
201-
closePlexOAuthWindow()
201+
closePlexOAuthWindow();
202202
if (typeof error === "function") {
203-
error()
203+
error();
204204
}
205205
}
206206
},
207207
complete: function () {
208208
if (!plex_oauth_window.closed && polling === pin) {
209-
setTimeout(function () { poll() }, 1000)
209+
setTimeout(function () { poll(); }, 1000);
210210
}
211211
},
212212
timeout: 10000
213-
})
214-
})()
213+
});
214+
})();
215215
}, function () {
216-
closePlexOAuthWindow()
216+
closePlexOAuthWindow();
217217
if (typeof error === "function") {
218-
error()
218+
error();
219219
}
220-
})
220+
});
221221
}

Contents/Resources/web/templates/login.html

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@
2828
<script src="{{ url_for('static', filename='js/plexauth.js') }}"></script>
2929
<script>
3030
function OAuthSuccessCallback(authToken) {
31-
signIn(authToken)
31+
signIn(authToken);
3232
}
3333
function OAuthErrorCallback() {
34-
$('#sign-in-alert').text('Error communicating with Plex.tv.').show()
34+
$('#sign-in-alert').text('Error communicating with Plex.tv.').show();
3535
}
3636

3737
$('#sign-in-plex').click(function () {
38-
PlexOAuth(OAuthSuccessCallback, OAuthErrorCallback)
39-
})
38+
PlexOAuth(OAuthSuccessCallback, OAuthErrorCallback);
39+
});
4040

4141
function signIn(token) {
42-
$('.login-container button').prop('disabled', true)
43-
$('#sign-in-plex').html('<i class="fa fa-refresh fa-spin"></i>&nbsp; Sign In with Plex')
42+
$('.login-container button').prop('disabled', true);
43+
$('#sign-in-plex').html('<i class="fa fa-refresh fa-spin"></i>&nbsp; Sign In with Plex');
4444

4545
var data = {
4646
token: token
47-
}
48-
var x_plex_headers = getPlexHeaders()
49-
data = $.extend(data, x_plex_headers)
47+
};
48+
var x_plex_headers = getPlexHeaders();
49+
data = $.extend(data, x_plex_headers);
5050

5151
$.ajax({
5252
url: '{{ url_for("login") }}',
@@ -55,21 +55,21 @@
5555
dataType: 'json',
5656
statusCode: {
5757
200: function (xhr, status) {
58-
window.location = "{{ redirect_uri }}"
58+
window.location = "{{ redirect_uri }}";
5959
},
6060
401: function (xhr, status) {
61-
$('#sign-in-alert').text('Invalid Plex account, or the account is not the owner of the server.').show()
61+
$('#sign-in-alert').text('Invalid Plex account, or the account is not the owner of the server.').show();
6262
},
6363
429: function (xhr, status) {
64-
var retry = Math.ceil(xhr.getResponseHeader('Retry-After') / 60)
65-
$('#sign-in-alert').text(`Too many login attempts. Try again in ${retry} minute(s).`).show()
64+
var retry = Math.ceil(xhr.getResponseHeader('Retry-After') / 60);
65+
$('#sign-in-alert').text(`Too many login attempts. Try again in ${retry} minute(s).`).show();
6666
}
6767
},
6868
complete: function () {
69-
$('.login-container button').prop('disabled', false)
70-
$('#sign-in-plex').html('<i class="fa fa-sign-in"></i>&nbsp; Sign In with Plex')
69+
$('.login-container button').prop('disabled', false);
70+
$('#sign-in-plex').html('<i class="fa fa-sign-in"></i>&nbsp; Sign In with Plex');
7171
}
72-
})
72+
});
7373
}
7474
</script>
7575
{% endblock scripts %}

0 commit comments

Comments
 (0)