Add a notification area.
[Sone.git] / src / main / resources / templates / include / head.html
1 <div id="sone" class="<%ifnull ! currentSone>online<%else>offline<%/if>">
2
3         <div id="formPassword"><% formPassword|html></div>
4
5         <script src="javascript/jquery-1.4.2.js" language="javascript"></script>
6         <script src="javascript/sone.js" language="javascript"></script>
7
8         <script language="javascript">
9                 /* this initializes the status update input field. */
10                 $(document).ready(function() {
11                         getTranslation("WebInterface.DefaultText.StatusUpdate", function(text) {
12                                 registerInputTextareaSwap("#sone #update-status .status-input", text, "text", false, false);
13                         })
14                 });
15         </script>
16
17         <script language="javascript">
18                 /* these functions are necessary for updating Sone statuses. */
19                 $(document).ready(function() {
20                         $("#sone .sone").each(function() {
21                                 watchSone($(this).find(".id").text());
22                         });
23                 });
24         </script>
25
26         <script language="javascript">
27                 /* this initializes all reply input fields. */
28                 $(document).ready(function() {
29                         getTranslation("WebInterface.DefaultText.Reply", function(text) {
30                                 registerInputTextareaSwap("#sone input.reply-input", text, "text", false, false);
31                                 addCommentLinks();
32                         })
33                 });
34         </script>
35
36         <script language="javascript">
37                 /* replace all “delete” buttons with javascript. */
38                 $(document).ready(function() {
39                         getTranslation("WebInterface.Confirmation.DeletePostButton", function(text) {
40                                 deletePostText = text;
41                                 getTranslation("WebInterface.Confirmation.DeleteReplyButton", function(text) {
42                                         deleteReplyText = text;
43                                         $("#sone .post").each(function() {
44                                                 postId = $(this).attr("id");
45                                                 enhanceDeletePostButton("#sone .post#" + postId + " > .inner-part > .status-line .delete button", postId, deletePostText);
46                                                 (function(postId) {
47                                                         $("#sone .post#" + postId + " .reply").each(function() {
48                                                                 replyId = $(this).attr("id");
49                                                                 (function(postId, reply, replyId) {
50                                                                         reply.find(".delete button").each(function() {
51                                                                                 enhanceDeleteReplyButton("#sone .post#" + postId + " .reply#" + replyId + " .delete button", replyId, deleteReplyText);
52                                                                         })
53                                                                 })(postId, $(this), replyId);
54                                                         });
55                                                 })(postId);
56                                         });
57                                 });
58                         });
59                 });
60         </script>
61
62         <script language="javascript">
63                 /* hides all replies but the latest two. */
64                 $(document).ready(function() {
65                         getTranslation("WebInterface.ClickToShow.Replies", function(text) {
66                                 $("#sone .post .replies").each(function() {
67                                         allReplies = $(this).find(".reply");
68                                         if (allReplies.length > 2) {
69                                                 newHidden = false;
70                                                 for (replyIndex = 0; replyIndex < (allReplies.length - 2); ++replyIndex) {
71                                                         $(allReplies[replyIndex]).addClass("hidden");
72                                                         newHidden |= $(allReplies[replyIndex]).hasClass("new");
73                                                 }
74                                                 clickToShowElement = $("<div></div>").addClass("click-to-show");
75                                                 if (newHidden) {
76                                                         clickToShowElement.addClass("new");
77                                                 }
78                                                 (function(clickToShowElement, allReplies, text) {
79                                                         clickToShowElement.text(text);
80                                                         clickToShowElement.click(function() {
81                                                                 allReplies.removeClass("hidden");
82                                                                 clickToShowElement.addClass("hidden");
83                                                         });
84                                                 })(clickToShowElement, allReplies, text);
85                                                 $(allReplies[0]).before(clickToShowElement);
86                                         }
87                                 });
88                         });
89                 });
90         </script>
91
92         <script language="javascript">
93                 /* convert all “follow”, “unfollow”, “block”, and “unblock” links to something nicer. */
94                 $(document).ready(function() {
95                         $("#sone .follow").submit(function() {
96                                 var followElement = this;
97                                 $.getJSON("ajax/followSone.ajax", { "sone": getSoneId(this), "formPassword": getFormPassword() }, function() {
98                                         $(followElement).addClass("hidden");
99                                         $(followElement).parent().find(".unfollow").removeClass("hidden");
100                                 });
101                                 return false;
102                         });
103                         $("#sone .unfollow").submit(function() {
104                                 var unfollowElement = this;
105                                 $.getJSON("ajax/unfollowSone.ajax", { "sone": getSoneId(this), "formPassword": getFormPassword() }, function() {
106                                         $(unfollowElement).addClass("hidden");
107                                         $(unfollowElement).parent().find(".follow").removeClass("hidden");
108                                 });
109                                 return false;
110                         });
111                 });
112         </script>
113
114         <script language="javascript">
115                 /* convert all “like” buttons to javascript functions. */
116                 $(document).ready(function() {
117                         $("#sone .post > .inner-part > .status-line .like").submit(function() {
118                                 likePost(getPostId(this));
119                                 return false;
120                         });
121                         $("#sone .post > .inner-part > .status-line .unlike").submit(function() {
122                                 unlikePost(getPostId(this));
123                                 return false;
124                         });
125                         $("#sone .post .reply .status-line .like").submit(function() {
126                                 likeReply(getReplyId(this));
127                                 return false;
128                         });
129                         $("#sone .post .reply .status-line .unlike").submit(function() {
130                                 unlikeReply(getReplyId(this));
131                                 return false;
132                         });
133                 });
134         </script>
135
136         <div id="main">
137
138                 <%if !webInterface.core.identityManager.connected>
139                         <div id="plugin-warning">
140                                 <%= Warning.PluginNotConnected.Text|l10n|html|replace needle="{link}" replacement="<a href=\"/plugins/\">"|replace needle="{/link}" replacement="</a>">
141                         </div>
142                 <%/if>
143
144                 <div id="notification-area"></div>
145
146                 <div id="profile" class="<%ifnull currentSone>offline<%else>online<%/if>">
147                         <a class="picture" href="index.html">
148                                 <%ifnull !currentSone>
149                                         <img src="/WoT/GetIdenticon?identity=<% currentSone.id|html>&amp;width=80&amp;height=80" width="80" height="80" alt="Profile Avatar" />
150                                 <%else>
151                                         <img src="images/sone.png" width="80" height="80" alt="Sone is offline" />
152                                 <%/if>
153                         </a>
154                         <%ifnull ! currentSone>
155                                 <div id="home-sone">
156                                         <% currentSone|store key=sone>
157                                         <%include include/viewSone.html>
158                                         <%include include/updateStatus.html>
159                                 </div>
160                         <%/if>
161                 </div>