This commit is contained in:
Phyks 2014-02-09 15:36:39 +01:00
parent bd947487a2
commit 8bccb3134b
2 changed files with 114 additions and 104 deletions

View File

@ -143,11 +143,16 @@ function adblock_plugin_treat_events(&$events) {
}
function adblock_plugin_setting_link(&$myUser) {
$myUser = (isset($_SESSION['currentUser'])?unserialize($_SESSION['currentUser']):false);
if($myUser!=false) {
echo '
<li class="pointer" onclick="$(\'#main section\').hide();$(\'#main #adblockSettingsBloc\').fadeToggle(200);">Adblock</li>';
<li onclick="toggleBlocks(\'#adblockSettingsBloc\');"><a href="#adblockSettingsBloc">Adblock</a></li>';
}
}
function adblock_plugin_setting_bloc(&$myUser) {
$myUser = (isset($_SESSION['currentUser'])?unserialize($_SESSION['currentUser']):false);
if($myUser!=false) {
$adblock_constants = file_get_contents('adblock_constants.php');
$adblock_constants = explode("\n", $adblock_constants);
@ -179,11 +184,11 @@ function adblock_plugin_setting_bloc(&$myUser) {
$getimagesize_available = function_exists("getimagesize") && ((ini_get("allow_url_fopen") == "1") ? true : false);
echo '
<section id="adblockSettingsBloc">
<form action="action.php?action=adblock_update" method="POST">
<section id="adblockSettingsBloc" class="settingsPage">
<article>
<h2>Plugin Adblock</h2>
<p><em>Note : </em><br/>
You must enter a list of id of feeds in the blacklist / whitelist fields. This list must be one id per line. You can find the id of the feed you want in the address bar on the page of the feed in Leed (http://LEED_URL/index.php?action=selectedFeed&feed=ID).</p>
<p><em>Note : </em> You must enter a list of id of feeds in the blacklist / whitelist fields. This list must be one id per line. You can find the id of the feed you want in the address bar on the page of the feed in Leed (http://LEED_URL/index.php?action=selectedFeed&feed=ID).</p>
<form action="action.php?action=adblock_update" method="POST">
<fieldset>
<div class="flash_adblockSettingsBlock">
<h3>Flash embedded contents :</h3>
@ -198,7 +203,7 @@ function adblock_plugin_setting_bloc(&$myUser) {
<input type="radio" name="flash_adblock_default_behavior" value="0" id="flash_adblock_allowall" onchange="adblock_whitelist_blacklist(\'adblock_flash_whitelist_blacklist\', 0);" '.((!$flash_block) ? 'checked="checked"' : '').'/><label for="flash_adblock_allowall">Allow all contents (and use a blacklist)</label>
</p>
<p><span id="adblock_flash_whitelist_blacklist">'.(($flash_block) ? 'Whitelist :' : 'Blacklist :').'</span></br>
<p><span id="adblock_flash_whitelist_blacklist">'.(($flash_block) ? 'Blacklist :' : 'Whitelist :').'</span></br>
<textarea name="flash_adblock_list" rows="7">'.$flash_list.'</textarea>
</div>
</fieldset>
@ -222,7 +227,7 @@ function adblock_plugin_setting_bloc(&$myUser) {
<input type="radio" name="img_adblock_only_mobiles" value="0" id="img_adblock_only_mobiles_no" '.((!$img_only_mobiles) ? 'checked="checked"' : '').'/><label for="img_adblock_only_mobiles_no">Block images on all devices</label>
</p>
<p><span id="adblock_img_whitelist_blacklist">'.(($img_block) ? 'Whitelist :' : 'Blacklist :').'</span></br>
<p><span id="adblock_img_whitelist_blacklist">'.(($img_block) ? 'Blacklist :' : 'Whitelist :').'</span></br>
<textarea name="img_adblock_list" rows="7">'.$img_list.'</textarea>
</div>
</fieldset>
@ -232,13 +237,17 @@ function adblock_plugin_setting_bloc(&$myUser) {
<input type="radio" name="adblock_elegant_degradation" value="0" id="adblock_elegant_degradation_no" '.((!$elegant_degradation) ? 'checked="checked"' : '').'/><label for="adblock_elegant_degradation_no">No</label>
</p>
<p id="adblock_settings_submit">
<input type="submit" class="button" value="Save"/>
<button type="submit" class="red">Save</button>
</p>
</form>
</article>
</section>';
}
}
function adblock_plugin_setting_update($_) {
$myUser = (isset($_SESSION['currentUser'])?unserialize($_SESSION['currentUser']):false);
if($myUser!=false) {
if($_['action'] == 'adblock_update') {
$flash_enabled = (int) $_['flash_adblock_enable'];
$flash_block = (int) $_['flash_adblock_default_behavior'];
@ -259,6 +268,7 @@ function adblock_plugin_setting_update($_) {
exit("Unable to write parameters to adblock_constants.php. Check permissions on the folders.");
}
}
}
Plugin::addCSS("/css/adblock_plugin_css.css");
Plugin::addJS("/js/adblock_plugin_js.js");

View File

@ -1,8 +1,8 @@
function adblock_whitelist_blacklist(id, whitelist_blacklist) {
if(whitelist_blacklist == 0)
document.getElementById(id).innerHTML = "Blacklist :";
else
document.getElementById(id).innerHTML = "Whitelist :";
else
document.getElementById(id).innerHTML = "Blacklist :";
}
function adblock_unblock_img(span, url) {