Типа я (zilogic) wrote in changelog,
Типа я
zilogic
changelog

[livejournal] r21653: LJSUP-11744: Cannot Save Last.fm account...

Committer: amyshkin
LJSUP-11744: Cannot Save Last.fm account
U   trunk/cgi-bin/LJ/Widget/EntryForm.pm
Modified: trunk/cgi-bin/LJ/Widget/EntryForm.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/EntryForm.pm	2012-04-05 11:51:45 UTC (rev 21652)
+++ trunk/cgi-bin/LJ/Widget/EntryForm.pm	2012-04-05 11:54:07 UTC (rev 21653)
@@ -107,14 +107,14 @@
 
 sub should_show_lastfm {
     my ($self) = @_;
-
-    return $self->opts->{'prop_last_fm_user'} ? 1 : 0;
+    return $self->remote->prop('music_engine') eq LJ::Setting::Music::LastFM->pkgkey ? 1 : 0;
 }
 
 sub should_show_trava {
     my ($self) = @_;
     return 0 unless LJ::Setting::Music::Trava->good_ip;
-    return $self->opts->{'prop_last_fm_user'} ? 0 : 1;
+    my $me = $self->remote->prop('music_engine');
+    return ! $me or $me eq LJ::Setting::Music::Trava->pkgkey ? 1 : 0;
 }
 
 sub tabindex {
@@ -176,7 +176,6 @@
         js/rte.js
         js/jquery/jquery.lj.basicWidget.js
         js/jquery/jquery.xdomainrequest.js
-        js/jquery/jquery.lj.trava.js
         js/jquery/jquery.lj.modalWindow.js
         js/jquery/jquery.lj.entryDatePicker.js
         js/jquery/jquery.timeentry.min.js
@@ -199,8 +198,9 @@
     }
 
     if ( $self->should_show_trava ) {
-        # put trava js here
-        push @ret, qw();
+        push @ret, qw(
+            js/jquery/jquery.lj.trava.js
+        );
     }
     elsif ( $self->should_show_lastfm ) {
         push @ret, qw(
@@ -1176,15 +1176,6 @@
                     >
                     $help_icon
                 };
-
-                # automatically detect current music only if creating new entry
-                #if ($opts->{'mode'} eq 'update') {
-                    #$out .= $self->wrap_js(qq{
-                        #trava_current('$trava_uid', false);
-                    #});
-                #}
-
-
             }
             elsif ( $self->should_show_lastfm ) {
                 my $last_fm_user = LJ::ejs($opts->{'prop_last_fm_user'});
@@ -1358,16 +1349,7 @@
 
     $out .= "</ul>";
 
-    if ( $opts->{'mode'} eq "edit" ) {
-        $out .= $self->wrap_js(q~
-            jQuery('#entryform-music-wrapper').trava();
-        ~) if $self->should_show_trava;
-    }
-    else {
-        $out .= $self->wrap_js(q~
-            jQuery('#entryform-music-wrapper').trava().trava('getNowListen');
-        ~) if $self->should_show_trava;
-    }
+    $out .= q~jQuery('#entryform-music-wrapper').trava()~ . ( $opts->{'mode'} eq "edit" ? ';' : q~.trava('getNowListen');~ );
 
     return $out;
 }

Tags: amyshkin, livejournal, pm, zilogic
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