Skip to content

Commit

Permalink
Add: NWS/Spoiler settings to tweets/vines/webm/gfycat
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterOdin committed Jan 16, 2015
1 parent a8e2b1f commit eacff68
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 13 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ Developer only seen features (such as internal functions) may or may not be reco

Changelog List
--------------
### <a name="2171"></a>v2.1.7.1 (1/8/2015)
### <a name="218"></a>v2.1.8 (1/16/2015)
```
+ Add: display-image-on-hover feature
+ Add NWS/Spoiler settings to tweets/vines/webm/gfycat
* Fix: remove new search link
* Fix: Have search box in thread use new search page
```
### <a name="217"></a>v2.1.7 (1/1/2015)
```
Expand Down
6 changes: 6 additions & 0 deletions extension/js/message-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,15 @@ defaultSettings['inlineVideo'] = 'false';
//defaultSettings['embedVideo'] = 'false';
defaultSettings['youtubeHighlight'] = '#ff00ff';
defaultSettings['inlineTweet'] = 'false';
defaultSettings['dontReplaceTwitterNWS'] = 'false';
defaultSettings['dontReplaceTwitterSpoiler'] = 'false';
defaultSettings['inlineVine'] = 'false';
defaultSettings['dontReplaceVineNWS'] = 'false';
defaultSettings['dontReplaceVineSpoiler'] = 'false';
defaultSettings['inlineWebm'] = 'false';
defaultSettings['inlineWemAutoplay'] = 'true';
defaultSettings['dontReplaceWebmNWS'] = 'false';
defaultSettings['dontReplaceWebmSpoiler'] = 'false';
defaultSettings['threadCaching'] = 'false';
defaultSettings['boxQuotes'] = 'false';
defaultSettings['salrLogoHide'] = 'false';
Expand Down
49 changes: 40 additions & 9 deletions extension/js/salr.js
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ SALR.prototype.inlineYoutubes = function() {
};

/*
DEPRECIATED BY SA 2.1.22 update
DEPRECIATED BY SA 2.1.7 update
*/
SALR.prototype.fullscreenYoutubeFix = function() {
jQuery('.postbody iframe[class*="youtube-player"]').each(function() {
Expand All @@ -1011,7 +1011,17 @@ SALR.prototype.fullscreenYoutubeFix = function() {
SALR.prototype.inlineTweets = function() {

var that = this;
jQuery('.postbody a[href*="twitter.com"]').each(function() {
var tweets = jQuery('.postbody a[href*="twitter.com"]');
//NWS/NMS links
if(that.settings.dontReplaceTwitterNWS == 'true')
{
tweets = tweets.not(".postbody:has(img[title=':nws:']) a").not(".postbody:has(img[title=':nms:']) a");
}
// spoiler'd links
if(that.settings.dontReplaceTwitterSpoiler == 'true') {
tweets = tweets.not('.bbc-spoiler a');
}
tweets.each(function() {
var match = jQuery(this).attr('href').match(/(https|http):\/\/twitter.com\/[0-9a-zA-Z_]+\/(status|statuses)\/([0-9]+)/);
if (match == null) {
return;
Expand All @@ -1029,15 +1039,33 @@ SALR.prototype.inlineTweets = function() {

SALR.prototype.inlineVines = function() {
var that = this;
jQuery('.postbody a[href*="vine.co"]').each(function() {
var vines = jQuery('.postbody a[href*="vine.co"]');
if(that.settings.dontReplaceVineNWS == 'true')
{
vines = vines.not(".postbody:has(img[title=':nws:']) a").not(".postbody:has(img[title=':nms:']) a");
}
// spoiler'd links
if(that.settings.dontReplaceVineSpoiler == 'true') {
vines = vines.not('.bbc-spoiler a');
}
vines.each(function() {
jQuery(this).html('<iframe class="vine-embed" src="'+jQuery(this).attr('href')+'/embed/simple" width="600" height="600" frameborder="0"></iframe>'+
'<script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script>');
});
};

SALR.prototype.inlineWebm = function() {
var that = this;
jQuery('.postbody a[href$="webm"]').each(function() {
var webms = jQuery('.postbody a[href$="webm"]');
if(that.settings.dontReplaceWebmNWS == 'true')
{
webms = webms.not(".postbody:has(img[title=':nws:']) a").not(".postbody:has(img[title=':nms:']) a");
}
// spoiler'd links
if(that.settings.dontReplaceWebmSpoiler == 'true') {
webms = webms.not('.bbc-spoiler a');
}
webms.each(function() {
var autoplay = (that.settings.inlineWemAutoplay == "true") ? "autoplay" : "";
jQuery(this).html('<video '+autoplay+' loop width="450" muted="true" controls> <source src="'+jQuery(this).attr('href')+'" type="video/webm"> </video>');
});
Expand Down Expand Up @@ -1131,9 +1159,10 @@ SALR.prototype.addSearchThreadForm = function() {
var threadid = findThreadID();
searchHTML = '<span id="salrsearch">'+
'<form id="salrSearchForm" '+
'action="http://forums.somethingawful.com/f/search/submit" '+
'method="post">'+
'<input type="hidden" name="forumids" value="'+forumid+'">'+
'action="http://forums.somethingawful.com/query" '+
'method="post" _lpchecked="1">'+
//'<input type="hidden" name="forumids" value="'+forumid+'">'+
/*
'<input type="hidden" name="groupmode" value="0">'+
'<input type="hidden" name="opt_search_posts" value="on">'+
'<input type="hidden" name="opt_search_titles" value="on">'+
Expand All @@ -1144,8 +1173,10 @@ SALR.prototype.addSearchThreadForm = function() {
'<input type="hidden" name="uf_posts" value="on">'+
'<input type="hidden" name="userid_filters" value="">'+
'<input type="hidden" name="username_filter" value="type a username">'+
'<input id="salrSearch" name="keywords" size="25" style="">'+
'<input type="submit" value="Search thread">'+
*/
'<input id="salrSearch" name="q" size="25" style="">'+
//'<input type="submit" value="Search thread">'+
'<button type="submit" name="action" value="query">Search</button>'
'</form>'+
'</span>';

Expand Down
6 changes: 6 additions & 0 deletions extension/js/settings-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,15 @@ jQuery(document).ready(function() {
//defaultSettings['embedVideo'] = 'false';
defaultSettings['youtubeHighlight'] = '#ff00ff';
defaultSettings['inlineTweet'] = 'false';
defaultSettings['dontReplaceTwitterNWS'] = 'false';
defaultSettings['dontReplaceTwitterSpoiler'] = 'false';
defaultSettings['inlineVine'] = 'false';
defaultSettings['dontReplaceVineNWS'] = 'false';
defaultSettings['dontReplaceVineSpoiler'] = 'false';
defaultSettings['inlineWebm'] = 'false';
defaultSettings['inlineWemAutoplay'] = 'true';
defaultSettings['dontReplaceWebmNWS'] = 'false';
defaultSettings['dontReplaceWebmSpoiler'] = 'false';
defaultSettings['threadCaching'] = 'false';
defaultSettings['boxQuotes'] = 'false';
defaultSettings['salrLogoHide'] = 'false';
Expand Down
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Something Awful Last Read Redux",
"version": "2.1.7",
"version": "2.1.8",
"manifest_version": 2,
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/ODZliWIb6YDyaHICQGfRDOiDmNOqCVPDNro6/Kwi1KpSFL7jI0Sn+HpvPt60Yb5tKPPMUIseTCSdDAjpr/d3aHU93r4g9ziq+wLKtTjuOryW/6izrGSf548A3QeyqIsWM+ONdbvOdU5bnXeAgIqa1CymocuJOASbvnz+ztaZXQIDAQAB",
"description": "Enhances the Something Awful forums with a host of new and exciting features",
Expand Down
26 changes: 24 additions & 2 deletions extension/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -607,21 +607,43 @@ <h4><span class="your-name-quote-title">YOUR NAME HERE</span> posted:</h4>
<div id='youtubeHighlight-box' class='color-select-box'></div>
</div>
<div class='color-picker-box'></div>
</div>
</div>
</div>
<div class='display-preference'>
<label><input id='inlineTweet' class='user-preference' type='checkbox' /> Convert Tweet links to inline</label>
</div>
<div class='sub-options'>
<div class='display-preference'>
<label><input id="dontReplaceTwitterNWS" class='user-preference' type='checkbox' /> Don't convert if post contains a NWS/NMS warning</label>
</div>
<div class='display-preference'>
<label><input id='dontReplaceTwitterSpoiler' class='user-preference' type='checkbox' /> Don't convert tweets inside spoiler tags</label>
</div>
</div>
<div class='display-preference'>
<label><input id='inlineVine' class='user-preference' type='checkbox' /> Convert Vine links to inline video</label>
</div>
<div class='sub-options'>
<div class='display-preference'>
<label><input id="dontReplaceVineNWS" class='user-preference' type='checkbox' /> Don't convert if post contains a NWS/NMS warning</label>
</div>
<div class='display-preference'>
<label><input id='dontReplaceVineSpoiler' class='user-preference' type='checkbox' /> Don't convert vines inside spoiler tags</label>
</div>
</div>
<div class='display-preference'>
<label><input id='inlineWebm' class='user-preference' type='checkbox' /> Convert webm/gfycat links to inline video</label>
</div>
<div class='sub-options'>
<div class='sub-options'>
<div class='display-preference'>
<label><input id='inlineWemAutoplay' class='user-preference' type='checkbox' /> Have webm/gfycat links autoplay</label>
</div>
<div class='display-preference'>
<label><input id="dontReplaceWebmNWS" class='user-preference' type='checkbox' /> Don't convert if post contains a NWS/NMS warning</label>
</div>
<div class='display-preference'>
<label><input id='dontReplaceWebmSpoiler' class='user-preference' type='checkbox' /> Don't convert webm/gfycat inside spoiler tags</label>
</div>
</div>
<div style="clear: both;"></div>
<div class='display-preference'>
Expand Down

0 comments on commit eacff68

Please sign in to comment.