1(function ($) { 2 Drupal.behaviors.orbitVimeo = { 3 attach: function (context) { 4 var f = $('.field-orbit-wrapper iframe'); 5 6 if (!f.length) { 7 return; 8 } 9 10 var url = f.attr('src').split('?')[0]; 11 12 // Listen for messages from the player 13 if (window.addEventListener){ 14 window.addEventListener('message', onMessageReceived, false); 15 } 16 else { 17 window.attachEvent('onmessage', onMessageReceived); 18 } 19 20 // Handle messages received from the player 21 function onMessageReceived(e) { 22 var data = JSON.parse(e.data); 23 24 switch (data.event) { 25 case 'ready': 26 onReady(); 27 break; 28 29 case 'pause': 30 onPause(); 31 break; 32 33 case 'play': 34 onPlay(); 35 break; 36 37 case 'finish': 38 onFinish(); 39 break; 40 } 41 } 42 43 // Call the API when a button is pressed 44 $('button').on('click', function() { 45 post($(this).text().toLowerCase()); 46 }); 47 48 // Helper function for sending a message to the player 49 function post(action, value) { 50 var data = { method: action }; 51 52 if (value) { 53 data.value = value; 54 } 55 56 f[0].contentWindow.postMessage(JSON.stringify(data), url); 57 } 58 59 function onReady() { 60 post('addEventListener', 'pause'); 61 post('addEventListener', 'play'); 62 post('addEventListener', 'finish'); 63 } 64 65 function onPause() { 66 $('.field-orbit-1').trigger('orbit.play'); 67 } 68 69 function onPlay() { 70 $('.field-orbit-1').trigger('orbit.stop'); 71 } 72 73 function onFinish() { 74 $('.field-orbit-1').trigger('orbit.next'); 75 } 76 } 77 } 78})(jQuery);
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.