Запоминание ника вошедшего пользователя через HTML5 localStorage by Kelin для uCoz
1 2 3 4 5 6 7 8 9 10 |
<?if(!$USER_LOGGED_IN$)?> <a href="javascript://" rel="nofollow" onclick="new _uWnd('LF',' ',-250,-110,{autosize:0,closeonesc:1,resize:1,oncontent:function() {if(localStorage.getItem('guestName')) {$('form [name=user]').val(localStorage.getItem('guestName'))}$('form').submit(function() {if(localStorage.getItem('guestName')) {if(localStorage.getItem('guestName') == $(this).find('[name=user]').val()) {return false;}}localStorage.setItem('guestName',$(this).find('[name=user]').val())})}},{url:'/index/40'});return false;">Авторизация</a> <script> if(localStorage.getItem('guestName')) { if(location.pathname != '/index/1') { _uWnd.alert('С возвращением, <b>' + localStorage.getItem('guestName') + '</b>! Пожалуйста, авторизуйтесь', 'Мы вас помним', {w:200}); } } </script> <?endif?> |
1 2 3 4 5 6 7 8 9 10 11 |
<script type="text/javascript"> if(localStorage.getItem('guestName')) { $('[id^="frmLg"] [name="user"]').val(localStorage.getItem('guestName')) } $('[id^="frmLg"]').submit(function() { if(localStorage.getItem('guestName')) { if(localStorage.getItem('guestName') == $(this).find('[name="user"]').val()) {return false;} } localStorage.setItem('guestName',$(this).find('[name="user"]').val()); }); </script> |