//= require social_stream.wall SocialStream.Linkser.Wall = (function(SS, $) { var regexp = /^(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&;:\/~+#-]*[\w@?^=%&;\/~+#-])?$/ var urlDetect = function() { this.currentValue = $("#input_activities").val(); if(this.lastValue == null) this.lastValue = ""; if(regexp.test($("#input_activities").val())) { $("#link_url").val($("#input_activities").val()); $("#link_loaded").val(false); $("#new_post").attr("action", "/links"); if(this.currentValue != this.lastValue) { $("#link_preview").html($('').attr('src', '<%= asset_path('loading.gif') %>').addClass('loading')); this.lastValue = this.currentValue; var url = this.currentValue; var urlDetect = this; $.ajax({ type : "GET", url : "/linkser_parse?url=" + url, dataType: 'html', success : function(html) { if($("#input_activities").val() == url) {//Only show if input value is still the same $("#link_preview").html(html); $("#link_loaded").val(true); } }, error : function(xhr, ajaxOptions, thrownError) { if($("#input_activities").val() == url) {//Only show if input value is still the same $("#link_preview").html($('