Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[ljcom] r9622: LJSUP-7091, LJSUP-7163, LJSUP-7163: Autu...

Committer: gariev
LJSUP-7091, LJSUP-7163, LJSUP-7163: Autumn and Halloween headers for Cyr/Non-Cyr users
U   trunk/cgi-bin/LJ/Hooks/Homepage.pm
Modified: trunk/cgi-bin/LJ/Hooks/Homepage.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/Homepage.pm	2010-10-15 02:54:09 UTC (rev 9621)
+++ trunk/cgi-bin/LJ/Hooks/Homepage.pm	2010-10-15 09:33:32 UTC (rev 9622)
@@ -44,22 +44,58 @@
     return 1;
 }
 
-## october2010
+## halloween 2010, non-cyr, 2010-10-25 04:00:00Z - 2010-11-01 04:00:00Z
+sub _is_halloween_reskining_active { 
+    my $params = shift;
+    return if LJ::SUP->is_remote_sup;
+    my $time = time;
+    return 1287979200 < $time && $time < 1288584000;
+}
+
+## autumn, non-cyr, no condition on time
 sub _is_october2010_reskining_active { 
     my $params = shift;
     return ! LJ::SUP->is_remote_sup;
 }
 
+# halloween, cyr, 2010-10-27 20:00:00Z - 2010-10-31 20:00:00Z
+sub _is_cyr_halloween_reskining_active {
+    my $params = shift;
+    return unless LJ::SUP->is_remote_sup;
+    my $time = time;
+    return 1288209600 < $time && $time < 1288555200;
+}
+
+## autumn, cyr, no condition on time
+sub _is_cyr_autumn_reskining_active { 
+    my $params = shift;
+    return LJ::SUP->is_remote_sup;
+}
+
 LJ::register_hook("service_page_reskining", sub {
     my $params = shift || {};
-    if(_is_october2010_reskining_active($params)){
-        ## Sep 2010
+    
+    if (_is_halloween_reskining_active($params)) {
+        # Halloween
+        LJ::need_res("stc/reskining/halloween2010/noncyr/halloween2010.css");
+        my $text = LJ::Lang::ml('reskining.halloween2010');
+        LJ::CleanHTML::clean(\$text); ## to expand <lj-user> tags 
+        return qq[<dl class="b-reskining-about"><dt></dt><dd>$text</dd></dl>];
+    } elsif (_is_october2010_reskining_active($params)) {
+        ## Non-cyrillic october heading
         LJ::need_res("stc/reskining/october2010/october2010.css");
         my $text = LJ::Lang::ml('reskining.october2010');
         LJ::CleanHTML::clean(\$text); ## to expand <lj-user> tags 
         return qq[<dl class="b-reskining-about"><dt></dt><dd>$text</dd></dl>];
-
-    } 
+    } elsif (_is_cyr_halloween_reskining_active($params)) {
+        # Halloween for cyr
+        LJ::need_res("stc/reskining/halloween2010/cyr/halloween2010.css");
+        return '';
+    } elsif (_is_cyr_autumn_reskining_active($params)) {
+        ## October reskining for Cyrillic
+        LJ::need_res("stc/reskining/october2010/cyr/october2010.css");
+        return '';
+    }
     return '';
 });
 

Tags: gariev, ljcom, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments