Skip to content

Commit

Permalink
modified event
Browse files Browse the repository at this point in the history
  • Loading branch information
rubencm committed Mar 28, 2017
1 parent 9869758 commit 3468aee
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 13 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "rubencm/lazyload",
"type": "phpbb-extension",
"description": "",
"version": "1.0.0",
"version": "1.0.0-beta1",
"license": "GPL-2.0",
"authors": [{
"name": "rubencm"
Expand All @@ -14,7 +14,7 @@
"extra": {
"display-name": "LazyLoad for post images",
"soft-require" : {
"phpbb/phpbb": ">=3.1.0,<3.3.*@dev"
"phpbb/phpbb": ">=3.2.0,<3.3.*@dev"
}
}
}
6 changes: 2 additions & 4 deletions event/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct()
static public function getSubscribedEvents()
{
return array(
'core.viewtopic_modify_post_action_conditions' => 'modify_img_bbcode',
'core.text_formatter_s9e_render_after' => 'modify_img_bbcode',
);
}

Expand All @@ -50,8 +50,6 @@ static public function getSubscribedEvents()
*/
public function modify_img_bbcode($event)
{
global $message;

$message = preg_replace("/<img src=\"(.*?)\" class=\"(.*?)\" alt=\"(.*?)\">/i", "<img data-original=\"$1\" class=\"$2\" alt=\"$3\"><noscript><img src=\"$1\" class=\"$2\" alt=\"$3\"></noscript>", $message);
$event['html'] = preg_replace("/<img src=\"(.*?)\" class=\"postimage\" alt=\"(.*?)\">/i", "<img data-original=\"$1\" class=\"postimage\" alt=\"$2\"><noscript><img src=\"$1\" class=\"postimage\" alt=\"$2\"></noscript>", $event['html']);
}
}
2 changes: 1 addition & 1 deletion ext.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ class ext extends \phpbb\extension\base
public function is_enableable()
{
$config = $this->container->get('config');
return phpbb_version_compare($config['version'], '3.1.0', '>=');
return phpbb_version_compare($config['version'], '3.2.0', '>=');
}
}
4 changes: 0 additions & 4 deletions styles/all/template/event/overall_footer_after.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!-- IF S_VIEWTOPIC -->

<script type="text/javascript">
// <![CDATA[
$(function() {
Expand All @@ -9,5 +7,3 @@
</script>

<!-- INCLUDEJS ../js/jquery_lazyload/jquery.lazyload.min.js -->

<!-- ENDIF -->
2 changes: 0 additions & 2 deletions styles/all/template/event/overall_header_head_append.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<!-- IF S_VIEWTOPIC -->
<style type="text/css">
img.postimage {
display: none;
}
</style>
<!-- ENDIF -->

0 comments on commit 3468aee

Please sign in to comment.