1 2/** 3 * Copyright (c) 2011-2014 Felix Gnass 4 * Licensed under the MIT license 5 */ 6 7/* 8 9Basic Usage: 10============ 11 12$('#el').spin(); // Creates a default Spinner using the text color of #el. 13$('#el').spin({ ... }); // Creates a Spinner using the provided options. 14 15$('#el').spin(false); // Stops and removes the spinner. 16 17Using Presets: 18============== 19 20$('#el').spin('small'); // Creates a 'small' Spinner using the text color of #el. 21$('#el').spin('large', '#fff'); // Creates a 'large' white Spinner. 22 23Adding a custom preset: 24======================= 25 26$.fn.spin.presets.flower = { 27 lines: 9 28 length: 10 29 width: 20 30 radius: 0 31} 32 33$('#el').spin('flower', 'red'); 34 35*/ 36 37(function(factory) { 38 39 if (typeof exports == 'object') { 40 // CommonJS 41 factory(require('jquery'), require('spin')) 42 } 43 else if (typeof define == 'function' && define.amd) { 44 // AMD, register as anonymous module 45 define(['jquery', 'spin'], factory) 46 } 47 else { 48 // Browser globals 49 if (!window.Spinner) throw new Error('Spin.js not present') 50 factory(window.jQuery, window.Spinner) 51 } 52 53}(function($, Spinner) { 54 55 $.fn.spin = function(opts, color) { 56 57 return this.each(function() { 58 var $this = $(this), 59 data = $this.data(); 60 61 if (data.spinner) { 62 data.spinner.stop(); 63 delete data.spinner; 64 } 65 if (opts !== false) { 66 opts = $.extend( 67 { color: color || $this.css('color') }, 68 $.fn.spin.presets[opts] || opts 69 ) 70 data.spinner = new Spinner(opts).spin(this) 71 } 72 }) 73 } 74 75 $.fn.spin.presets = { 76 tiny: { lines: 8, length: 2, width: 2, radius: 3 }, 77 small: { lines: 8, length: 4, width: 3, radius: 5 }, 78 large: { lines: 10, length: 8, width: 4, radius: 8 } 79 } 80 81})); 82 83
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.