Work-around for share dialog on iOS devices
authorAlexander Ebert <ebert@woltlab.com>
Sun, 10 Nov 2013 00:37:41 +0000 (01:37 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 10 Nov 2013 00:37:41 +0000 (01:37 +0100)
wcfsetup/install/files/js/WCF.Message.js

index 1258c5aa674b817bd732b80e4af70577c3d077b3..656c9ea183cdaaa4e7a8d716228163dbd5e6cf4f 100644 (file)
@@ -2785,7 +2785,12 @@ WCF.Message.Share.Content = Class.extend({
                        this._dialog.html(this._cache[$key]).wcfDialog('open');
                }
                
-               this._dialog.find('input').click(function() { $(this).select(); });
+               var $inputElements = this._dialog.find('input').click(function() { $(this).select(); });
+               
+               // Safari on iOS can only select the text if it is not readonly and setSelectionRange() is used
+               if (navigator.userAgent.match(/iP(ad|hone|od)/)) {
+                       $inputElements.keydown(function() { return false; }).removeAttr('readonly').click(function() { this.setSelectionRange(0, 9999); });
+               }
        }
 });