-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #871 from nistormihai/rp-image-issues
Rp image issues
- Loading branch information
Showing
10 changed files
with
301 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
plugins/embed/gui-resources/scripts/js/build/themes/rp/desktop.js
Large diffs are not rendered by default.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
plugins/embed/gui-resources/scripts/js/plugins/image-fix.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
|
||
define([ | ||
'lib/utils', | ||
'plugins' | ||
], function (utils, plugins) { | ||
plugins.imageFix = function (config) { | ||
utils.dispatcher.on('before-render.post-view', function (view) { | ||
if (view.model.get('item') !== 'posttype/image' && | ||
view.model.get('item') !== 'posttype/normal') { | ||
return; | ||
} | ||
var Content = view.model.get('Content'); | ||
// remove 'null' with or without trailing. | ||
Content = Content.replace(/null(\n )?/, ''); | ||
// replace all links that have images with the actuall image. | ||
Content = Content.replace(new RegExp('<a([^>]*)>(.*?)</a>', 'gi'), function(all, attr) { | ||
attr.replace(/"(.*?)content\/media_archive\/image([^"]*)"/, function(link) { | ||
all = '<img src=' + link + '>'; | ||
}); | ||
return all; | ||
}); | ||
// add a class for all local images. | ||
Content = Content.replace(/"(.*?)content\/media_archive\/image([^"]*)"/, function(link) { | ||
return link + ' class="liveblog-local"'; | ||
}); | ||
view.model.set({Content: Content}, {silent: true}); | ||
}); | ||
|
||
}; | ||
return plugins.imageFix; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.