This repository has been archived by the owner on Dec 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
popup.html
137 lines (130 loc) · 3.99 KB
/
popup.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
<!doctype html>
<html lang="en">
<head>
<title>Privly</title>
<style type="text/css">
ul {
list-style: none;
margin: 1em 0;
padding: 0;
}
ul li {
font-weight: bold;
margin: 0;
padding: 3px 10px 5px 20px;
border-bottom: 1px solid #ccc;
color: #666;
cursor: pointer;
}
ul li:hover {
color: #000;
background-color: #ddd;
}
a:link, a:visited {
text-decoration: none;
color: #666;
}
a:hover, a:active {
text-decoration: none;
color: #000;
}
</style>
</head>
<body>
<ul>
<li id="postContent" class="postContent">Post Content</li>
<li id="postContentPreview" class="postContent" style="color:orange;"></li>
<li id="postAnonymousOrPublicContent"><input type="checkbox" id="chkAnonymousOrPublicPost" /><label for="chkAnonymousOrPublicPost">Post Anonymously</input></li>
</ul>
<br />
<div id="loginContentOnly">
<ul>
<li><a href="https://priv.ly/posts">My Posts</a></li>
<li><a href="https://priv.ly/pages/account">My Account</a></li>
</ul>
<br />
</div>
<ul>
<li><a href="options.html" target="_blank" id="options">Logout From Privly</a></li>
</ul>
</body>
<script src="scripts/jquery-1.7.2.min.js"></script>
<script>
$(document).ready(function() {
if(widget.preferences.authToken) {
$('#loginContentOnly').show();
$('input[id=chkAnonymousOrPublicPost]').attr('checked', (widget.preferences.allPostsPublic == "true") );
$('input[id=chkAnonymousOrPublicPost]').attr('disabled',false);
$('label[for=chkAnonymousOrPublicPost]').text('Post Publicly');
$('#options').text('Logout From Privly');
}
else {
$('#loginContentOnly').hide();
$('input[id=chkAnonymousOrPublicPost]').attr('checked',true);
$('input[id=chkAnonymousOrPublicPost]').attr('disabled',true);
$('label[for=chkAnonymousOrPublicPost]').text('Post Anonymously');
$('#options').text('Login To Privly');
}
if(opera.extension.bgProcess.postInfo.content !== "") {
$('#postContent').text('Post Content');
var post = opera.extension.bgProcess.postInfo.content;
if(post.length <= 42) {
$('#postContentPreview').text(post);
}
else {
$('#postContentPreview').text(post.substring(0, 42) + "...");
}
}
else {
$('#postContent').text('Nothing found to Post.');
$('#postContentPreview').text('Type some text on the website to see a preview here.');
}
$('.postContent').click(function() {
if(opera.extension.bgProcess.postInfo.content !== "") {
if(widget.preferences.authToken) {
opera.extension.bgProcess.privlyAuthentication.postToPrivly($('input[id=chkAnonymousOrPublicPost]').is(':checked') ? "public" : "private");
}
else {
opera.extension.bgProcess.privlyAuthentication.postAnonymouslyToPrivly();
}
}
});
/*
$('#options').click(function(e){
if($(this).text() === 'Logout From Privly')
{
e.preventDefault();
opera.extension.bgProcess.privlyAuthentication.logoutFromPrivly();
}
});
*/
//alert(opera.extension.bgProcess.privlyAuthentication.authToken);
//alert("content = " + opera.extension.bgProcess.content);
if(opera.extension.bgProcess.privlyAuthentication.authToken) {
$('h1').text(opera.extension.bgProcess.privlyAuthentication.authToken);
}
else {
$('h1').text("Not logged in");
}
if(opera.extension.bgProcess.postInfo.content) {
$('h2').text(opera.extension.bgProcess.postInfo.content + " : " + opera.extension.bgProcess.postInfo.postTag + " : " + opera.extension.bgProcess.postInfo.postLocation);
}
else {
$('h2').text("Nothing to Post");
}
$('h3').click(function() {
event.preventDefault();
if(opera.extension.bgProcess.privlyAuthentication.authToken) {
opera.extension.bgProcess.privlyAuthentication.postToPrivly();
}
else {
alert("Not logged in");
}
});
$('h4').click(function() {
opera.extension.bgProcess.privlyAuthentication.logoutFromPrivly();
opera.window.close();
});
});
</script>
</html>