1// Place your application-specific JavaScript functions and classes here 2// This file is automatically included by javascript_include_tag :defaults 3 4function showHide(id) 5{ 6 var element = document.getElementById(id); 7 if ( element.style.display != 'none' ) 8 { 9 element.style.display = 'none'; 10 } 11 else 12 { 13 element.style.display = ''; 14 } 15} 16 17// From: http://weblog.rubyonrails.org/assets/2011/2/8/prototype-snippet.js 18// See: http://weblog.rubyonrails.org/2011/2/8/csrf-protection-bypass-in-ruby-on-rails 19/* 20 * Registers a callback which copies the csrf token into the 21 * X-CSRF-Token header with each ajax request. Necessary to 22 * work with rails applications which have fixed 23 * CVE-2011-0447 24*/ 25 26Ajax.Responders.register({ 27 onCreate: function(request) { 28 var csrf_meta_tag = $$('meta[name=csrf-token]')[0]; 29 30 if (csrf_meta_tag) { 31 var header = 'X-CSRF-Token', 32 token = csrf_meta_tag.readAttribute('content'); 33 34 if (!request.options.requestHeaders) { 35 request.options.requestHeaders = {}; 36 } 37 request.options.requestHeaders[header] = token; 38 } 39 } 40});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.