Permalink
Browse files

Mobile enhancements.

  • Loading branch information...
1 parent f81c6b9 commit 52de7bafc4495cad94ed1ae1e606be1bd020a89b @livid committed Jan 13, 2012
View
79 main.py
@@ -96,29 +96,6 @@ def get(self):
i = i + 1
memcache.set('home_nodes_new', nodes_new, 86400)
template_values['nodes_new'] = nodes_new
- if browser['ios']:
- s = ''
- s = memcache.get('home_sections_neue')
- if (s == None):
- s = ''
- q = db.GqlQuery("SELECT * FROM Section ORDER BY created ASC")
- if (q.count() > 0):
- for section in q:
- q2 = db.GqlQuery("SELECT * FROM Node WHERE section_num = :1 ORDER BY created ASC", section.num)
- n = ''
- if (q2.count() > 0):
- nodes = []
- i = 0
- for node in q2:
- nodes.append(node)
- i = i + 1
- random.shuffle(nodes)
- for node in nodes:
- fs = random.randrange(12, 16)
- n = n + '<a href="/go/' + node.name + '" style="font-size: ' + str(fs) + 'px;">' + node.title + '</a>&nbsp; '
- s = s + '<div class="section">' + section.title + '</div><div class="cell">' + n + '</div>'
- memcache.set('home_sections_neue', s, 86400)
- template_values['s'] = s
ignored = ['newbie', 'in', 'flamewar', 'pointless', 'tuan', '528491', 'chamber', 'autistic', 'blog', 'love', 'flood', 'beforesunrise', 'diary']
if browser['ios']:
home_rendered = memcache.get('home_rendered_mobile')
@@ -185,39 +162,35 @@ def get(self):
reply_total = 0
memcache.set('reply_total', reply_total, 3600)
template_values['reply_total'] = reply_total
+ hottest = memcache.get('index_hottest_sidebar')
+ if hottest is None:
+ qhot = db.GqlQuery("SELECT * FROM Node ORDER BY topics DESC LIMIT 25")
+ hottest = u''
+ for node in qhot:
+ hottest = hottest + '<a href="/go/' + node.name + '" class="item_node">' + node.title + '</a>'
+ memcache.set('index_hottest_sidebar', hottest, 86400)
+ template_values['index_hottest_sidebar'] = hottest
+ c = memcache.get('index_categories')
+ if c is None:
+ c = ''
+ i = 0
+ if site.home_categories is not None:
+ categories = site.home_categories.split("\n")
+ else:
+ categories = []
+ for category in categories:
+ category = category.strip()
+ i = i + 1
+ c = c + '<div class="cell"><table cellpadding="0" cellspacing="0" border="0"><tr><td align="right" width="60"><span class="fade">' + category + '</span></td><td style="line-height: 200%; padding-left: 10px;">'
+ qx = db.GqlQuery("SELECT * FROM Node WHERE category = :1 ORDER BY topics DESC", category)
+ for node in qx:
+ c = c + '<a href="/go/' + node.name + '" style="font-size: 14px;">' + node.title + '</a>&nbsp; &nbsp; '
+ c = c + '</td></tr></table></div>'
+ memcache.set('index_categories', c, 86400)
+ template_values['c'] = c
if (browser['ios']):
path = os.path.join(os.path.dirname(__file__), 'tpl', 'mobile', 'index.html')
else:
- hottest = memcache.get('index_hottest_sidebar')
- if hottest is None:
- qhot = db.GqlQuery("SELECT * FROM Node ORDER BY topics DESC LIMIT 25")
- hottest = u''
- for node in qhot:
- hottest = hottest + '<a href="/go/' + node.name + '" class="item_node">' + node.title + '</a>'
- memcache.set('index_hottest_sidebar', hottest, 86400)
- template_values['index_hottest_sidebar'] = hottest
- c = memcache.get('index_categories')
- if c is None:
- c = ''
- i = 0
- if site.home_categories is not None:
- categories = site.home_categories.split("\n")
- else:
- categories = []
- for category in categories:
- category = category.strip()
- i = i + 1
- if i == len(categories):
- css_class = 'inner'
- else:
- css_class = 'cell'
- c = c + '<div class="' + css_class + '"><table cellpadding="0" cellspacing="0" border="0"><tr><td align="right" width="60"><span class="fade">' + category + '</span></td><td style="line-height: 200%; padding-left: 15px;">'
- qx = db.GqlQuery("SELECT * FROM Node WHERE category = :1 ORDER BY topics DESC", category)
- for node in qx:
- c = c + '<a href="/go/' + node.name + '" style="font-size: 14px;">' + node.title + '</a>&nbsp; &nbsp; '
- c = c + '</td></tr></table></div>'
- memcache.set('index_categories', c, 86400)
- template_values['c'] = c
path = os.path.join(os.path.dirname(__file__), 'tpl', 'desktop', 'index.html')
output = template.render(path, template_values)
self.response.out.write(output)
View
@@ -71,7 +71,7 @@ def get(self):
memcache.set('nn::' + self.member.username_lower, notifications, 360)
self.values['notifications'] = notifications
self.set_title(u'提醒系统')
- self.finalize(template_name='notifications')
+ self.finalize(template_name='notifications', mobile_optimized=True)
else:
self.redirect('/signin')
@@ -62,7 +62,7 @@ a.black:link, a.black:visited, a.black:active {
a.black:hover {
color: rgba(0, 0, 0, 1);
text-decoration: underline;
- text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.2);
+ text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.2);
}
form {
@@ -193,7 +193,7 @@ h1 {
color: #333;
font-weight: bold;
padding: 3px 5px 5px 5px;
- text-shadow: 0px 1px 1px rgba(255, 255, 255, 1);
+ text-shadow: 0px 1px 0px rgba(255, 255, 255, 1);
}
.cell {
@@ -362,6 +362,10 @@ td.avatar_mini {
outline: none;
}
+.fl {
+ float: left;
+}
+
.fr {
float: right;
}
@@ -437,6 +441,17 @@ input.btn {
color: #333;
}
+.payload {
+ display: inline-block;
+ background-color: #f5f5f5;
+ padding: 5px 10px 5px 10px;
+ font-size: 14px;
+ line-height: 120%;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
/* High Resolution (iPhone 4) */
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
@@ -22,8 +22,55 @@ <h1 style="padding-top: 0px;">Advertisers</h1>
<div class="cell">
<strong>Promoted by <a href="http://www.3cpeijian.com/" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', '3cpeijian.com');">3C 配件网</a></strong>
<div clas="sep5"></div>
- <strong class="fade">Reserved</strong>
+ <strong class="fade">Reserved from 1/8 to 1/17</strong>
<div class="sep5"></div>
+ C 配件网( <a href="http://www.3cpeijian.com/" target="_blank">www.3cpeijian.com</a> )是一家专营 3C 数码配件,全球集约式采购分销零售的线上商城。<br /><br />
+ 公司名称为北京创造世纪商贸有限公司,2011 年 1 月获得美国 Ten One Design 大中华区总经销代理其品牌下 fling / fling mini / pogo sketch / pogo sketch pro 产品。2011 年 5 月获得美国 Hub international 大中华区总经销代理其品牌下 handstand 产品。2011 年 11 月公司决定创建 3C 配件网,致力于网络零售与分销海外品牌营销。
+ <div class="sep20"></div>
+ <table cellpadding="10" cellspacing="0" border="0" width="100%">
+ <tr>
+ <td width="33%" valign="top">
+ <a href="http://3cpeijianwang.taobao.com/" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'taobao.com');"><img src="http://static.v2ex.com/banners/3c1.png" border="0" width="120" height="90" alt="pogo sketch pro" /></a>
+ <div class="sep5"></div>
+ <span style="font-size: 11px; color: #666;">
+ <strong style="color: #000;"><a href="http://3cpeijianwang.taobao.com/" class="black" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'taobao.com');">pogo sketch pro • 杰作,由此诞生</a></strong><div class="sep3"></div><span style="font-size: 12px;">一只精致的手写笔,它适用于任何角度,你有你自己的书写方式。全新的具有专利的笔头,让你随意更换,一定会是最适合你的。</span>
+ </span>
+ </td>
+ <td width="34%" valign="top">
+ <a href="http://3cpeijianwang.taobao.com/" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'taobao.com');"><img src="http://static.v2ex.com/banners/3c2.png" border="0" width="120" height="90" alt="pogo sketch" /></a>
+ <div class="sep5"></div>
+ <span style="font-size: 11px; color: #666;">
+ <strong style="color: #000;"><a href="http://3cpeijianwang.taobao.com/" class="black" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'taobao.com');">pogo sketch • 把触摸板变成绘画板!</a></strong><div class="sep3"></div><span style="font-size: 12px;">全新设计的金属夹子能够完美夹入口袋或 iPad 后壳。轻松的玩游戏、绘画、写字,你可以用 iPad 做更多的事情。泡沫笔端柔软,但牢固耐用,适合多种触摸屏。</span>
+ </span>
+ </td>
+ <td width="33%" valign="top">
+ <a href="http://3cpeijianwang.taobao.com/" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'taobao.com');"><img src="http://static.v2ex.com/banners/3c3.png" border="0" width="120" height="90" alt="fling" /></a>
+ <div class="sep5"></div>
+ <span style="font-size: 11px; color: #666;">
+ <strong style="color: #000;"><a href="http://3cpeijianwang.taobao.com/" class="black" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'taobao.com');">fling • 想念你玩游戏时的操作摇杆?</a></strong><div class="sep3"></div><span style="font-size: 12px;">fling 是由如丝般光滑的树脂制作,不够巴掌大小的 fling 弹性十足,获得了 Macworld Best Show 大奖。它已经完全可以让你忘却 PSP 了。</span>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="33%" valign="top">
+ <a href="http://3cpeijianwang.taobao.com/" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'taobao.com');"><img src="http://static.v2ex.com/banners/3c4.png" border="0" width="120" height="90" alt="fling mini" /></a>
+ <div class="sep5"></div>
+ <span style="font-size: 11px; color: #666;">
+ <strong style="color: #000;"><a href="http://3cpeijianwang.taobao.com/" class="black" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'taobao.com');">fling mini • 手机游戏原来可以这么玩</a></strong><div class="sep3"></div><span style="font-size: 12px;">支持数百种游戏:KOF,FIFA 让你在手机种找回街机的快感。多终端、多系统支持:Android、iOS 还是 Windows Phone、平板电脑?不用担心,它都能胜任!</span>
+ </span>
+ </td>
+ <td width="34%" valign="top">
+ <a href="http://3cpeijian.com/" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'iphoto.ly');"><img src="http://static.v2ex.com/banners/3c5.png" border="0" width="120" height="90" alt="3C 配件网" /></a>
+ <div class="sep5"></div>
+ <span style="font-size: 11px; color: #666;">
+ <strong style="color: #000;"><a href="http://3cpeijian.com/" class="black" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', '3cpeijian.com');">3C 配件网</a></strong><div class="sep3"></div><span style="font-size: 12px;">3C 配件网( <a href="http://3cpeijian.com/" target="_blank">www.3cpeijian.com</a> )是一家专营 3C 数码配件,全球集约式采购分销零售的线上商城。</span>
+ </span>
+ </td>
+ <td width="33%" valign="top">
+
+ </td>
+ </tr>
+ </table>
</div>
<div class="cell">
<strong>Promoted by <a href="http://www.appletuan.com/?utm_source=v2ex&utm_medium=banner&utm_campaign=V2EX" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'appletuan.com');">苹果团</a></strong>
@@ -1,7 +1,7 @@
<div id="Bottom">
- <div id="BottomMain"><div class="fr" align="right"><a href="http://www.linode.com/?r=af313ea8a6bb6f99aff800c67349cabbfee2682f" target="_blank"><img src="/static/img/linode.png" border="0" alt="Linode" /></a><div class="sep10"></div><strong><a href="http://www.linode.com/?r=af313ea8a6bb6f99aff800c67349cabbfee2682f" target="_blank">Linode - 互联网上最好的云主机</a></strong>
+ <div id="BottomMain"><div class="fr" align="right"><a href="http://www.linode.com/?r=af313ea8a6bb6f99aff800c67349cabbfee2682f" target="_blank"><img src="http://static.v2ex.com/logos/linode.png" border="0" alt="Linode" /></a><div class="sep10"></div><strong><a href="http://www.linode.com/?r=af313ea8a6bb6f99aff800c67349cabbfee2682f" target="_blank">Linode - 互联网上最好的云主机</a></strong>
</div>
- <strong><a href="/about" class="dark">关于</a></strong> &nbsp; | &nbsp; <strong><a href="/faq" class="dark">FAQ</a></strong> &nbsp; | &nbsp; <strong><a href="/mission" class="dark">我们的愿景</a></strong> &nbsp; | &nbsp; <strong><a href="/advertise" class="dark">广告投放</a></strong> &nbsp; | &nbsp; <strong><a href="https://workspace.v2ex.com/" class="dark" target="_blank">{{ l10n.workspace }}</a></strong> &nbsp; | &nbsp; <strong><a href="http://www.v2ex.com/start" class="dark" target="_blank">上网首页</a></strong>
+ <strong><a href="/about" class="dark">关于</a></strong> &nbsp; | &nbsp; <strong><a href="/faq" class="dark">FAQ</a></strong> &nbsp; | &nbsp; <strong><a href="/mission" class="dark">我们的愿景</a></strong> &nbsp; | &nbsp; <strong><a href="/advertise" class="dark">广告投放</a></strong> &nbsp; | &nbsp; <strong><a href="https://workspace.v2ex.com/" class="dark" target="_blank">{{ l10n.workspace }}</a></strong> &nbsp; | &nbsp; <strong><a href="http://www.v2ex.com/gadgetlab" class="dark">Gadget Lab</a></strong> &nbsp; | &nbsp; <strong><a href="http://www.v2ex.com/start" class="dark" target="_blank">上网首页</a></strong>
<div class="sep10"></div>
<div class="sep5"></div>
<span class="fade">{{ site.description }}</span>
@@ -1 +1 @@
-{% include 'rightbar/adsense.html' %}
+{% include 'rightbar/ads_3cpeijian.html' %}
View
@@ -43,7 +43,7 @@
<div class="fr snow" style="padding-left: 10px; padding-bottom: 10px;"><a href="/member/{{ topic.member.username }}">{{ topic.member|avatar:"large" }}</a></div>
<span class="bigger"><a href="/">{{ site.title }}</a> {{ l10n.chevron }} <a href="/go/{{ node.name}}">{{ node.title|escape }}</a></span>
<h1>{{ topic.title|escape }}</h1>
- <small class="fade">{% if site.use_topic_types %}{% if topic.type %}<span style="display: inline-block; background-color: {{ topic.type_color }}; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; color: #fff; padding: 0px 8px 0px 8px; font-size: 11px;">{{ topic.type }}</span> &nbsp;{% endif %}{% endif %}By <a href="/member/{{ topic.member.username }}" class="dark">{{ topic.created_by }}</a>{% if topic.source %} via {{ topic.source }}{% endif %} at {{ topic.created|timesince }} ago, {{ topic.hits }} hits{% ifequal member.level 0 %} &nbsp; <a href="#;" onclick="if (confirm('{{ l10n.sure_to_delete }} #{{ topic.num }} - {{ topic.title|escape }}')) { location = '/delete/topic/{{ topic.num }}?t={{ member.created_ts }}'; }" class="op">DELETE</a> <a href="/backstage/tidy/topic/{{ topic.num }}" class="op">TIDY</a>{% endifequal %}{% if can_move %} <a href="/backstage/move/topic/{{ topic.key }}" class="op">MOVE</a>{% endif %}{% if can_edit %} <a href="/edit/topic/{{ topic.num }}" class="op">EDIT</a>{% endif %}</small>
+ <small class="fade">{% if site.use_topic_types %}{% if topic.type %}<span style="display: inline-block; background-color: {{ topic.type_color }}; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; color: #fff; padding: 0px 8px 0px 8px; font-size: 11px;">{{ topic.type }}</span> &nbsp;{% endif %}{% endif %}By <a href="/member/{{ topic.member.username }}" class="dark">{{ topic.created_by }}</a>{% if topic.source %} via {{ topic.source }}{% endif %} at {{ topic.created|timesince }} ago{% ifnotequal topic.hits 0 %}, {{ topic.hits }} hits{% endifnotequal %}{% ifequal member.level 0 %} &nbsp; <a href="#;" onclick="if (confirm('{{ l10n.sure_to_delete }} #{{ topic.num }} - {{ topic.title|escape }}')) { location = '/delete/topic/{{ topic.num }}?t={{ member.created_ts }}'; }" class="op">DELETE</a> <a href="/backstage/tidy/topic/{{ topic.num }}" class="op">TIDY</a>{% endifequal %}{% if can_move %} <a href="/backstage/move/topic/{{ topic.key }}" class="op">MOVE</a>{% endif %}{% if can_edit %} <a href="/edit/topic/{{ topic.num }}" class="op">EDIT</a>{% endif %}</small>
</div>{% if topic.has_content %}
<div class="inner">
<div class="content topic_content">{{ topic.content_rendered }}</div>
@@ -141,7 +141,7 @@ <h1>{{ topic.title|escape }}</h1>
{% endif %}
</div>
<div class="cell">
- <textarea class="mll" name="content" id="reply_content" onkeyup="c();"></textarea>
+ <textarea class="mll" name="content" id="reply_content" style="height: 200px;" onkeyup="c();"></textarea>
<div class="sep10"></div>
<div class="fr fade" id="e"></div>
<input type="submit" class="super normal button" value="{{ l10n.send }}" />
Oops, something went wrong.

0 comments on commit 52de7ba

Please sign in to comment.