[Forum "bug"?] Schnellantwort mit Firefox 1.5

German support forum

Moderators: Hacker, Stefan2, white

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50817
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2Lefteous
Meinst Du den Link "Zitat"? Das Problem ist bei gewissen Browsern, dass sie die Markierung vom Text entfernen, bevor sie den Klick ausführen. Ich habe das so gelöst, dass ich den markierten Text merke, wenn der Cursor über dem Link "hovert" offenbar geht das bei Safari aber auch nicht...
Author of Total Commander
https://www.ghisler.com
User avatar
Lefteous
Power Member
Power Member
Posts: 9537
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

Meinst Du den Link "Zitat"?
So ist es.
User avatar
Lefteous
Power Member
Power Member
Posts: 9537
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

Ich habe mir das nochmal angeschaut, weil es mich einfach ziemlich nervt. Es ist wohl tatsächlich so dass document.getSelection() veraltet ist und von modernen Browsern wie Safari gar nicht mehr unterstützt wird oder wie bei Firefox eine Warnung in der Javascript-Konsole erscheint.
window.getSelection() funktioniert jedoch in beiden Browsern. Es wäre toll, wenn das so schnell wie möglich eingebaut wird.

Das Beispiel unten ist eine auf das Nötigste reduzierte, normale Nachrichtenseite. Dort habe ich in beiden Funktionen die Zeile

Code: Select all

else if (window.getSelection) txt = window.getSelection();
eingefügt. Bislang erfolgreich getestet mit:

Safari 3.04
Firefox 2.0.0.11
Internet Explorer 7
Opera 9.50 BETA Build 9735

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Safari Javascript test</title>
</head>
<body>
<table>
  <tr>
    <td width="40%" valign="top" nowrap="nowrap" align="left">Text
	<script language='JavaScript' type='text/javascript'>
	<!--
		var quickreply_paste_text = '';
		function copyQ() {
			txt='';
			if (document.getSelection) txt = document.getSelection();
			else if (document.selection) txt = document.selection.createRange().text;
			else if (window.getSelection) txt = window.getSelection();
			if (txt!='')
				quickreply_paste_text=txt;
		}

		function pasteQ() {
			txt='';
			if (document.getSelection) txt = document.getSelection();
			else if (document.selection) txt = document.selection.createRange().text;
			else if (window.getSelection) txt = window.getSelection();			
			if (txt=='')
				txt=quickreply_paste_text;
			if (txt=='')
				alert('No text selected!');
			else
				document.post.message.value = document.post.message.value + '[quote]' + txt + '[/quote]\n';
		}
	//-->
	</script>
      <form action='posting.php' method='post' name='post'>
        <span class='genmed'> <a href="javascript:pasteQ()" onMouseOver="copyQ()">Quote</a> <br />
        <textarea name='message' rows='12' cols='56' wrap='virtual' class='post''></textarea>
        <br />
      </form></td>
  </tr>
</table>
</body>
</html>
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

Lefteous wrote:Bislang erfolgreich getestet mit:

Safari 3.04
Firefox 2.0.0.11
Internet Explorer 7
Opera 9.50 BETA Build 9735
Das Beispiel funktioniert auch mit
- Firefox 1.5.0.5

Hier funktioniert das Quoten auch, die Markierung wird allerdings gar nicht entfernt:
- Mozilla Suite 1.5
- Mozilla Suite 1.7.13
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50817
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

else if (window.getSelection) txt = window.getSelection();
OK, habe das mal in viewtopic.php eingebaut. Bitte ausprobieren!

2Lefteous Danke für die Infos!
Author of Total Commander
https://www.ghisler.com
User avatar
Lefteous
Power Member
Power Member
Posts: 9537
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2ghisler(Author)
OK, habe das mal in viewtopic.php eingebaut. Bitte ausprobieren!
Es funktioniert. Danke für das schnelle Einbauen!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50817
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Toll, danke! Hab's gerade ins lokale Backup der Forendateien übernommen. :)
Author of Total Commander
https://www.ghisler.com
Post Reply