Jump to content
  • 0

Помогите расшифровать js


voodoo
 Share

Question

11 answers to this question

Recommended Posts

  • 0

Отформатируешь сам:

SEMods.Controls=function(){};SEMods.Controls.Autocompleter=function(obj,source){if(!SEMods.Controls.Autocompleter.hacks){SEMods.Controls.Autocompleter.should_check_double_fire=SEMods.Controls.Auto
completer.should_check_missing_events=navigator.userAgent.indexOf('AppleWebKit/4')!=-1;SEMods.Controls.Autocompleter.should_use_iframe=navigator.userAgent.indexOf('MSIE 6.0')!=-1;SEMods.Controls.Autocompleter.hacks=true;} this.obj=obj;this.obj.autocompleter=this;this.clear_placeholder();if(source){this.set_source(source);} this.obj.onfocus=function(){this.focused=true;this.clear_placeholder();this.results_text='';this.set_class('');this.dirty_results();this.show();this.capture_submit();}.bind(this);this.obj.onblur=function(){if(!this.suggestions){this._onselect(false);} this.focused=false;this.hide();this.update_class();if(!this.obj.value){var noinput=this.source.gen_noinput();this.obj.value=noinput?noinput:'';this.set_class('autocompleter_placeholder')}}.bind(this);this.obj.onkeyup=function(event){return this._onkeyup(event?event:window.event)}.bind(this);this.obj.onkeydown=function(event){return this._onkeydown(event?event:window.event)}.bind(this);this.obj.onkeypress=function(event){return this._onkeypress(event?event:window.event)}.bind(this);this.list=document.createElement('div');this.list.className='autocompleter_list';this.list.style.width=(this.obj.offsetWidth-2)+'px';if(this.obj.nextSibling){this.obj.parentNode.insertBefore(this.list,this.obj.nextSibling);} else{this.obj.parentNode.appendChild(this.list);} this.obj.parentNode.insertBefore(document.createElement('br'),this.list);if(this.should_use_iframe&&!SEMods.Controls.Autocompleter.iframe){SEMods.Controls.Autocompleter.iframe=document.createElement('iframe');SEMods.Controls.Autocompleter.iframe.className='autocompleter_iframe';SEMods.Controls.Autocompleter.iframe.style.display='none';SEMods.Controls.Autocompleter.iframe.frameBorder=0;document.body.appendChil
d(SEMods.Controls.Autocompleter.iframe);} this.focused=true;if(this.source){this.selectedindex=-1;this._onkeyup();this.set_class('');this.capture_submit();} else{this.hide();} this._framedown();};SEMods.Controls.Autocompleter.prototype={max_results:10,set_source:function(source){this.source=source;this.source.set_owner(this);this.status=0;this.cache={};this.last_search=0;this.suggestions=[];},_onkeyup:function(e){this.last_key=e?e.keyCode:-1;if(this.key_down==this.last_key){this.key_down=0;} switch(this.last_key){case 27:this.selectedindex=-1;this._onselect(false);this.hide();break;case undefined:case 0:case 13:case 37:case 38:case 39:case 40:break;default:this.dirty_results();if(this.should_check_missing_events){setTimeout(function(){this.dirty_results()}.bind(this),50);} break;}},_onkeydown:function(e){this.key_down=this.last_key=e?e.keyCode:-1;switch(this.last_key){case 9:this.select_suggestion(this.selectedindex);break;case 13:this.select_suggestion(this.selectedindex);this.hide();return this.submit_keydown_return=this._onsubmit(this.get_current_selection());case 38:if(this.check_double_fire())return;this.set_suggestion(this.selectedindex-1);return false;case 40:if(this.check_double_fire())return;this.set_suggestion(this.selectedindex+1);return false;}},_onkeypress:function(e){this.last_key=e?e.keyCode:-1;switch(this.last_key){case 38:case 40:return false;case 13:return this.submit_keydown_return;} return true;},_onfound:function(obj){return this.onfound?this.onfound.call(this,obj):true;},_onsubmit:function(obj){if(this.onsubmit){var ret=this.onsubmit.call(this,obj);if(ret&&this.obj.form){if(!this.obj.form.onsubmit||this.obj.form.onsubmit()){this.obj.form.submit();} return false;} return ret;}else{this.advance_focus();return false;}},_onselect:function(obj){if(this.onselect){this.onselect.call(this,obj);}},capture_submit:function(){if(!this.should_check_missing_events)return;if((!this.captured_form||this.captured_substitute!=this.captured_form.onsubmit)&&this.obj.form){this.captured_form=this.obj.form;this.captured_event=this.obj.form.onsubmit
;this.captured_substitute=this.obj.form.onsubmit=function(){return((this.key_down&&this.key_down!=13&&this.key_down!=9)?this.submit_keydown_return:(this.captured_event?this.captured_event.apply(arguments,this.captured_form):true))?true:false;}.bind(this);}},check_double_fire:function(){if(!this.should_check_double_fire){return false;} else{this.double_fire++;return this.double_fire%2==1;}},double_fire:0,set_suggestion:function(index){if(!this.suggestions||this.suggestions.length<=index){return} this.selectedindex=(index<=-1)?-1:index;var nodes=this.list.childNodes;for(var i=0;i0){var perfect_match=false;this.list.innerHTML='';for(var i=0;i<=(time-this.source.search_limit)&&this.source.status==0&&this.status==0){this.perform_search();} else{if(this.status==0&&this.source.status==1){this.set_message(this.source.gen_loading());this.status=2;} else if(this.status==0&&this.source.status==0){if(!this.search_timeout){this.search_timeout=setTimeout(function(){this.search_timeout=false;if(this.status==0&&this.source.status==0){this.perform_search();}}.bind(this),this.source.search_limit-(time-this.last_search));}}} if(this.suggestions){var match=-1;this.found_suggestions(this.suggestions,this.obj.value,true);for(var i=0;i';this.reset_iframe();} else{this.hide();}},reset_iframe:function(){if(!this.should_use_iframe){return} SEMods.Controls.Autocompleter.iframe.style.top=elementY(this.list)+'px';SEMods.Controls.Autocompleter.iframe.style.left=elementX(this.list)+'px';SEMods.Controls.Autocompleter.iframe.style.width=this.list.offsetWidth+'px';SEMods.Controls.Autocompleter.iframe.style.height=this.list.offsetHeight+'px';SEMods.Controls.Autocompleter.iframe.style.display='';},advance_focus:function(){setTimeout(function(){var inputs=this.obj.form?this.obj.form:document.getElementsByTagName('input');var found=false;for(var i=0;i=search[i].length&&value[j].substring(0,search[i].length).toLowerCase()==search[i].toLowerCase()){found=true;value[j]='';break;}} if(!found){return false;}}} return true;};SEMods.Controls.Autocompleter.source.prototype={cache_results:true,search_limit:10,set_owner:function(obj){this.owner=obj;},highlight_found:function(result,search){var html=new Array();result=result.split(' ');search=search.split(' ');search.sort(function(a,b){return a.length=search[j].length&&result[i].substring(0,search[j].length).toLowerCase()==search[j].toLowerCase()){html.push('',SEMods.U.htmlspecialchars(result[i].substring(0,search[j].length)),'',SEMods.U.htmlspecialchars(result[i].substring(search[j].length,result[i].length)),' ');found=true;break;}} if(!found){html.push(SEMods.U.htmlspecialchars(result[i]),' ');}} return html.join('');},gen_nomatch:function(){return this.text_nomatch!=null?this.text_nomatch:'No matches found';},gen_loading:function(){return this.text_loading!=null?this.text_loading:'Loading...';},gen_placeholder:function(){return this.text_placeholder!=null?this.text_placeholder:'Start typing...';},gen_noinput:function(){return this.text_noinput!=null?this.text_noinput:'Start typing...';}};SEMods.Controls.Autocompleter.friend_source=function(get_param){this.status=1;var ajax=new SEMods.Ajax(function(obj,text){var r=[];try{r=eval('('+text+')');this.friends=r.friends;this.status=0;}catch(e){this.status=0;this.friends=[];} if(this.owner&&this.owner.source_loaded){this.owner.source_loaded();}}.bind(this));ajax_endpoint=(/\/apps\//i.test(document.location))?'../ajax_autocomplete_friends.php':'ajax_autocomplete_friends.php';ajax.get(ajax_endpoint+'?task=get'+get_param);this.parent.construct(this);};SEMods.Controls.Autocompleter.friend_source.extend(SEMods.Controls.Autocompleter.source);SEMods.Controls.Autocompleter.friend_source.prototype.text_noinput=SEMods.C
ontrols.Autocompleter.friend_source.prototype.text_placeholder='Start typing a friend\'s name';SEMods.Controls.Autocompleter.friend_source.prototype.search_value=function(text){if(this.status==0){var results=new Array();for(var i=0;i=this.owner.max_results){break;}} this.owner.found_suggestions(results,text,false);return true;}};SEMods.Controls.Autocompleter.friend_source.prototype.gen_html=function(friend,highlight){var html=new Array('
');html.push(this.highlight_found(friend.t,highlight),'
',friend.n,'
');return html.join('');};SEMods.Controls.Autocompleter.custom_source=function(options){this.status=0;this.options=options;this.parent.construct(this);};SEMods.Controls.Autocompleter.custom_source.prototype={search_limit:10,text_placeholder:false,text_noinput:false,search_value:function(text){var results=new Array();for(var i=0;i=this.owner.max_results){break;}} this.owner.found_suggestions(results,text,false);return true;},gen_html:function(result,highlight){var html=new Array('
');html.push(this.highlight_found(result.t,highlight),'
');if(result.s){html.push('
',friend.n,'
');} return html.join('');}};SEMods.Controls.Autocompleter.custom_source.extend(SEMods.Controls.Autocompleter.source);

Link to comment
Share on other sites

  • 0

Элементарно.

Там в конце выполняется евал, которому передается расшиформанный код. Если вместо евала сделать алерт, или просто куданить в дом этот текст засунуть — там будет как раз код.

Link to comment
Share on other sites

  • 0

Немножко не в тему, но если у кого ни будь есть программка, которая расставляет отступы и прибавляет читабельности коду, то просьба скинуть :)

Edited by Ялекс
Link to comment
Share on other sites

  • 0
не понял? а как?

Открыываешь флэш, втавляешь в окошко редактирования экшен-скрипта скрипт, на кнопку "Auto format" готово.

Единственная проблема - если есть нессовтетствия экшенскрипту (фактически считающиеся ошибками), то он не просит их сначала исправить...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy