1( 2 function () { 3 var VERSION = "1.0"; 4 var NAME = "com.web.components.socialmedialink"; 5 var scripts = ["js/smltemplates.js"]; 6 var styles = ["css/socialmedialink.css"]; 7 8 //foreign resources 9 WebCom.ResourceLoader.loadLib('com.jquery', null, true); 10 11 var lib = new WebCom.ResourceLoader.Library("WebCom.Components.SocialMediaLink", NAME, VERSION, scripts, styles ) 12 WebCom.ResourceLoader.importLib(lib); 13 14 function WebCom_Components_SocialMediaLink() { 15 WebCom.Components.Component.apply(this,[lib]); 16 17 var self = this; // to overcome calback scoping 18 var id = ''; 19 var renderMode = ''; 20 var facebookUrl = ''; 21 var twitterUrl = ''; 22 var linkedinUrl = ''; 23 var myspaceUrl = ''; 24 var youtubeUrl = ''; 25 var googlePlusUrl = ''; 26 var layout = ''; 27 var formattingValues; 28 29 this.init = function (id, config) { 30 self.id = id; 31 self.renderMode = config.miscData.renderMode; 32 self.facebookUrl = config.componentData.facebookUrl; 33 self.twitterUrl = config.componentData.twitterUrl; 34 self.linkedinUrl = config.componentData.linkedinUrl; 35 self.myspaceUrl = config.componentData.myspaceUrl; 36 self.youtubeUrl = config.componentData.youtubeUrl; 37 self.googlePlusUrl = config.componentData.googlePlusUrl; 38 self.layout = config.componentData.linkStyle; 39 40 self.formattingValues = { 41 facebookUrl: self.getFacebookUrl(), 42 twitterUrl: self.getTwitterUrl(), 43 linkedinUrl: self.getLinkedInUrl(), 44 myspaceUrl: self.getMyspaceUrl(), 45 youtubeUrl: self.getYoutubeUrl(), 46 googlePlusUrl: self.getGooglePlusUrl(), 47 target: ' target="_blank" ' 48 }; 49 50 if (config.listeners) { 51 for (var eventName in config.listeners) { 52 self.on(eventName, config.listeners[eventName].handler, config.listeners[eventName].scope); 53 } 54 } 55 56 }; 57 58 this.getFormattingValues = function () { 59 if (self.renderMode == 'Edit') { 60 self.formattingValues.facebookUrl = 'javascript:void(0)'; 61 self.formattingValues.twitterUrl = 'javascript:void(0)'; 62 self.formattingValues.linkedinUrl = 'javascript:void(0)'; 63 self.formattingValues.myspaceUrl = 'javascript:void(0)'; 64 self.formattingValues.youtubeUrl = 'javascript:void(0)'; 65 self.formattingValues.googlePlusUrl = 'javascript:void(0)'; 66 self.formattingValues.target = ''; 67 } 68 return self.formattingValues; 69 }; 70 71 this.getMasterTemplate = function(/*RenderMode*/ mode) { 72 return self.getTemplate("MasterTemplate", mode, self.layout); 73 }; 74 75 this.getFacebookUrl = function () { 76 return self.facebookUrl; 77 }; 78 79 this.getTwitterUrl = function () { 80 return self.twitterUrl; 81 }; 82 83 this.getLinkedInUrl = function () { 84 return self.linkedinUrl; 85 }; 86 87 this.getMyspaceUrl = function () { 88 return self.myspaceUrl; 89 }; 90 91 this.getYoutubeUrl = function () { 92 return self.youtubeUrl; 93 }; 94 95 this.getGooglePlusUrl = function () { 96 return self.googlePlusUrl; 97 }; 98 99 this.getLayout = function () { 100 return self.layout; 101 }; 102 103 return this; 104 }; 105 106 WebCom_Components_SocialMediaLink.prototype = new WebCom.Components.Component(); 107 WebCom.Components.SocialMediaLink = { 108 initInstances : function (instances, globalSettings) { 109 for (var i=0; i < instances.length; i++) { 110 var inst = instances[i]; 111 112 if (globalSettings && globalSettings.listeners) { 113 if (inst["listeners"] == null) { 114 inst["listeners"] = globalSettings.listeners; 115 } else { 116 var listeners = inst["listeners"]; 117 for (var eventName in globalSettings.listeners) { 118 if (listeners[eventName] == null) { 119 listeners[eventName] = globalSettings.listeners[listenerName]; 120 } 121 } 122 } 123 } 124 125 var comp = new WebCom_Components_SocialMediaLink(); 126 comp.init(inst.id, inst); 127 comp.render(comp.renderMode); 128 } 129 } 130 }; 131 132 } 133)();
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.