Aralot (aralot) wrote in changelog,
Aralot
aralot
changelog

[ljcom] r10143: LJINT-388: placeholder for Webkit

Committer: szhirkov
LJINT-388: placeholder for Webkit
U   trunk/htdocs/js/partners/placeholder.js
U   trunk/templates/Identity/ExternalLogin.tmpl
Modified: trunk/htdocs/js/partners/placeholder.js
===================================================================
--- trunk/htdocs/js/partners/placeholder.js	2011-03-01 11:29:54 UTC (rev 10142)
+++ trunk/htdocs/js/partners/placeholder.js	2011-03-01 11:32:22 UTC (rev 10143)
@@ -1,11 +1,8 @@
 (function ($) {
-	// "onload" instead of "onready" - hack for Webkit browsers
-	$(window).bind('load', function () {
+	$(function () {
 		$('input:text, input:password, input[type=url], textarea').placeholder();
-		$('#commenttext').trigger('focus');
-	});
-	
-	$(function () {
+		$('#commenttext').trigger('focus');		
+		
 		var submitButtons = $(':submit');
 		
 		$('.i-close').bind('click', function (e) {
@@ -42,8 +39,13 @@
 	$.fn.placeholder = function () {
 		return this.each(function () {
 			var field = $(this),
-				hintLabel = field.prev();
+				hintLabel = field.prev(),
+				placeholderSupported = 'placeholder' in document.createElement('input');
 				
+			if (placeholderSupported && field.attr('placeholder')) {
+				return false;
+			}
+				
 			field
 				.bind('focus', function () {
 					hintLabel.hide();

Modified: trunk/templates/Identity/ExternalLogin.tmpl
===================================================================
--- trunk/templates/Identity/ExternalLogin.tmpl	2011-03-01 11:29:54 UTC (rev 10142)
+++ trunk/templates/Identity/ExternalLogin.tmpl	2011-03-01 11:32:22 UTC (rev 10143)
@@ -35,11 +35,11 @@
                 <p class="b-auth-user-form">
                     <span class="b-auth-input-wrapper">
                         <label style="display:none;" for="ljusername"><TMPL_VAR expr="ml('/identity/login.bml.user.label.name')"></label>
-                        <input type="text" name="user" id="ljusername" value="" class="b-auth-user-input" />
+                        <input type="text" name="user" id="ljusername" value="" class="b-auth-user-input" placeholder="<TMPL_VAR expr="ml('/identity/login.bml.user.label.name')">" />
                     </span>
                     <span class="b-auth-input-wrapper">
                         <label style="display:none;" for="ljuserpassword"><TMPL_VAR expr="ml('/identity/login.bml.user.label.pass')"></label>
-                        <input type="password" name="password" id="ljuserpassword" value="" class="b-auth-user-input" />
+                        <input type="password" name="password" id="ljuserpassword" value="" class="b-auth-user-input" placeholder="<TMPL_VAR expr="ml('/identity/login.bml.user.label.pass')">" />
                         <a target="_blank" href="<TMPL_VAR lj_siteroot>/lostinfo.bml"><TMPL_VAR expr="ml('/identity/login.bml.user.help')"></a>
                         <a target="_blank" href="<TMPL_VAR lj_siteroot>/create.bml"><TMPL_VAR expr="ml('/identity/login.bml.user.register')"></a>
                     </span>
@@ -60,7 +60,7 @@
                 <p class="b-auth-openid-form">
                     <span class="b-auth-input-wrapper">
                         <label style="display:none;" for="openid_url"><TMPL_VAR expr="ml('/identity/login.bml.openid.label.url')"></label>
-                        <input type="url" name="openid:url" id="openid_url" value="" class="b-auth-openid-input" />
+                        <input type="url" name="openid:url" id="openid_url" value="" class="b-auth-openid-input" placeholder="<TMPL_VAR expr="ml('/identity/login.bml.openid.label.url')">" />
                         <span><TMPL_VAR expr="ml('/identity/login.bml.openid.label.sample')"></span>
                     </span>
                     <button disabled="disabled" type="submit"><TMPL_VAR expr="ml('/identity/login.bml.openid.btn.login')"></button>

Tags: aralot, js, ljcom, tmpl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments