diff options
-rw-r--r-- | nbproject/build-impl.xml | 18 | ||||
-rw-r--r-- | nbproject/genfiles.properties | 4 | ||||
-rw-r--r-- | nbproject/project.properties | 6 | ||||
-rw-r--r-- | nbproject/project.xml | 24 | ||||
-rw-r--r-- | src/java/com/juick/Message.java | 171 | ||||
-rw-r--r-- | src/java/com/juick/Tag.java | 35 | ||||
-rw-r--r-- | src/java/com/juick/User.java | 53 | ||||
-rw-r--r-- | src/java/com/juick/http/www/Main.java | 39 | ||||
-rw-r--r-- | src/java/com/juick/http/www/RSS.java | 113 | ||||
-rw-r--r-- | src/java/com/juick/http/www/Reader.java | 111 | ||||
-rw-r--r-- | src/java/com/juick/http/www/Utils.java | 1 | ||||
-rw-r--r-- | web/logo.png (renamed from web/logo3.png) | bin | 1184 -> 1184 bytes | |||
-rw-r--r-- | web/map.js | 182 | ||||
-rw-r--r-- | web/maps.js | 222 | ||||
-rw-r--r-- | web/mc.js | 1 | ||||
-rw-r--r-- | web/post3.js | 42 | ||||
-rw-r--r-- | web/scripts.js (renamed from web/scripts3.js) | 0 | ||||
-rw-r--r-- | web/style.css (renamed from web/style3.css) | 0 |
18 files changed, 397 insertions, 625 deletions
diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index a21325e8..c516e2e9 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -529,12 +529,6 @@ exists or setup the property manually. For example like this: COMPILATION SECTION --> <target depends="init" if="no.dist.ear.dir" name="deps-module-jar" unless="no.deps"> - <ant antfile="${project.com_juick}/build.xml" inheritall="false" target="jar"> - <property name="deploy.on.save" value="false"/> - </ant> - <ant antfile="${project.com_juick_json}/build.xml" inheritall="false" target="jar"> - <property name="deploy.on.save" value="false"/> - </ant> <ant antfile="${project.com_juick_server}/build.xml" inheritall="false" target="jar"> <property name="deploy.on.save" value="false"/> </ant> @@ -543,12 +537,6 @@ exists or setup the property manually. For example like this: </ant> </target> <target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps"> - <ant antfile="${project.com_juick}/build.xml" inheritall="false" target="jar"> - <property name="deploy.on.save" value="false"/> - </ant> - <ant antfile="${project.com_juick_json}/build.xml" inheritall="false" target="jar"> - <property name="deploy.on.save" value="false"/> - </ant> <ant antfile="${project.com_juick_server}/build.xml" inheritall="false" target="jar"> <property name="deploy.on.save" value="false"/> </ant> @@ -699,19 +687,15 @@ exists or setup the property manually. For example like this: </target> <target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/> <target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest"> - <copyfiles files="${reference.com_juick.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> <copyfiles files="${reference.com_juick_server.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> <copyfiles files="${reference.com_juick_xmpp.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> - <copyfiles files="${reference.com_juick_json.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> <copyfiles files="${libs.JSON.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> <mkdir dir="${build.web.dir}/META-INF"/> <manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/> </target> <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir"> - <copyfiles files="${reference.com_juick.jar}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${reference.com_juick_server.jar}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${reference.com_juick_xmpp.jar}" todir="${build.web.dir}/WEB-INF/lib"/> - <copyfiles files="${reference.com_juick_json.jar}" todir="${build.web.dir}/WEB-INF/lib"/> <copyfiles files="${libs.JSON.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> </target> <target depends="init" if="dist.ear.dir" name="-clean-webinf-lib"> @@ -1077,8 +1061,6 @@ exists or setup the property manually. For example like this: CLEANUP SECTION --> <target depends="init" name="deps-clean" unless="no.deps"> - <ant antfile="${project.com_juick}/build.xml" inheritall="false" target="clean"/> - <ant antfile="${project.com_juick_json}/build.xml" inheritall="false" target="clean"/> <ant antfile="${project.com_juick_server}/build.xml" inheritall="false" target="clean"/> <ant antfile="${project.com_juick_xmpp}/build.xml" inheritall="false" target="clean"/> </target> diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index a836f39b..91e63deb 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -3,6 +3,6 @@ build.xml.script.CRC32=c93fa366 build.xml.stylesheet.CRC32=651128d4@1.33.1.1 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=b3ae4a4b -nbproject/build-impl.xml.script.CRC32=c272645e +nbproject/build-impl.xml.data.CRC32=a61f7a05 +nbproject/build-impl.xml.script.CRC32=dc268d62 nbproject/build-impl.xml.stylesheet.CRC32=0cbf5bb7@1.33.1.1 diff --git a/nbproject/project.properties b/nbproject/project.properties index 9fe1630a..c7f77170 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -34,10 +34,8 @@ j2ee.platform.classpath=${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.h j2ee.server.type=Tomcat jar.compress=false javac.classpath=\ - ${reference.com_juick.jar}:\ ${reference.com_juick_server.jar}:\ ${reference.com_juick_xmpp.jar}:\ - ${reference.com_juick_json.jar}:\ ${libs.JSON.classpath} # Space-separated list of extra javac options javac.compilerargs= @@ -67,12 +65,8 @@ javadoc.windowtitle= lib.dir=${web.docbase.dir}/WEB-INF/lib persistence.xml.dir=${conf.dir} platform.active=default_platform -project.com_juick=../com.juick -project.com_juick_json=../com.juick.json project.com_juick_server=../com.juick.server project.com_juick_xmpp=../com.juick.xmpp -reference.com_juick.jar=${project.com_juick}/dist/com.juick.jar -reference.com_juick_json.jar=${project.com_juick_json}/dist/com.juick.json.jar reference.com_juick_server.jar=${project.com_juick_server}/dist/com.juick.server.jar reference.com_juick_xmpp.jar=${project.com_juick_xmpp}/dist/com.juick.xmpp.jar resource.dir=setup diff --git a/nbproject/project.xml b/nbproject/project.xml index 2b60b093..44d3db08 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -7,10 +7,6 @@ <minimum-ant-version>1.6.5</minimum-ant-version> <web-module-libraries> <library dirs="200"> - <file>${reference.com_juick.jar}</file> - <path-in-war>WEB-INF/lib</path-in-war> - </library> - <library dirs="200"> <file>${reference.com_juick_server.jar}</file> <path-in-war>WEB-INF/lib</path-in-war> </library> @@ -19,10 +15,6 @@ <path-in-war>WEB-INF/lib</path-in-war> </library> <library dirs="200"> - <file>${reference.com_juick_json.jar}</file> - <path-in-war>WEB-INF/lib</path-in-war> - </library> - <library dirs="200"> <file>${libs.JSON.classpath}</file> <path-in-war>WEB-INF/lib</path-in-war> </library> @@ -37,22 +29,6 @@ </data> <references xmlns="http://www.netbeans.org/ns/ant-project-references/1"> <reference> - <foreign-project>com_juick</foreign-project> - <artifact-type>jar</artifact-type> - <script>build.xml</script> - <target>jar</target> - <clean-target>clean</clean-target> - <id>jar</id> - </reference> - <reference> - <foreign-project>com_juick_json</foreign-project> - <artifact-type>jar</artifact-type> - <script>build.xml</script> - <target>jar</target> - <clean-target>clean</clean-target> - <id>jar</id> - </reference> - <reference> <foreign-project>com_juick_server</foreign-project> <artifact-type>jar</artifact-type> <script>build.xml</script> diff --git a/src/java/com/juick/Message.java b/src/java/com/juick/Message.java new file mode 100644 index 00000000..65c9c015 --- /dev/null +++ b/src/java/com/juick/Message.java @@ -0,0 +1,171 @@ +/* + * Juick + * Copyright (C) 2008-2011, Ugnich Anton + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package com.juick; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; + +/** + * + * @author Ugnich Anton + */ +public class Message { + + public int MID = 0; + public int RID = 0; + public int ReplyTo = 0; + public String Text = null; + public User User = null; + public ArrayList<String> Tags = new ArrayList<String>(); + public Date Timestamp = null; + public String TimestampString = null; + public int TimeAgo = 0; + public int Privacy = 1; + public boolean FriendsOnly = false; + public boolean ReadOnly = false; + public boolean Hidden = false; + public boolean VisitorCanComment = true; + public int Replies = 0; + public String RepliesBy = null; + public String AttachmentType = null; + public String Photo = null; + public String Video = null; + public int Likes = 0; + public boolean UserLike = false; + public ArrayList<Message> childs = new ArrayList<Message>(); + + public Message() { + } + + public Message(Message msg) { + MID = msg.MID; + RID = msg.RID; + ReplyTo = msg.ReplyTo; + Text = msg.Text; + User = msg.User; + Tags = msg.Tags; + Timestamp = msg.Timestamp; + TimestampString = msg.TimestampString; + TimeAgo = msg.TimeAgo; + Privacy = msg.Privacy; + FriendsOnly = msg.FriendsOnly; + ReadOnly = msg.ReadOnly; + Hidden = msg.Hidden; + Replies = msg.Replies; + AttachmentType = msg.AttachmentType; + Photo = msg.Photo; + Video = msg.Video; + Likes = msg.Likes; + UserLike = msg.UserLike; + childs = msg.childs; + } + + public void parseTags(String strTags) { + Tags.addAll(Arrays.asList(strTags.split(" "))); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Message)) { + return false; + } + Message jmsg = (Message) obj; + return (this.MID == jmsg.MID && this.RID == jmsg.RID); + } + + public int compareTo(Object obj) throws ClassCastException { + if (!(obj instanceof Message)) { + throw new ClassCastException(); + } + Message jmsg = (Message) obj; + + if (this.MID != jmsg.MID) { + if (this.MID > jmsg.MID) { + return -1; + } else { + return 1; + } + } + + if (this.RID != jmsg.RID) { + if (this.RID < jmsg.RID) { + return -1; + } else { + return 1; + } + } + + return 0; + } + + public int getChildsCount() { + int cnt = childs.size(); + for (int i = 0; i < childs.size(); i++) { + cnt += childs.get(i).getChildsCount(); + } + return cnt; + } + + public void cleanupChilds() { + if (!childs.isEmpty()) { + for (int i = 0; i < childs.size(); i++) { + childs.get(i).cleanupChilds(); + } + childs.clear(); + } + } + + public String getAttachmentURL() { + if (AttachmentType != null) { + String url = "http://i.juick.com/"; + url += AttachmentType.equals("mp4") ? "video" : "photos-1024"; + url += "/" + MID; + if (RID > 0) { + url += "-" + RID; + } + url += "." + AttachmentType; + return url; + } else { + return null; + } + } + + public String getTagsString() { + String ret = ""; + for (int i = 0; i < Tags.size(); i++) { + ret += " *" + Tags.get(i); + } + if (FriendsOnly) { + ret += " *friends"; + } + if (Privacy == -2) { + ret += " *private"; + } + if (Privacy == -1) { + ret += " *friends"; + } + if (Privacy == 2) { + ret += " *public"; + } + if (ReadOnly) { + ret += " *readonly"; + } + return ret; + } +} diff --git a/src/java/com/juick/Tag.java b/src/java/com/juick/Tag.java new file mode 100644 index 00000000..3cee3358 --- /dev/null +++ b/src/java/com/juick/Tag.java @@ -0,0 +1,35 @@ +/* + * Juick + * Copyright (C) 2008-2011, Ugnich Anton + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package com.juick; + +/** + * + * @author Ugnich Anton + */ +public class Tag implements Comparable<Tag> { + + public String Name = null; + public int TID = 0; + public int SynonymID = 0; + public int UsageCnt = 0; + + @Override + public int compareTo(Tag o) { + return this.Name.compareTo(o.Name); + } +} diff --git a/src/java/com/juick/User.java b/src/java/com/juick/User.java new file mode 100644 index 00000000..e3fc0ae7 --- /dev/null +++ b/src/java/com/juick/User.java @@ -0,0 +1,53 @@ +/* + * Juick + * Copyright (C) 2008-2011, Ugnich Anton + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package com.juick; + +/** + * + * @author Ugnich Anton + */ +public class User { + + public int UID = 0; + public String UName = null; + public Object Avatar = null; + public String FullName = null; + public String JID = null; + public int MessagesCount = 0; + public String AuthHash = null; + public boolean Banned = false; + + public User() { + } + + public User(User u) { + UID = u.UID; + UName = u.UName; + Avatar = u.Avatar; + FullName = u.FullName; + JID = u.JID; + MessagesCount = u.MessagesCount; + AuthHash = u.AuthHash; + Banned = u.Banned; + } + + @Override + public boolean equals(Object obj) { + return (obj instanceof User && ((User) obj).UID == this.UID); + } +} diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java index 0fe93173..56aa439f 100644 --- a/src/java/com/juick/http/www/Main.java +++ b/src/java/com/juick/http/www/Main.java @@ -17,6 +17,7 @@ */ package com.juick.http.www; +import com.juick.server.UserQueries; import com.juick.xmpp.JID; import com.juick.xmpp.Stream; import com.juick.xmpp.StreamComponent; @@ -43,13 +44,12 @@ import ru.sape.Sape; @WebServlet(name = "Main", urlPatterns = {"/"}) @MultipartConfig(fileSizeThreshold = 1024 * 1024, maxRequestSize = 1024 * 1024 * 10) public class Main extends HttpServlet implements Stream.StreamListener { - + Connection sql; Connection sqlSearch; Stream xmpp; Home home = new Home(); Discover discover = new Discover(); - Reader reader = new Reader(); PM pm = new PM(); Login login = new Login(); Help help = new Help(); @@ -60,29 +60,30 @@ public class Main extends HttpServlet implements Stream.StreamListener { VKontakteLogin loginVK = new VKontakteLogin(); SignUp signup = new SignUp(); Settings settings = new Settings(); - + RSS rss = new RSS(); + @Override public void init() throws ServletException { super.init(); try { Properties conf = new Properties(); conf.load(new FileInputStream("/etc/juick/www.conf")); - + Class.forName("com.mysql.jdbc.Driver"); sql = DriverManager.getConnection("jdbc:mysql://localhost/juick?autoReconnect=true&user=" + conf.getProperty("mysql_username", "") + "&password=" + conf.getProperty("mysql_password", "")); sqlSearch = DriverManager.getConnection("jdbc:mysql://127.0.0.1:9306?autoReconnect=true&characterEncoding=utf8&maxAllowedPacket=512000", "", ""); - + setupXmppComponent(conf.getProperty("xmpp_password")); - + PageTemplates.sape = new Sape(conf.getProperty("sape_user"), "juick.com", 2000, 3600); } catch (Exception e) { log(null, e); } } - + public void setupXmppComponent(final String password) { Thread thr = new Thread(new Runnable() { - + @Override public void run() { try { @@ -97,17 +98,17 @@ public class Main extends HttpServlet implements Stream.StreamListener { }); thr.start(); } - + @Override public void onStreamFail(String msg) { System.err.println("XMPP STREAM FAIL: " + msg); } - + @Override public void onStreamReady() { System.err.println("XMPP STREAM READY"); } - + @Override public void destroy() { super.destroy(); @@ -142,7 +143,7 @@ public class Main extends HttpServlet implements Stream.StreamListener { request.setCharacterEncoding("UTF-8"); } String uri = request.getRequestURI(); - + if (uri.equals("/")) { String tag = request.getParameter("tag"); if (tag != null) { @@ -151,10 +152,6 @@ public class Main extends HttpServlet implements Stream.StreamListener { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); home.doGet(sql, sqlSearch, request, response, visitor); } - } else if (uri.equals("/reader")) { - reader.doGet(sql, request, response); - } else if (uri.equals("/_out")) { - reader.doGetOut(sql, request, response); } else if (uri.equals("/post")) { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); if (visitor != null) { @@ -181,6 +178,14 @@ public class Main extends HttpServlet implements Stream.StreamListener { Errors.doGet404(sql, request, response); } } + } else if (uri.startsWith("/rss/")) { + String uname = uri.substring(5); + int uid = UserQueries.getUIDbyName(sql, uname); + if (uid > 0) { + rss.doGet(sql, request, response, uid, uname); + } else { + response.sendError(404); + } } else if (uri.equals("/logout")) { login.doGetLogout(sql, request, response); } else if (uri.equals("/settings")) { @@ -274,7 +279,7 @@ public class Main extends HttpServlet implements Stream.StreamListener { if (request.getCharacterEncoding() == null) { request.setCharacterEncoding("UTF-8"); } - + String uri = request.getRequestURI(); if (uri.equals("/post")) { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); diff --git a/src/java/com/juick/http/www/RSS.java b/src/java/com/juick/http/www/RSS.java new file mode 100644 index 00000000..ab96221e --- /dev/null +++ b/src/java/com/juick/http/www/RSS.java @@ -0,0 +1,113 @@ +/* + * Juick + * Copyright (C) 2008-2013, ugnich + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package com.juick.http.www; + +import com.juick.Message; +import com.juick.server.MessagesQueries; +import java.io.IOException; +import java.io.PrintWriter; +import java.sql.Connection; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author ugnich + */ +public class RSS { + + private static final SimpleDateFormat sdfSQL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + private static final SimpleDateFormat sdfRSS = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); + + protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response, int uid, String uname) throws ServletException, IOException { + ArrayList<Integer> mids = MessagesQueries.getUserBlog(sql, uid, 0, 0); + if (mids.isEmpty()) { + response.sendError(404); + return; + } + + ArrayList<Message> msgs = MessagesQueries.getMessages(sql, mids); + + response.setContentType("application/rss+xml; charset=UTF-8"); + PrintWriter out = response.getWriter(); + try { + out.println("<?xml version='1.0' encoding='utf-8'?>"); + out.println("<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom' xmlns:slash='http://purl.org/rss/1.0/modules/slash/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:media='http://search.yahoo.com/mrss/' xmlns:juick='http://juick.com/'>"); + out.println("<channel>"); + out.println("<atom:link href='http://rss.juick.com/" + uname + "/blog' rel='self' type='application/rss+xml'/>"); + out.println("<title>" + uname + " - Juick</title>"); + out.println("<link>http://juick.com/" + uname + "/</link>"); + out.println("<description>The latest messages by @" + uname + " at Juick</description>"); + out.println("<image><url>http://i.juick.com/a/" + uid + ".png</url><title>" + uname + " - Juick</title><link>http://juick.com/" + uname + "/</link></image>"); + + Iterator<Message> i = msgs.iterator(); + while (i.hasNext()) { + Message msg = i.next(); + + out.println("<item>"); + out.println("<link>http://juick.com/" + msg.User.UName + "/" + msg.MID + "</link>"); + out.println("<guid>http://juick.com/" + msg.User.UName + "/" + msg.MID + "</guid>"); + + out.print("<title><![CDATA[@" + msg.User.UName + ":"); + if (!msg.Tags.isEmpty()) { + for (int n = 0; n < msg.Tags.size(); n++) { + out.print(" *" + msg.Tags.get(n)); + } + } + out.println("]]></title>"); + out.println("<description><![CDATA[" + PageTemplates.formatMessage(msg.Text) + "]]></description>"); + + synchronized (sdfSQL) { + try { + Date date = sdfSQL.parse(msg.TimestampString); + out.println("<pubDate>" + sdfRSS.format(date) + "</pubDate>"); + } catch (Exception e) { + System.err.println("PARSE EXCEPTION: " + msg.TimestampString); + } + } + + out.println("<comments>http://juick.com/" + msg.User.UName + "/" + msg.MID + "</comments>"); + if (!msg.Tags.isEmpty()) { + for (int n = 0; n < msg.Tags.size(); n++) { + out.println("<category>" + msg.Tags.get(n) + "</category>"); + } + } + if (msg.AttachmentType != null) { + if (msg.AttachmentType.equals("jpg")) { + out.println("<media:content url='http://i.juick.com/photos-1024/" + msg.MID + ".jpg' type='image/jpeg'/>"); + out.println("<media:thumbnail url='http://i.juick.com/ps/" + msg.MID + ".jpg'/>"); + } else if (msg.AttachmentType.equals("png")) { + out.println("<media:content url='http://i.juick.com/photos-1024/" + msg.MID + ".png' type='image/png'/>"); + out.println("<media:thumbnail url='http://i.juick.com/ps/" + msg.MID + ".png'/>"); + } + } + out.println("<juick:user uid='" + msg.User.UID + "'/>"); + out.println("</item>"); + } + + out.println("</channel></rss>"); + } finally { + out.close(); + } + } +} diff --git a/src/java/com/juick/http/www/Reader.java b/src/java/com/juick/http/www/Reader.java deleted file mode 100644 index 75a0e774..00000000 --- a/src/java/com/juick/http/www/Reader.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Juick - * Copyright (C) 2008-2011, Ugnich Anton - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -package com.juick.http.www; - -import com.juick.server.MessagesQueries; -import com.juick.server.TagQueries; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * - * @author Ugnich Anton - */ -public class Reader { - - protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - com.juick.User visitor = Utils.getVisitorUser(sql, request, response); - - response.setContentType("text/html; charset=UTF-8"); - PrintWriter out = response.getWriter(); - try { - String head = "<meta name=\"robots\" content=\"noindex,nofollow\"/>"; - PageTemplates.pageHead(out, "Ссылки", head); - PageTemplates.pageNavigation(out, visitor, null); - out.println("<section id=\"content\" style=\"width: 95%; margin-left: 15px\">"); - - out.println("<ul id=\"readerlinks\">"); - - PreparedStatement stmt = null; - ResultSet rs = null; - try { - stmt = sql.prepareStatement("SELECT link_id,rss_id,url,title FROM reader_links ORDER BY ts DESC LIMIT 100"); - rs = stmt.executeQuery(); - rs.beforeFirst(); - while (rs.next()) { - out.println("<li><img src=\"//i.juick.com/rss-icons/" + rs.getInt(2) + ".png\" width=\"16\" height=\"16\"/><a href=\"" + rs.getString(3) + "\" data-lid=\""+rs.getInt(1)+"\" onmousedown=\"readerLinkReplace(this)\" rel=\"nofollow\" target=\"_blank\">" + rs.getString(4) + "</a></li>"); - } - } catch (SQLException e) { - System.err.println(e); - } finally { - Utils.finishSQL(rs, stmt); - } - - out.println("</ul>"); - - out.println("</section>"); - PageTemplates.pageFooter(request, out, visitor, true); - PageTemplates.pageEnd(out); - } finally { - out.close(); - } - } - - protected void doGetOut(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - com.juick.User visitor = Utils.getVisitorUser(sql, request, response); - int lid = Utils.parseInt(request.getParameter("lid"), 0); - if (lid == 0) { - response.sendError(404); - return; - } - - String url = null; - - PreparedStatement stmt = null; - ResultSet rs = null; - try { - stmt = sql.prepareStatement("SELECT url FROM reader_links WHERE link_id=?"); - stmt.setInt(1, lid); - rs = stmt.executeQuery(); - if (rs.first()) { - url = rs.getString(1); - } - } catch (SQLException e) { - System.err.println(e); - } finally { - Utils.finishSQL(rs, stmt); - } - - if (url == null) { - response.sendError(404); - return; - } - - Utils.sendTemporaryRedirect(response, url); - } -} diff --git a/src/java/com/juick/http/www/Utils.java b/src/java/com/juick/http/www/Utils.java index e20be893..afaf131e 100644 --- a/src/java/com/juick/http/www/Utils.java +++ b/src/java/com/juick/http/www/Utils.java @@ -188,6 +188,7 @@ public class Utils { in.close(); return b.toString(); } catch (Exception e) { + System.err.println("fetchURL: "+e.toString()); return null; } } diff --git a/web/logo3.png b/web/logo.png Binary files differindex 933f6099..933f6099 100644 --- a/web/logo3.png +++ b/web/logo.png diff --git a/web/map.js b/web/map.js deleted file mode 100644 index 4359727f..00000000 --- a/web/map.js +++ /dev/null @@ -1,182 +0,0 @@ -var map; -var mc; -var icon=new GIcon(G_DEFAULT_ICON,"http://maps.google.com/mapfiles/marker_orange.png"); - -function mapInit() { - var lat=getHashVar("lat"); - var lon=getHashVar("lon"); - var zoom=getHashVar("zoom"); - if(!lat || !lon || !zoom) { - lat=readCookie("lat"); - lon=readCookie("lon"); - zoom=readCookie("zoom"); - if(!lat || !lon || !zoom) { - lat=30; - lon=0; - zoom=2; - } - else { - lat=parseFloat(lat); - lon=parseFloat(lon); - zoom=parseInt(zoom); - } - } else { - lat=parseFloat(lat); - lon=parseFloat(lon); - zoom=parseInt(zoom); - } - - map=new GMap2(document.getElementById("geomap")); - map.setCenter(new GLatLng(lat,lon),zoom,G_HYBRID_MAP); - map.addControl(new GMapTypeControl()); - map.enableScrollWheelZoom(); - map.addControl(new GLargeMapControl(),new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(-10,-60))); - - mc=new MarkerClusterer(map,null,{ - gridSize:40, - maxZoom:15 - }); - - GEvent.addListener(map,"moveend",mapLoadMarkers); - GEvent.addListener(map,"zoomend",mapLoadMarkers); - - mapLoadMarkers(); -} - -function mapLoadMarkers() { - var mapcenter=map.getCenter(); - var lat=Math.round(mapcenter.lat()*100000)/100000; - var lon=Math.round(mapcenter.lng()*100000)/100000; - window.location.hash.replace("#lat="+lat+"&lon="+lon+"&zoom="+map.getZoom()); - writeCookie("lat",lat,365,"/map"); - writeCookie("lon",lon,365,"/map"); - writeCookie("zoom",map.getZoom(),365,"/map"); - - var bounds=map.getBounds(); - var swlat=bounds.getSouthWest().lat(); - if(swlat<-90) swlat=-90; - var swlng=bounds.getSouthWest().lng(); - if(swlng<-180) swlng=-180; - - var nelat=bounds.getNorthEast().lat(); - if(nelat>90) nelat=90; - var nelng=bounds.getNorthEast().lng(); - if(nelng>180) nelng=180; - - if(nelng<swlng) { - var tmp=nelng; - nelng=swlng; - swlng=tmp; - } - - var nodes=document.getElementsByClassName("loadScript"); - for(var i=0; i<nodes.length; i++) - nodes[i].parentNode.removeChild(nodes[i]); - loadScript("http://api.juick.com/places?south="+swlat+"&west="+swlng+"&north="+nelat+"&east="+nelng+"&count=75&callback=mapParsePlaces"); - loadScript("http://api.juick.com/messages?south="+swlat+"&west="+swlng+"&north="+nelat+"&east="+nelng+"&callback=mapParseMessages"); -} - -function loadScript(src) { - var scripttag=document.createElement("script"); - scripttag.setAttribute("type","text/javascript"); - scripttag.setAttribute("src",src); - scripttag.setAttribute("class","loadScript"); - document.getElementsByTagName("head")[0].appendChild(scripttag); -} - -function mapParsePlaces(json) { - var places=document.getElementById("places"); - while(places.hasChildNodes()) places.removeChild(places.lastChild); - var markers=[]; - for(var i=0; i<json.length; i++) { - markers.push( - createMarker( - json[i].pid, - new GLatLng(parseFloat(json[i].lat),parseFloat(json[i].lon)), - json[i].name, - "http://juick.com/places/"+json[i].pid, - icon - ) - ); - if(i<10) { - var li=document.createElement("li"); - li.innerHTML='<li><a href="/places/'+json[i].pid+'">'+json[i].name+'</a></li>'; - places.appendChild(li); - } - } - mc.clearMarkers(); - mc.addMarkers(markers); -} - -function mapParseMessages(json) { - var msgs=document.getElementById("messages"); - while(msgs.hasChildNodes()) msgs.removeChild(msgs.lastChild); - for(var i=0; i<json.length; i++) { - var replies=json[i].replies; - if(!replies) replies=0; - var ihtml='<div class="msg"><big><a href="/'+json[i].user.uname+'/">@'+json[i].user.uname+'</a>:'; - if(json[i].tags) - for(var n=0; n<json[i].tags.length; n++) - ihtml+=' <a href="/'+json[i].user.uname+'/?tag='+json[i].tags[n]+'">*'+json[i].tags[n]+'</a>'; - ihtml+='</big><div class="msgtxt">'; - if(json[i].location) - ihtml+='<b>Location:</b> <a href="/places/'+json[i].location.place_id+'">'+json[i].location.name+'</a><br/>'; - if(json[i].photo) - ihtml+='<b>Attachment:</b> <a href="'+json[i].photo.medium+'">Photo</a><br/>'; - if(json[i].video) - ihtml+='<b>Attachment:</b> <a href="'+json[i].video.mp4+'">Video</a><br/>'; - ihtml+=json[i].body+'</div><div class="msgbottom"><div class="msgnum"><a href="/'+json[i].user.uname+'/'+json[i].mid+'">#'+json[i].mid+'</a></div><div class="msginfo"><a href="/'+json[i].user.uname+'/'+json[i].mid+'">replies: '+replies+'</a></div></div></div>'; - - var li=document.createElement("li"); - li.className='liav'; - li.style.backgroundImage='url(http://i.juick.com/as/'+json[i].user.uid+'.png)'; - li.innerHTML=ihtml; - msgs.appendChild(li); - } -} - -function createMarker(id,latlng,title,href,icon) { - var marker=new GMarker(latlng,{ - 'icon':icon, - 'title':title - }); - marker.param=id; - if(href && href!="") - GEvent.addListener(marker,"click",function(ll) { - var txt='<a href="'+href+'">'+title+'</a>'; - map.openInfoWindowHtml(ll,txt); - }); - return marker; -} - -function getHashVar(variable) { - var query=window.location.hash.substring(1); - var vars=query.split("&"); - for(var i=0; i<vars.length; i++) { - var pair=vars[i].split("="); - if(pair[0]==variable) return pair[1]; - } - return null; -} - -function writeCookie(name,value,days,path) { - var expires; - if(days) { - var date=new Date(); - date.setTime(date.getTime()+(days*24*60*60*1000)); - expires="; expires="+date.toGMTString(); - } else expires=""; - if(!path) path="/"; - document.cookie=name+"="+value+expires+"; path="+path; -} - -function readCookie(name) { - var nameEQ=name+"="; - var ca=document.cookie.split(';'); - for(var i=0; i<ca.length; i++) { - var c=ca[i]; - while(c.charAt(0)==' ') c=c.substring(1,c.length); - if(c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length); - } - return null; -} diff --git a/web/maps.js b/web/maps.js deleted file mode 100644 index 2ae8cd8e..00000000 --- a/web/maps.js +++ /dev/null @@ -1,222 +0,0 @@ -var map; -var mc; -var mapParams; -var mapBounds=null; -var cross=null; -var jcontrol=null; -var crossOnMap=false; - -function mapInitAny() { - map=new GMap2(document.getElementById("geomap")); - map.setMapType(G_HYBRID_MAP); - map.addControl(new GMapTypeControl()); - map.enableScrollWheelZoom(); -} - -function mapInitSimple(lat,lng,iconcolor) { - mapInitAny(); - map.addControl(new GSmallZoomControl()); - map.setCenter(new GLatLng(lat,lng),15); - - var icon=new GIcon(G_DEFAULT_ICON); - if(iconcolor && iconcolor!='red') icon.image="http://maps.google.com/mapfiles/marker_"+iconcolor+".png"; - - map.addOverlay(new GMarker(new GLatLng(lat,lng),{ - 'icon':icon, - 'clickable':false - })); -} - -function mapInit(params,autozoom,place) { - mapParams=params; - - mapInitAny(); - map.addControl(new GLargeMapControl(),new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(-10,-60))); - if(place) { - jcontrol=new JuickControl(); - cross=new GScreenOverlay('http://static.juick.com/cross.png', - new GScreenPoint(0.5, .5, 'fraction', 'fraction'), - new GScreenPoint(9, 9), - new GScreenSize(19, 19) - ); - } - map.setCenter(new GLatLng(30,0),2); - - mc=new MarkerClusterer(map,null,{ - gridSize:40, - maxZoom:15 - }); - - GEvent.addListener(map,"moveend",mapLoadMarkers); - GEvent.addListener(map,"zoomend",mapLoadMarkers); - - if(autozoom==1 && navigator.geolocation) navigator.geolocation.getCurrentPosition(mapSetCenter,null,{ - timeout:5 - }); - else mapLoadMarkers(autozoom); -} - -// call loadMarkers even if getCurrentPosition failed - -function mapSetCenter(pos) { - map.setCenter(new GLatLng(pos.coords.latitude,pos.coords.longitude),11); - mapLoadMarkers(); -} - -function mapLoadMarkers(zoomOld) { - var zoom=map.getZoom(); - if(zoom>14 && cross!=null && !crossOnMap) { - map.addControl(jcontrol); - map.addOverlay(cross); - crossOnMap=true; - } - if(zoom<=14 && cross!=null && crossOnMap) { - map.removeControl(jcontrol); - map.removeOverlay(cross); - crossOnMap=false; - } - - var bounds=map.getBounds(); - if(mapBounds==null || !mapBounds.containsBounds(bounds) || zoomOld>0) { - var span=bounds.toSpan(); - - var swlat=bounds.getSouthWest().lat()-span.lat()/3; - if(swlat<-90) swlat=-90; - var swlng=bounds.getSouthWest().lng()-span.lng()/3; - if(swlng<-180) swlng=-180; - - var nelat=bounds.getNorthEast().lat()+span.lat()/3; - if(nelat>90) nelat=90; - var nelng=bounds.getNorthEast().lng()+span.lng()/3; - if(nelng>180) nelng=180; - - mapBounds=new GLatLngBounds(new GLatLng(swlat,swlng),new GLatLng(nelat,nelng)); - - var q="/_mapxml?"+mapParams+"&south="+swlat+"&west="+swlng+"&north="+nelat+"&east="+nelng; - GDownloadUrl(q,function(data) { - var xmlmarkers=GXml.parse(data).documentElement.getElementsByTagName("marker"); - var markers=[]; - var mbounds=new GLatLngBounds(); - var icon; - var iconcolor="null"; - for(var i=0; i<xmlmarkers.length; i++) { - var latlng=new GLatLng(parseFloat(xmlmarkers[i].getAttribute("lat")),parseFloat(xmlmarkers[i].getAttribute("lon"))); - var iconcolornew=xmlmarkers[i].getAttribute("color"); - if(iconcolor!=iconcolornew) { - iconcolor=iconcolornew; - icon=new GIcon(G_DEFAULT_ICON); - if(iconcolor!="" && iconcolor!='red') icon.image="http://maps.google.com/mapfiles/marker_"+iconcolor+".png"; - } - markers.push( - createMarker( - xmlmarkers[i].getAttribute("param"), - latlng, - xmlmarkers[i].getAttribute("title"), - xmlmarkers[i].getAttribute("href"), - icon - ) - ); - if(zoomOld==-1) mbounds.extend(latlng); - } - mc.clearMarkers(); - mc.addMarkers(markers); - if(zoomOld==-1) { - var zoom=map.getBoundsZoomLevel(mbounds)-1; - if(zoom>14) zoom=14; - else if(zoom<1) zoom=1; - map.setCenter(mbounds.getCenter(),zoom); - } - }); - } -} - -function createMarker(id,latlng,title,href,icon) { - var marker=new GMarker(latlng,{ - 'icon':icon, - 'title':title - }); - marker.param=id; - if(href && href!="") - GEvent.addListener(marker,"click",function(ll) { - var txt='<a href="'+href+'">'+title+'</a>'; - map.openInfoWindowHtml(ll,txt); - }); - return marker; -} - -// - -function JuickControl() {} -JuickControl.prototype = new GControl(); -JuickControl.prototype.initialize = function(map) { - var container = document.createElement("div"); - - var bAddPlace = document.createElement("div"); - this.setButtonStyle_(bAddPlace); - container.appendChild(bAddPlace); - bAddPlace.appendChild(document.createTextNode("Add place")); - GEvent.addDomListener(bAddPlace, "click", this.onAddPlaceClick); - map.getContainer().appendChild(container); - return container; -} - -JuickControl.prototype.getDefaultPosition = function() { - return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 35)); -} - -JuickControl.prototype.setButtonStyle_ = function(button) { - button.style.color = "#000000"; - button.style.backgroundColor = "white"; - button.style.font = "small Arial"; - button.style.border = "1px solid black"; - button.style.padding = "2px"; - button.style.marginBottom = "5px"; - button.style.textAlign = "center"; - button.style.width = "6em"; - button.style.cursor = "pointer"; -} - -var htmlAddPlace='<form><p style="width: 440px"><b>Name:</b><br/>\ -<input type="text" name="description" maxlength="64" style="width: 400px"/><br/>\ -Tags (separated by space, 10 max):\ -<input type="text" name="tags" maxlength="255" style="width: 400px"/></p>\ -<p style="width: 400px; text-align: right; margin-bottom: 0"><input type="button" value=" Add " onclick="addPlace(this.form)"/></p>\ -</form>'; - -var placeLatLng; - -JuickControl.prototype.onAddPlaceClick = function() { - placeLatLng=map.getCenter(); - map.removeOverlay(cross); - map.openInfoWindowHtml(placeLatLng,htmlAddPlace,{ - onCloseFn:function() { - map.panTo(placeLatLng); - map.addOverlay(cross); - } - }); -} - -function addPlace(form) { - var description=form.description.value; - if(description=='') { - alert('Enter place name.'); - return; - } - var tags=form.tags.value; - map.closeInfoWindow(); - GDownloadUrl("/_mapxml",function(data) { - var xmlmarkers=GXml.parse(data).documentElement.getElementsByTagName("marker"); - - var icon=new GIcon(G_DEFAULT_ICON); - icon.image="http://maps.google.com/mapfiles/marker_orange.png"; - var markers=[]; - markers.push(createMarker( - xmlmarkers[0].getAttribute("param"), - placeLatLng, - description, - xmlmarkers[0].getAttribute("href"), - icon - )); - mc.addMarkers(markers); - },'lat='+placeLatLng.lat()+'&lon='+placeLatLng.lng()+'&description='+escape(description)+'&tags='+escape(tags)); -} diff --git a/web/mc.js b/web/mc.js deleted file mode 100644 index 986d19ac..00000000 --- a/web/mc.js +++ /dev/null @@ -1 +0,0 @@ -eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 37(n,v,w){4 o=[];4 m=n;4 t=z;4 q=3;4 r=20;4 x=[36,30,2R,2E,2z];4 s=[];4 u=[];4 p=z;4 i=0;A(i=1;i<=5;++i){s.O({\'18\':"1V://35-31-2Z.2W.2Q/2K/2C/2B/2y/m"+i+".2u",\'S\':x[i-1],\'Z\':x[i-1]})}6(F w==="X"&&w!==z){6(F w.1f==="13"&&w.1f>0){r=w.1f}6(F w.1y==="13"){t=w.1y}6(F w.14==="X"&&w.14!==z&&w.14.9!==0){s=w.14}}7 1t(){6(u.9===0){8}4 a=[];A(i=0;i<u.9;++i){q.Q(u[i],G,z,z,G)}u=a}3.1s=7(){8 s};3.12=7(){A(4 i=0;i<o.9;++i){6(F o[i]!=="1Y"&&o[i]!==z){o[i].12()}}o=[];u=[];17.1W(p)};7 1p(a){8 m.1b().34(a.1o())}7 1S(a){4 c=a.9;4 b=[];A(4 i=c-1;i>=0;--i){q.Q(a[i].C,G,a[i].I,b,G)}1t()}3.Q=7(g,j,b,h,a){6(a!==G){6(!1p(g)){u.O(g);8}}4 f=b;4 d=h;4 e=m.M(g.1o());6(F f!=="2A"){f=T}6(F d!=="X"||d===z){d=o}4 k=d.9;4 c=z;A(4 i=k-1;i>=0;i--){c=d[i];4 l=c.1L();6(l===z){1I}l=m.M(l);6(e.x>=l.x-r&&e.x<=l.x+r&&e.y>=l.y-r&&e.y<=l.y+r){c.Q({\'I\':f,\'C\':g});6(!j){c.L()}8}}c=R 1J(3,n);c.Q({\'I\':f,\'C\':g});6(!j){c.L()}d.O(c);6(d!==o){o.O(c)}};3.1C=7(a){A(4 i=0;i<o.9;++i){6(o[i].1K(a)){o[i].L();8}}};3.L=7(){4 a=3.1j();A(4 i=0;i<a.9;++i){a[i].L(G)}};3.1j=7(){4 b=[];4 a=m.1b();A(4 i=0;i<o.9;i++){6(o[i].1n(a)){b.O(o[i])}}8 b};3.1N=7(){8 t};3.1M=7(){8 m};3.1e=7(){8 r};3.Y=7(){4 a=0;A(4 i=0;i<o.9;++i){a+=o[i].Y()}8 a};3.29=7(){8 o.9};3.1A=7(){4 d=3.1j();4 e=[];4 f=0;A(4 i=0;i<d.9;++i){4 c=d[i];4 b=c.1x();6(b===z){1I}4 a=m.W();6(a!==b){4 h=c.1w();A(4 j=0;j<h.9;++j){4 g={\'I\':T,\'C\':h[j].C};e.O(g)}c.12();f++;A(j=0;j<o.9;++j){6(c===o[j]){o.1v(j,1)}}}}1S(e);3.L()};3.1u=7(a){A(4 i=0;i<a.9;++i){3.Q(a[i],G)}3.L()};6(F v==="X"&&v!==z){3.1u(v)}p=17.27(m,"26",7(){q.1A()})}7 1J(h){4 o=z;4 n=[];4 m=h;4 j=h.1M();4 l=z;4 k=j.W();3.1w=7(){8 n};3.1n=7(c){6(o===z){8 T}6(!c){c=j.1b()}4 g=j.M(c.25());4 a=j.M(c.24());4 b=j.M(o);4 e=G;4 f=h.1e();6(k!==j.W()){4 d=j.W()-k;f=23.22(2,d)*f}6(a.x!==g.x&&(b.x+f<g.x||b.x-f>a.x)){e=T}6(e&&(b.y+f<a.y||b.y-f>g.y)){e=T}8 e};3.1L=7(){8 o};3.Q=7(a){6(o===z){o=a.C.1o()}n.O(a)};3.1C=7(a){A(4 i=0;i<n.9;++i){6(a===n[i].C){6(n[i].I){j.1c(n[i].C)}n.1v(i,1);8 G}}8 T};3.1x=7(){8 k};3.L=7(b){6(!b&&!3.1n()){8}k=j.W();4 i=0;4 a=h.1N();6(a===z){a=j.21().1Z()}6(k>=a||3.Y()===1){A(i=0;i<n.9;++i){6(n[i].I){6(n[i].C.11()){n[i].C.1a()}}N{j.1r(n[i].C);n[i].I=G}}6(l!==z){l.1k()}}N{A(i=0;i<n.9;++i){6(n[i].I&&(!n[i].C.11())){n[i].C.1k()}}6(l===z){l=R E(o,3.Y(),m.1s(),m.1e());j.1r(l)}N{6(l.11()){l.1a()}l.1q(G)}}};3.12=7(){6(l!==z){j.1c(l)}A(4 i=0;i<n.9;++i){6(n[i].I){j.1c(n[i].C)}}n=[]};3.Y=7(){8 n.9}}7 E(a,c,d,b){4 f=0;4 e=c;1X(e!==0){e=V(e/10,10);f++}6(d.9<f){f=d.9}3.16=d[f-1].18;3.H=d[f-1].S;3.P=d[f-1].Z;3.19=d[f-1].1U;3.D=d[f-1].32;3.15=a;3.1T=f;3.1R=d;3.1m=c;3.1l=b}E.J=R 2Y();E.J.2X=7(i){3.1P=i;4 j=1O.2V("2U");4 h=3.15;4 f=i.M(h);f.x-=V(3.P/2,10);f.y-=V(3.H/2,10);4 g="";6(1O.2T){g=\'2S:2P:2O.2M.2L(2J=2I,2H="\'+3.16+\'");\'}N{g="2G:18("+3.16+");"}6(F 3.D==="X"){6(F 3.D[0]==="13"&&3.D[0]>0&&3.D[0]<3.H){g+=\'S:\'+(3.H-3.D[0])+\'B;1H-1g:\'+3.D[0]+\'B;\'}N{g+=\'S:\'+3.H+\'B;1G-S:\'+3.H+\'B;\'}6(F 3.D[1]==="13"&&3.D[1]>0&&3.D[1]<3.P){g+=\'Z:\'+(3.P-3.D[1])+\'B;1H-1i:\'+3.D[1]+\'B;\'}N{g+=\'Z:\'+3.P+\'B;1F-1E:1D;\'}}N{g+=\'S:\'+3.H+\'B;1G-S:\'+3.H+\'B;\';g+=\'Z:\'+3.P+\'B;1F-1E:1D;\'}4 k=3.19?3.19:\'2x\';j.U.2w=g+\'2v:2t;1g:\'+f.y+"B;1i:"+f.x+"B;2D:"+k+";2s:2F;1h-2r:2q;"+\'1h-2p:2o,2n-2m;1h-2N:2l\';j.2k=3.1m;i.2j(2i).2h(j);4 e=3.1l;17.2g(j,"2f",7(){4 a=i.M(h);4 d=R 1Q(a.x-e,a.y+e);d=i.1B(d);4 b=R 1Q(a.x+e,a.y-e);b=i.1B(b);4 c=i.2e(R 2d(d,b),i.2c());i.2b(h,c)});3.K=j};E.J.1K=7(){3.K.2a.33(3.K)};E.J.28=7(){8 R E(3.15,3.1T,3.1m,3.1R,3.1l)};E.J.1q=7(a){6(!a){8}4 b=3.1P.M(3.15);b.x-=V(3.P/2,10);b.y-=V(3.H/2,10);3.K.U.1g=b.y+"B";3.K.U.1i=b.x+"B"};E.J.1k=7(){3.K.U.1d="1z"};E.J.1a=7(){3.K.U.1d=""};E.J.11=7(){8 3.K.U.1d==="1z"};',62,194,'|||this|var||if|function|return|length||||||||||||||||||||||||||null|for|px|marker|anchor_|ClusterMarker_|typeof|true|height_|isAdded|prototype|div_|redraw_|fromLatLngToDivPixel|else|push|width_|addMarker|new|height|false|style|parseInt|getZoom|object|getTotalMarkers|width||isHidden|clearMarkers|number|styles|latlng_|url_|GEvent|url|textColor_|show|getBounds|removeOverlay|display|getGridSize_|gridSize|top|font|left|getClustersInViewport_|hide|padding_|text_|isInBounds|getLatLng|isMarkerInViewport_|redraw|addOverlay|getStyles_|addLeftMarkers_|addMarkers|splice|getMarkers|getCurrentZoom|maxZoom|none|resetViewport|fromDivPixelToLatLng|removeMarker|center|align|text|line|padding|continue|Cluster|remove|getCenter|getMap_|getMaxZoom_|document|map_|GPoint|styles_|reAddMarkers_|index_|opt_textColor|http|removeListener|while|undefined|getMaximumResolution|60|getCurrentMapType|pow|Math|getNorthEast|getSouthWest|moveend|addListener|copy|getTotalClusters|parentNode|setCenter|getSize|GLatLngBounds|getBoundsZoomLevel|click|addDomListener|appendChild|G_MAP_MAP_PANE|getPane|innerHTML|bold|serif|sans|Arial|family|11px|size|position|pointer|png|cursor|cssText|black|images|90|boolean|markerclusterer|trunk|color|78|absolute|background|src|scale|sizingMethod|svn|AlphaImageLoader|Microsoft|weight|DXImageTransform|progid|com|66|filter|all|div|createElement|googlecode|initialize|GOverlay|library|56|utility|opt_anchor|removeChild|containsLatLng|gmaps|53|MarkerClusterer'.split('|'),0,{}))
\ No newline at end of file diff --git a/web/post3.js b/web/post3.js deleted file mode 100644 index cde36711..00000000 --- a/web/post3.js +++ /dev/null @@ -1,42 +0,0 @@ -if(window!=window.top) { - window.top.location.href='http://juick.com/post'; -} - -function clearLocation() { - document.getElementById("location").innerHTML='<a href="#" onclick="addLocation()">Choose</a>'; - document.getElementById("locationclear").style.display="none"; - document.getElementById("geomap").style.display="none"; - document.forms["postmsg"].place_id.value=0; -} - -function addLocation() { - document.getElementById("location").innerHTML="?"; - document.getElementById("locationclear").style.display="inline"; - document.getElementById("geomap").style.display="block"; - if(!map) { - mapInit('show=places',1,1); - GEvent.addListener(map,"click", function(overlay) { - if(overlay instanceof GMarker) { - document.getElementById("location").innerHTML='<a href="/places/'+overlay.param+'">'+overlay.getTitle()+'</a>'; - document.forms["postmsg"].place_id.value=overlay.param; - } - }); - } -} - -function addTag(tag) { - var s = document.forms["postmsg"].body.value; - if (s.indexOf ('#') == 0) { - document.forms["postmsg"].body.value = s + ' *' + tag; - } else { - document.forms["postmsg"].body.value = '*' + tag + ' ' + s; - } - return false; -} - -$(document).ready(function() { - clearLocation(); - $("textarea")[0].focus(); -}); - -$(window).unload(GUnload); diff --git a/web/scripts3.js b/web/scripts.js index c420dcdb..c420dcdb 100644 --- a/web/scripts3.js +++ b/web/scripts.js diff --git a/web/style3.css b/web/style.css index ea069c25..ea069c25 100644 --- a/web/style3.css +++ b/web/style.css |