1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 13:30:55 +01:00

Fix a rap bug, and add a beat

Summary:
The flow was off in some cases. This should mitigate it.

Adds a Unicode musical note character at the start of the rap which,
when clicked, embeds a song in the background, hides it and plays it.
Currently the song is Gangsta's Paradise (karaoke version) but if you'd
prefer a different song, I can probably change it with only a few weeks
of work.

This doesn't respect the "embed youtubes" preference because you have to
click something to embed it, so it's your own fault your referers are
getting leaked.

For now, does the simplest thing and doesn't loop it. If it turns out
people are spending a lot of time on this page, we should look into
doing something like youtuberepeater.

Not trying to make this share code with the existing Youtube embedding
stuff - I think they're doing different enough things that solving them
both in the same way would be more code.

Test Plan:
Clicked the note in Firefox. Clicked the note in Chrome.
Considered clicking the note in Safari and Internet Explorer.

Reviewers: epriestley

Reviewed By: epriestley

CC: miorel, HarrisonW, aran, Korvin

Differential Revision: https://secure.phabricator.com/D4437
This commit is contained in:
Gregor Stocks 2013-01-15 10:32:49 -08:00
parent 4566b86376
commit cd9d59344c
2 changed files with 17 additions and 4 deletions

View file

@ -44,9 +44,9 @@ final class PhabricatorUserOAuthInfo extends PhabricatorUserDAO {
public static function getRappableTokenStatus($status) {
static $map = array(
self::TOKEN_STATUS_NONE => 'There is no token',
self::TOKEN_STATUS_GOOD => 'Your token\'s good',
self::TOKEN_STATUS_FAIL => 'Your token failed',
self::TOKEN_STATUS_EXPIRED => 'Your token\'s old',
self::TOKEN_STATUS_GOOD => 'Your token is good',
self::TOKEN_STATUS_FAIL => 'Your token has failed',
self::TOKEN_STATUS_EXPIRED => 'Your token is old',
);
return idx($map, $status, 'This code\'s got bugs');
}

View file

@ -164,7 +164,8 @@ final class PhabricatorSettingsPanelOAuth
$status);
$rappable_status = PhabricatorUserOAuthInfo::getRappableTokenStatus(
$status);
$rap = 'Yo yo yo<br />'.
$beat = self::getBeat();
$rap = $beat . "Yo yo yo<br />".
'My name\'s DJ Token and I\'m here to say<br />'.
// pronounce as "dollar rappable status" for meter to work
"$rappable_status, hey hey hey hey<br />".
@ -276,4 +277,16 @@ final class PhabricatorSettingsPanelOAuth
}
return $notice;
}
private static function getBeat() {
// Gangsta's Paradise (karaoke version).
// Chosen because it's the only thing I listen to.
$song_id = "Gangsta\\'s Paradise";
// Make a musical note which you can click for the beat.
$beat = '<a href="javascript:void(0);" onclick="javascript:alert('.
"'Think about $song_id.'".
'); return 0;">&#9835; </a>';
return $beat;
}
}