Browse Source

add option to disable inline image preview

Andrew Dolgov 7 years ago
parent
commit
ba928c8f44
4 changed files with 14 additions and 0 deletions
  1. 2 0
      backend.php
  2. 1 0
      include/functions.php
  3. 5 0
      js/tt-irc.js
  4. 6 0
      prefs.php

+ 2 - 0
backend.php

@@ -359,6 +359,7 @@
 		$theme = db_escape_string($_REQUEST["theme"]);
 		$highlight_on = db_escape_string($_REQUEST["highlight_on"]);
 		$hide_join_part = bool_to_sql_bool(db_escape_string($_REQUEST["hide_join_part"]));
+		$disable_image_preview = bool_to_sql_bool(db_escape_string($_REQUEST["disable_image_preview"]));
 
 		$theme_changed = false;
 
@@ -370,6 +371,7 @@
 		}
 
 		set_pref($link, "HIGHLIGHT_ON", $highlight_on);
+		set_pref($link, "DISABLE_IMAGE_PREVIEW", $disable_image_preview);
 
 		db_query($link, "UPDATE ttirc_users SET realname = '$realname',
 			quit_message = '$quit_message',

+ 1 - 0
include/functions.php

@@ -987,6 +987,7 @@
 		$rv = array(
 			"hide_join_part" => $hide_join_part,
 			"uniqid" => $uniqid,
+			"disable_image_preview" => get_pref($link, "DISABLE_IMAGE_PREVIEW"),
 			"highlight_on" => explode(",", get_pref($link, "HIGHLIGHT_ON")),
 			"notify_events" => $notify_events);
 

+ 5 - 0
js/tt-irc.js

@@ -14,6 +14,7 @@ var notify_events = [];
 var update_delay_max = 0;
 var theme = "";
 var hide_join_part = false;
+var disable_image_preview = false;
 var startup_date;
 var id_history = [];
 var uniqid;
@@ -634,6 +635,7 @@ function handle_update(transport) {
 
 			notify_events = params.notify_events;
 			hide_join_part = params.hide_join_part;
+			disable_image_preview = params.disable_image_preview;
 			uniqid = params.uniqid;
 		}
 
@@ -1740,6 +1742,9 @@ function url_clicked(elem, event) {
 		if (event.ctrlKey)
 			return true;
 
+		if (disable_image_preview)
+			return true;
+
 		window.clearTimeout(elem.getAttribute("timeout"));
 
 		show_spinner();

+ 6 - 0
prefs.php

@@ -320,6 +320,7 @@
 	}
 
 	$highlight_on = get_pref($link, "HIGHLIGHT_ON");
+	$disable_image_preview_checked = get_pref($link, "DISABLE_IMAGE_PREVIEW") ? "checked" : "";
 ?>
 
 	<div class="modal-header">
@@ -390,6 +391,11 @@
 						id="pr_hide_join_part" type="checkbox" value="1">
 					<?php echo __('Do not highlight tabs on auxiliary messages') ?></label>
 
+				<label class="checkbox">
+					<input name="disable_image_preview" <?php echo $disable_image_preview_checked ?>
+						id="pr_disable_image_preview" type="checkbox" value="1">
+					<?php echo __('Disable inline image preview') ?></label>
+
 			</div>
 		</div>