1/*! 2 * jquery oembed plugin 3 * 4 * Copyright (c) 2009 Richard Chamorro 5 * Licensed under the MIT license 6 * 7 * Orignal Author: Richard Chamorro 8 * Forked by Andrew Mee to Provide a slightly diffent kind of embedding experience 9 */ 10(function ($) { 11 $.fn.oembed = function (url, options, embedAction) { 12 13 settings = $.extend(true, $.fn.oembed.defaults, options); 14 var shortURLList = ["0rz.tw", "1link.in", "1url.com", "2.gp", "2big.at", "2tu.us", "3.ly", "307.to", "4ms.me", "4sq.com", "4url.cc", "6url.com", "7.ly", "a.gg", "a.nf", "aa.cx", "abcurl.net", 15 "ad.vu", "adf.ly", "adjix.com", "afx.cc", "all.fuseurl.com", "alturl.com", "amzn.to", "ar.gy", "arst.ch", "atu.ca", "azc.cc", "b23.ru", "b2l.me", "bacn.me", "bcool.bz", "binged.it", 16 "bit.ly", "bizj.us", "bloat.me", "bravo.ly", "bsa.ly", "budurl.com", "canurl.com", "chilp.it", "chzb.gr", "cl.lk", "cl.ly", "clck.ru", "cli.gs", "cliccami.info", 17 "clickthru.ca", "clop.in", "conta.cc", "cort.as", "cot.ag", "crks.me", "ctvr.us", "cutt.us", "dai.ly", "decenturl.com", "dfl8.me", "digbig.com", 18 "http:\/\/digg\.com\/[^\/]+$", "disq.us", "dld.bz", "dlvr.it", "do.my", "doiop.com", "dopen.us", "easyuri.com", "easyurl.net", "eepurl.com", "eweri.com", 19 "fa.by", "fav.me", "fb.me", "fbshare.me", "ff.im", "fff.to", "fire.to", "firsturl.de", "firsturl.net", "flic.kr", "flq.us", "fly2.ws", "fon.gs", "freak.to", 20 "fuseurl.com", "fuzzy.to", "fwd4.me", "fwib.net", "g.ro.lt", "gizmo.do", "gl.am", "go.9nl.com", "go.ign.com", "go.usa.gov", "goo.gl", "goshrink.com", "gurl.es", 21 "hex.io", "hiderefer.com", "hmm.ph", "href.in", "hsblinks.com", "htxt.
21it", "huff.to", "hulu.com", "hurl.me", "hurl.ws", "icanhaz.com", "idek.net", "ilix.in", "is.gd", 22 "its.my", "ix.lt", "j.mp", "jijr.com", "kl.am", "klck.me", "korta.nu", "krunchd.com", "l9k.net", "lat.ms", "liip.to", "liltext.com", "linkbee.com", "linkbun.ch", 23 "liurl.cn", "ln-s.net", "ln-s.ru", "lnk.gd", "lnk.ms", "lnkd.in", "lnkurl.com", "lru.jp", "lt.tl", "lurl.no", "macte.ch", "mash.to", "merky.de", "migre.me", "miniurl.com", 24 "minurl.fr", "mke.me", "moby.to", "moourl.com", "mrte.ch", "myloc.me", "myurl.in", "n.pr", "nbc.co", "nblo.gs", "nn.nf", "not.my", "notlong.com", "nsfw.in", 25 "nutshellurl.com", "nxy.in", "nyti.ms", "o-x.fr", "oc1.us", "om.ly", "omf.gd", "omoikane.net", "on.cnn.com", "on.mktw.net", "onforb.es", "orz.se", "ow.ly", "ping.fm", 26 "pli.gs", "pnt.me", "politi.co", "post.ly", "pp.gg", "profile.to", "ptiturl.com", "pub.vitrue.com", "qlnk.net", "qte.me", "qu.tc", "qy.fi", "r.ebay.com", "r.im", "rb6.me", "read.bi", 27 "readthis.ca", "reallytinyurl.com", "redir.ec", "redirects.ca", "redirx.com", "retwt.me", "ri.ms", "rickroll.it", "riz.gd", "rt.nu", "ru.ly", "rubyurl.com", "rurl.org", 28 "rww.tw", "s4c.in", "s7y.us", "safe.mn", "sameurl.com", "sdut.us", "shar.es", "shink.de", "shorl.com", "short.ie", "short.to", "shortlinks.co.uk", "shorturl.com", 29 "shout.to", "show.my", "shrinkify.com", "shrinkr.com", "shrt.fr", "shrt.st", "shrten.com", "shrunkin.com", "simurl.com", "slate.me", "smallr.com", "smsh.me", "smurl.name", 30 "sn.im", "snipr.com", "snipurl.com", "snurl.com", "sp2.ro", "spedr.com", "srnk.net", "srs.li", "starturl.com", "stks.co", "su.pr", "surl.co.uk", "surl.hu", "t.cn", "t.co", "t.lh.com", 31 "ta.gd", "tbd.ly", "tcrn.ch", "tgr.me", "tgr.ph", "tighturl.com", "tiniuri.com", "tiny.cc", "tiny.ly", "tiny.pl", "tinylink.in", "tinyuri.ca", "tinyurl.com", "tk.", "tl.gd", 32 "tmi.me", "tnij.org", "tnw.to", "tny.com", "to.ly", "togoto.us", "totc.us", "toysr.us", "tpm.ly", "tr.im", "tra.kz", "trunc.it", "twhub.com", "twirl.at", 33 "twitclicks.com", "twitterurl.net", "twitterurl.org", "twiturl.de", "twurl.cc", "twurl.nl", "u.mavrev.com", "u.nu", "u76.org", "ub0.cc", "ulu.lu", "updating.me", "ur1.ca", 34 "url.az", "url.co.uk", "url.ie", "url360.me", "url4.eu", "urlborg.com", "urlbrief.com", "urlcover.com", "urlcut.com", "urlenco.de", "urli.nl", "urls.im", 35 "urlshorteningservicefortwitter.com", "urlx.ie", "urlzen.com", "usat.ly", "use.my", "vb.ly", "vevo.ly", "vgn.am", "vl.am", "vm.lc", "w55.de", "wapo.st", "wapurl.co.uk", "wipi.es", 36 // "wp.me", "x.vu", "xr.com", "xrl.in", "xrl.us", "xurl.es", "xurl.jp", "y.ahoo.it", "yatuc.com", "ye.pe", "yep.it", "yfrog.com", "yhoo.it", "yiyd.com", "youtu.be", "yuarel.com", 37 "wp.me", "x.vu", "xr.com", "xrl.in", "xrl.us", "xurl.es", "xurl.jp", "y.ahoo.it", "yatuc.com", "ye.pe", "yep.it", "yfrog.com", "yhoo.it", "yiyd.com", "yuarel.com", 38 "z0p.de", "zi.ma", "zi.mu", "zipmyurl.com", "zud.me", "zurl.ws", "zz.gd", "zzang.kr", "âº.ws", "â©.ws", "â¿.ws", "â¥.ws", "â.ws", "â.ws", "â¡.ws", "â¨.ws", "â¯.ws", "â¹.ws", "â½.ws"]; 39 40 if ($('#jqoembeddata').length === 0) $('<span id="jqoembeddata"></span>').appendTo('body'); 41 42 return this.each(function () { 43 var container = $(this), 44 resourceURL = (url && (!url.indexOf('http://') || !url.indexOf('https://'))) ? url : container.attr("href"), 45 provider; 46 47 if (embedAction) { 48 settings.onEmbed = embedAction; 49 } 50 else if (!settings.onEmbed) { 51 settings.onEmbed = function (oembedData) { 52 $.fn.oembed.insertCode(this, settings.embedMethod, oembedData); 53 }; 54 } 55 56 if (resourceURL !== null && resourceURL !== undefined) { 57 //Check if shorten URL 58 for (var j = 0, l = shortURLList.length; j < l; j++) { 59 var regExp = new RegExp('://' + shortURLList[j] + '/', "i"); 60 61 if (resourceURL.match(regExp) !== null) { 62 //AJAX to http://api.longurl.org/v2/expand?url=http://bit.ly/JATvIs&format=json&callback=hhh 63 var ajaxopts = $.extend({ 64 url: "http://api.longurl.org/v2/expand", 65 dataType: 'jsonp', 66 data: { 67 url: resourceURL, 68 format: "json" 69 //callback: "?" 70 }, 71 success: function (data) { 72 //this = $.fn.oembed; 73 resourceURL = data['long-url']; 74 provider = $.fn.oembed.getOEmbedProvider(data['long-url']); 75 76 //remove fallback 77 if (!!settings.fallback === false) { 78 provider = provider.name.toLowerCase() === 'opengraph' ? null : provider; 79 } 80 81 if (provider !== null) { 82 provider.params = getNormalizedParams(settings[provider.name]) || {}; 83 provider.maxWidth = settings.maxWidth; 84 provider.maxHeight = settings.maxHeight; 85 embedCode(container, resourceURL, provider); 86 } else { 87 settings.onProviderNotFound.call(container, resourceURL); 88 } 89 }, 90 error: function () { 91 settings.onError.call(container, resourceURL) 92 } 93 }, settings.longUrlAjaxOptions || settings.ajaxOptions || {}); 94 95 $.ajax(ajaxopts); 96 97 return container; 98 } 99 } 100 provider = $.fn.oembed.getOEmbedProvider(resourceURL); 101 102 //remove fallback 103 if (!!settings.fallback === false) { 104 provider = provider.name.toLowerCase() === 'opengraph' ? null : provider; 105 } 106 if (provider !== null) { 107 provider.params = getNormalizedParams(settings[provider.name]) || {}; 108 provider.maxWidth = settings.maxWidth; 109 provider.maxHeight = settings.maxHeight; 110 embedCode(container, resourceURL, provider); 111 } else { 112 settings.onProviderNotFound.call(container, resourceURL); 113 } 114 } 115 return container; 116 }); 117 }; 118 119 var settings; 120 121 // Plugin defaults 122 $.fn.oembed.defaults = { 123 fallback: true, 124 maxWidth: null, 125 maxHeight: null, 126 includeHandle: true, 127 embedMethod: 'auto', 128 // "auto", "append", "fill" 129 onProviderNotFound: function () { 130 }, 131 beforeEmbed: function () { 132 }, 133 afterEmbed: function () { 134 }, 135 onEmbed: false, 136 onError: function (a, b, c, d) { 137 console.log('err:', a, b, c, d) 138 }, 139 ajaxOptions: {}, 140 longUrlAjaxOptions: {} 141 }; 142 143 /* Private functions */ 144 function rand(length, current) { //Found on http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript 145 current = current ? current : ''; 146 return length ? rand(--length, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".charAt(Math.floor(Math.random() * 60)) + current) : current; 147 } 148 149 function getRequestUrl(provider, externalUrl) { 150 var url = provider.apiendpoint, 151 qs = "", 152 i; 153 url += (url.indexOf("?") <= 0) ? "?" : "&"; 154 url = url.replace('#', '%23'); 155 156 if (provider.maxWidth !== null && (typeof provider.params.maxwidth === 'undefined' || provider.params.maxwidth === null)) { 157 provider.params.maxwidth = provider.maxWidth; 158 } 159 160 if (provider.maxHeight !== null && (typeof provider.params.maxheight === 'undefined' || provider.params.maxheight === null)) { 161 provider.params.maxheight = provider.maxHeight; 162 } 163 164 for (i in provider.params) { 165 // We don't want them to jack everything up by changing the callback parameter 166 if (i == provider.callbackparameter) 167 continue; 168 169 // allows the options to be set to null, don't send null values to the server as parameters 170 if (provider.params[i] !== null) 171 qs += "&" + escape(i) + "=" + provider.params[i]; 172 } 173 174 url += "format=" + provider.format + "&url=" + escape(externalUrl) + qs; 175 if (provider.dataType != 'json') 176 url += "&" + provider.callbackparameter + "=?"; 177 178 return url; 179 } 180 181 function success(oembedData, externalUrl, container) { 182 $('#jqoembeddata').data(externalUrl, oembedData.code); 183 settings.beforeEmbed.call(container, oembedData); 184 settings.onEmbed.call(container, oembedData); 185 settings.afterEmbed.call(container, oembedData); 186 } 187 188 function embedCode(container, externalUrl, embedProvider) { 189 if ($('#jqoembeddata').data(externalUrl) != undefined && embedProvider.embedtag.tag != 'iframe') { 190 var oembedData = {code: $('#jqoembeddata').data(externalUrl)}; 191 success(oembedData, externalUrl, container); 192 } else if (embedProvider.yql) { 193 var from = embedProvider.yql.from || 'htmlstring'; 194 var url = embedProvider.yql.url ? embedProvider.yql.url(externalUrl) : externalUrl; 195 var query = 'SELECT * FROM ' + from 196 + ' WHERE url="' + (url) + '"' 197 + " and " + (/html/.test(from) ? 'xpath' : 'itemPath') + "='" + (embedProvider.yql.xpath || '/') + "'"; 198 if (from == 'html') 199 query += " and compat='html5'"; 200 var ajaxopts = $.extend({ 201 url: "//query.yahooapis.com/v1/public/yql", 202 dataType: 'jsonp', 203 data: { 204 q: query, 205 format: "json", 206 env: 'store://datatables.org/alltableswithkeys', 207 callback: "?" 208 }, 209 success: function (data) { 210 var result; 211 212 if (embedProvider.yql.xpath && embedProvider.yql.xpath == '//meta|//title|//link') { 213 var meta = {}; 214 215 if (data.query == null) { 216 data.query = {}; 217 } 218 if (data.query.results == null) { 219 data.query.results = {"meta": []}; 220 } 221 for (var i = 0, l = data.query.results.meta.length; i < l; i++) { 222 var name = data.query.results.meta[i].name || data.query.results.meta[i].property || null; 223 if (name == null)continue; 224 meta[name.toLowerCase()] = data.query.results.meta[i].content; 225 } 226 if (!meta.hasOwnProperty("title") || !meta.hasOwnProperty("og:title")) { 227 if (data.query.results.title != null) { 228 meta.title = data.query.results.title; 229 } 230 } 231 if (!meta.hasOwnProperty("og:image") && data.query.results.hasOwnProperty("link")) { 232 for (var i = 0, l = data.query.results.link.length; i < l; i++) { 233 if (data.query.results.link[i].hasOwnProperty("rel")) { 234 if (data.query.results.link[i].rel == "apple-touch-icon") { 235 if (data.query.results.link[i].href.charAt(0) == "/") { 236 meta["og:image"] = url.match(/^(([a-z]+:)?(\/\/)?[^\/]+\/).*$/)[1] + data.query.results.link[i].href; 237 } else { 238 meta["og:image"] = data.query.results.link[i].href; 239 } 240 } 241 } 242 } 243 } 244 result = embedProvider.yql.datareturn(meta); 245 } else { 246 result = embedProvider.yql.datareturn ? embedProvider.yql.datareturn(data.query.results) : data.query.results.result; 247 } 248 if (result === false)return; 249 var oembedData = $.extend({}, result); 250 oembedData.code = result; 251 success(oembedData, externalUrl, container); 252 }, 253 error: settings.onError.call(container, externalUrl, embedProvider) 254 }, settings.ajaxOptions || {}); 255 $.ajax(ajaxopts); 256 } else if (embedProvider.templateRegex) { 257 if (embedProvider.embedtag.tag !== '') { 258 var flashvars = embedProvider.embedtag.flashvars || ''; 259 var tag = embedProvider.embedtag.tag || 'embed'; 260 var width = embedProvider.embedtag.width || 'auto'; 261 var height = embedProvider.embedtag.height || 'auto'; 262 var src = externalUrl.replace(embedProvider.templateRegex, embedProvider.apiendpoint); 263 264 if (!embedProvider.nocache) { 265 src += '&jqoemcache=' + rand(5); 266 } 267 268 if (embedProvider.apikey) { 269 src = src.replace('_APIKEY_', settings.apikeys[embedProvider.name]); 270 } 271 272 var code = $('<' + tag + '/>').attr('src', src).attr('width', width) 273 .attr('height', height) 274 .attr('allowfullscreen', embedProvider.embedtag.allowfullscreen || 'true') 275 .attr('allowscriptaccess', embedProvider.embedtag.allowfullscreen || 'always') 276 .css('max-height', settings.maxHeight || 'auto') 277 .css('max-width', settings.maxWidth || 'auto'); 278 279 if (tag == 'embed') { 280 code.attr('type', embedProvider.embedtag.type || "application/x-shockwave-flash") 281 .attr('flashvars', externalUrl.replace(embedProvider.templateRegex, flashvars)); 282 } 283 284 if (tag == 'iframe') { 285 code.attr('scrolling', embedProvider.embedtag.scrolling || "no") 286 .attr('frameborder', embedProvider.embedtag.frameborder || "0"); 287 288 } 289 290 success({code: code}, externalUrl, container); 291 } else if (embedProvider.apiendpoint) { 292 //Add APIkey if true 293 if (embedProvider.apikey) 294 embedProvider.apiendpoint = embedProvider.apiendpoint.replace('_APIKEY_', settings.apikeys[embedProvider.name]); 295 296 ajaxopts = $.extend({ 297 url: externalUrl.replace(embedProvider.templateRegex, embedProvider.apiendpoint), 298 dataType: 'jsonp', 299 success: function (data) { 300 var oembedData = $.extend({}, data); 301 oembedData.code = embedProvider.templateData(data); 302 success(oembedData, externalUrl, container); 303 }, 304 error: settings.onError.call(container, externalUrl, embedProvider) 305 }, settings.ajaxOptions || {}); 306 $.ajax(ajaxopts); 307 } else { 308 success({code: externalUrl.replace(embedP
308rovider.templateRegex, embedProvider.template)}, externalUrl, container); 309 } 310 } else { 311 312 var requestUrl = getRequestUrl(embedProvider, externalUrl); 313 ajaxopts = $.extend({ 314 url: requestUrl, 315 dataType: embedProvider.dataType || 'jsonp', 316 success: function (data) { 317 var oembedData = $.extend({}, data); 318 switch (oembedData.type) { 319 case "file": //Deviant Art has this 320 case "photo": 321 oembedData.code = $.fn.oembed.getPhotoCode(externalUrl, oembedData); 322 break; 323 case "video": 324 case "rich": 325 oembedData.code = $.fn.oembed.getRichCode(externalUrl, oembedData); 326 break; 327 default: 328 oembedData.code = $.fn.oembed.getGenericCode(externalUrl, oembedData); 329 break; 330 } 331 success(oembedData, externalUrl, container); 332 }, 333 error: settings.onError.call(container, externalUrl, embedProvider) 334 }, settings.ajaxOptions || {}); 335 $.ajax(ajaxopts); 336 } 337 } 338 339 function getNormalizedParams(params) { 340 if (params === null) return null; 341 var key, normalizedParams = {}; 342 for (key in params) { 343 if (key !== null) normalizedParams[key.toLowerCase()] = params[key]; 344 } 345 return normalizedParams; 346 } 347 348 /* Public functions */ 349 $.fn.oembed.insertCode = function (container, embedMethod, oembedData) { 350 if (oembedData === null) 351 return; 352 353 if (embedMethod === 'auto' && container.attr('href') !== null) { 354 embedMethod = 'append'; 355 } else if (embedMethod == 'auto') { 356 embedMethod = 'replace'; 357 } 358 359 switch (embedMethod) { 360 case "replace": 361 container.replaceWith(oembedData.code); 362 break; 363 case "fill": 364 container.html(oembedData.code); 365 break; 366 case "append": 367 container.wrap('<div class="oembedall-container"></div>'); 368 var oembedContainer = container.parent(); 369 if (settings.includeHandle) { 370 $('<span class="oembedall-closehide">↓</span>').insertBefore(container).click(function () { 371 var encodedString = encodeURIComponent($(this).text()); 372 $(this).html((encodedString == '%E2%86%91') ? '↓' : '↑'); 373 $(this).parent().children().last().toggle(); 374 }); 375 } 376 oembedContainer.append('<br/>'); 377 try { 378 oembedData.code.clone().appendTo(oembedContainer); 379 } catch (e) { 380 oembedContainer.append(oembedData.code); 381 } 382 /* Make videos semi-responsive 383 * If parent div width less than embeded iframe video then iframe gets shrunk to fit smaller width 384 * If parent div width greater thans embed iframe use the max widht 385 * - works on youtubes and vimeo 386 */ 387 if (settings.maxWidth) { 388 var post_width = oembedContainer.parent().width(); 389 if (post_width < settings.maxWidth) { 390 var iframe_width_orig = $('iframe', oembedContainer).width(); 391 var iframe_height_orig = $('iframe', oembedContainer).height(); 392 var ratio = iframe_width_orig / post_width; 393 $('iframe', oembedContainer).width(iframe_width_orig / ratio); 394 $('iframe', oembedContainer).height(iframe_height_orig / ratio); 395 } else { 396 if (settings.maxWidth) { 397 $('iframe', oembedContainer).width(settings.maxWidth); 398 } 399 if (settings.maxHeight) { 400 $('iframe', oembedContainer).height(settings.maxHeight); 401 } 402 } 403 } 404 break; 405 } 406 }; 407 408 $.fn.oembed.getPhotoCode = function (url, oembedData) { 409 var code; 410 var alt = oembedData.title ? oembedData.title : ''; 411 alt += oembedData.author_name ? ' - ' + oembedData.author_name : ''; 412 alt += oembedData.provider_name ? ' - ' + oembedData.provider_name : ''; 413 414 if (oembedData.url) { 415 code = '<div><a href="' + url + '" target=\'_blank\'><img src="' + oembedData.url + '" alt="' + alt + '"/></a></div>'; 416 } else if (oembedData.thumbnail_url) { 417 var newURL = oembedData.thumbnail_url.replace('_s', '_b'); 418 code = '<div><a href="' + url + '" target=\'_blank\'><img src="' + newURL + '" alt="' + alt + '"/></a></div>'; 419 } else { 420 code = '<div>Error loading this picture</div>'; 421 } 422 423 if (oembedData.html) { 424 code += "<div>" + oembedData.html + "</div>"; 425 } 426 427 return code; 428 }; 429 430 $.fn.oembed.getRichCode = function (url, oembedData) { 431 return oembedData.html; 432 }; 433 434 $.fn.oembed.getGenericCode = function (url, oembedData) { 435 var title = ((oembedData.title) && (oembedData.title !== null)) ? oembedData.title : url; 436 var code = '<a href="' + url + '">' + title + '</a>'; 437 438 if (oembedData.html) { 439 code += "<div>" + oembedData.html + "</div>"; 440 } 441 442 return code; 443 }; 444 445 $.fn.oembed.getOEmbedProvider = function (url) { 446 for (var i = 0; i < $.fn.oembed.providers.length; i++) { 447 for (var j = 0, l = $.fn.oembed.providers[i].urlschemes.length; j < l; j++) { 448 var regExp = new RegExp($.fn.oembed.providers[i].urlschemes[j], "i"); 449 450 if (url.match(regExp) !== null) 451 return $.fn.oembed.providers[i];
452 } 453 } 454 return null; 455 }; 456 457 // Constructor Function for OEmbedProvider Class. 458 $.fn.oembed.OEmbedProvider = function (name, type, urlschemesarray, apiendpoint, extraSettings) { 459 this.name = name; 460 this.type = type; // "photo", "video", "link", "rich", null 461 this.urlschemes = urlschemesarray; 462 this.apiendpoint = apiendpoint; 463 this.maxWidth = 500; 464 this.maxHeight = 400; 465 extraSettings = extraSettings || {}; 466 467 if (extraSettings.useYQL) { 468 469 if (extraSettings.useYQL == 'xml') { 470 extraSettings.yql = { 471 xpath: "//oembed/html", 472 from: 'xml', 473 apiendpoint: this.apiendpoint, 474 url: function (externalurl) { 475 return this.apiendpoint + '?format=xml&url=' + externalurl 476 }, 477 datareturn: function (results) { 478 return results.html.replace(/.*\[CDATA\[(.*)\]\]>$/, '$1') || '' 479 } 480 }; 481 } else { 482 extraSettings.yql = { 483 from: 'json', 484 apiendpoint: this.apiendpoint, 485 url: function (externalurl) { 486 return this.apiendpoint + '?format=json&url=' + externalurl 487 }, 488 datareturn: function (results) { 489 if (results.json.type != 'video' && (results.json.url || results.json.thumbnail_url)) { 490 return '<img src="' + (results.json.url || results.json.thumbnail_url) + '" />'; 491 } 492 return results.json.html || '' 493 } 494 }; 495 } 496 this.apiendpoint = null; 497 } 498 499 500 for (var property in extraSettings) { 501 this[property] = extraSettings[property]; 502 } 503 504 this.format = this.format || 'json'; 505 this.callbackparameter = this.callbackparameter || "callback"; 506 this.embedtag = this.embedtag || {tag: ""}; 507 508 509 }; 510 511 /* 512 * Function to update existing providers 513 * 514 * @param {String} name The name of the provider 515 * @param {String} type The type of the provider can be "file", "photo", "video", "rich" 516 * @param {String} urlshemesarray Array of url of the provider 517 * @param {String} apiendpoint The endpoint of the provider 518 * @param {String} extraSettings Extra settings of the provider 519 */ 520 $.fn.updateOEmbedProvider = function (name, type, urlschemesarray, apiendpoint, extraSettings) { 521 for (var i = 0; i < $.fn.oembed.providers.length; i++) { 522 if ($.fn.oembed.providers[i].name === name) { 523 if (type !== null) { 524 $.fn.oembed.providers[i].type = type; 525 } 526 if (urlschemesarray !== null) { 527 $.fn.oembed.providers[i].urlschemes = urlschemesarray; 528 } 529 if (apiendpoint !== null) { 530 $.fn.oembed.providers[i].apiendpoint = apiendpoint; 531 } 532 if (extraSettings !== null) { 533 $.fn.oembed.providers[i].extraSettings = extraSettings; 534 for (var property in extraSettings) { 535 if (property !== null && extraSettings[property] !== null) { 536 $.fn.oembed.providers[i][property] = extraSettings[property]; 537 } 538 } 539 } 540 } 541 } 542 }; 543 544 /* Native & common providers */ 545 $.fn.oembed.providers = [ 546 547 //Video 548 new $.fn.oembed.OEmbedProvider("youtube", "video", ["youtube\\.com/watch.+v=[\\w-]+&?", "youtu\\.be/[\\w-]+", "youtube.com/embed"], '//www.youtube.com/embed/$1?wmode=transparent', { 549 templateRegex: /.*(?:v\=|be\/|embed\/)([\w\-]+)&?.*/, embedtag: {tag: 'iframe', width: '425', height: '349'} 550 }), 551 552 //new $.fn.oembed.OEmbedProvider("youtube", "video", ["youtube\\.com/watch.+v=[\\w-]+&?", "youtu\\.be/[\\w-]+"], 'http://www.youtube.com/oembed', {useYQL:'json'}), 553 //new $.fn.oembed.OEmbedProvider("youtubeiframe", "video", ["youtube.com/embed"], "$1?wmode=transparent", 554 // {templateRegex:/(.*)/,embedtag : {tag: 'iframe', width:'425',height: '349'}}), 555 new $.fn.oembed.OEmbedProvider("wistia", "video", ["wistia.com/medias/.+", "wistia.com/m/.+", "wistia.com/embed/.+", "wi.st/m/.+", "wi.st/embed/.+"], 'http://fast.wistia.com/oembed', {useYQL: 'json'}), 556 new $.fn.oembed.OEmbedProvider("xtranormal", "video", ["xtranormal\\.com/watch/.+"], "http://www.xtranormal.com/xtraplayr/$1/$2", { 557 templateRegex: /.*com\/watch\/([\w\-]+)\/([\w\-]+).*/, embedtag: {tag: 'iframe', width: '320', height: '269'}}), 558 new $.fn.oembed.OEmbedProvider("scivee", "video", ["scivee.tv/node/.+"], "http://www.scivee.tv/flash/embedCast.swf?", { 559 templateRegex: /.*tv\/node\/(.+)/, embedtag: {width: '480', height: '400', flashvars: "id=$1&type=3"}}), 560 new $.fn.oembed.OEmbedProvider("veoh", "video", ["veoh.com/watch/.+"], "http://www.veoh.com/swf/webplayer/WebPlayer.swf?version=AFrontend.5.7.0.1337&permalinkId=$1&player=videodetail
560sembedded&videoAutoPlay=0&id=anonymous", { 561 templateRegex: /.*watch\/([^\?]+).*/, embedtag: {width: '410', height: '341'}}), 562 new $.fn.oembed.OEmbedProvider("gametrailers", "video", ["gametrailers\\.com/video/.+"], "http://media.mtvnservices.com/mgid:moses:video:gametrailers.com:$2", { 563 templateRegex: /.*com\/video\/([\w\-]+)\/([\w\-]+).*/, embedtag: {width: '512', height: '288' }}), 564 new $.fn.oembed.OEmbedProvider("funnyordie", "video", ["funnyordie\\.com/videos/.+"], "http://player.ordienetworks.com/flash/fodplayer.swf?", { 565 templateRegex: /.*videos\/([^\/]+)\/([^\/]+)?/, embedtag: {width: 512, height: 328, flashvars: "key=$1"}}), 566 new $.fn.oembed.OEmbedProvider("colledgehumour", "video", ["collegehumor\\.com/video/.+"], "http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=$1&use_node_id=true&fullscreen=1", 567 {templateRegex: /.*video\/([^\/]+).*/, embedtag: {width: 600, height: 338}}), 568 new $.fn.oembed.OEmbedProvider("metacafe", "video", ["metacafe\\.com/watch/.+"], "http://www.metacafe.com/fplayer/$1/$2.swf", 569 {templateRegex: /.*watch\/(\d+)\/(\w+)\/.*/, embedtag: {width: 400, height: 345}}), 570 new $.fn.oembed.OEmbedProvider("bambuser", "video", ["bambuser\\.com\/channel\/.*\/broadcast\/.*"], "http://static.bambuser.com/r/player.swf?vid=$1", 571 {templateRegex: /.*bambuser\.com\/channel\/.*\/broadcast\/(\w+).*/, embedtag: {width: 512, height: 339 }}), 572 new $.fn.oembed.OEmbedProvider("twitvid", "video", ["twitvid\\.com/.+"], "http://www.twitvid.com/embed.php?guid=$1&autoplay=0", 573 {templateRegex: /.*twitvid\.com\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }}), 574 new $.fn.oembed.OEmbedProvider("aniboom", "video", ["aniboom\\.com/animation-video/.+"], "http://api.aniboom.com/e/$1", 575 {templateRegex: /.*animation-video\/(\d+).*/, embedtag: {width: 594, height: 334}}), 576 new $.fn.oembed.OEmbedProvider("vzaar", "video", ["vzaar\\.com/videos/.+", "vzaar.tv/.+"], "http://view.vzaar.com/$1/player?", 577 {templateRegex: /.*\/(\d+).*/, embedtag: {tag: 'iframe', width: 576, height: 324 }}), 578 new $.fn.oembed.OEmbedProvider("snotr", "video", ["snotr\\.com/video/.+"], "http://www.snotr.com/embed/$1", 579 {templateRegex: /.*\/(\d+).*/, embedtag: {tag: 'iframe', width: 400, height: 330}, nocache: 1 }), 580 new $.fn.oembed.OEmbedProvider("youku", "video", ["v.youku.com/v_show/id_.+"], "http://player.youku.com/player.php/sid/$1/v.swf", 581 {templateRegex: /.*id_(.+)\.html.*/, embedtag: {width: 480, height: 400}, nocache: 1 }), 582 new $.fn.oembed.OEmbedProvider("tudou", "video", ["tudou.com/programs/view/.+\/"], "http://www.tudou.com/v/$1/v.swf", 583 {templateRegex: /.*view\/(.+)\//, embedtag: {width: 480, height: 400}, nocache: 1 }), 584 new $.fn.oembed.OEmbedProvider("embedr", "video", ["embedr\\.com/playlist/.+"], "http://embedr.com/swf/slider/$1/425/520/default/false/std?", 585 {templateRegex: /.*playlist\/([^\/]+).*/, embedtag: {width: 425, height: 520}}), 586 new $.fn.oembed.OEmbedProvider("blip", "video", ["blip\\.tv/.+"], "//blip.tv/oembed/"), 587 new $.fn.oembed.OEmbedProvider("minoto-video", "video", ["http://api.minoto-video.com/publishers/.+/videos/.+", "http://dashboard.minoto-video.com/main/video/details/.+", "http://embed.minoto-video.com/.+"], "http://api.minoto-video.com/services/oembed.json", {useYQL: 'json'}), 588 new $.fn.oembed.OEmbedProvider("animoto", "video", ["animoto.com/play/.+"], "http://animoto.com/services/oembed"), 589 new $.fn.oembed.OEmbedProvider("hulu", "video", ["hulu\\.com/watch/.*"], "//www.hulu.com/api/oembed.json"), 590 new $.fn.oembed.OEmbedProvider("ustream", "video", ["ustream\\.tv/recorded/.*"], "http://www.ustream.tv/oembed", {useYQL: 'json'}), 591 new $.fn.oembed.OEmbedProvider("videojug", "video", ["videojug\\.com/(film|payer|interview).*"], "http://www.videojug.com/oembed.json", {useYQL: 'json'}), 592 new $.fn.oembed.OEmbedProvider("sapo", "video", ["videos\\.sapo\\.pt/.*"], "http://videos.sapo.pt/oembed", {useYQL: 'json'}), 593 new $.fn.oembed.OEmbedProvider("vodpod", "video", ["vodpod.com/watch/.*"], "http://vodpod.com/oembed.js", {useYQL: 'json'}), 594 new $.fn.oembed.OEmbedProvider("vimeo", "video", ["www\.vimeo\.com\/groups\/.*\/videos\/.*", "www\.vimeo\.com\/.*", "vimeo\.com\/groups\/.*\/videos\/.*", "vimeo\.com\/.*"], "//vimeo.com/api/oembed.json"), 595 new $.fn.oembed.OEmbedProvider("dailymotion", "video", ["dailymotion\\.com/.+"], '//www.dailymotion.com/services/oembed'), 596 new $.fn.oembed.OEmbedProvider("5min", "video", ["www\\.5min\\.com/.+"], 'http://api.5min.com/oembed.xml', {useYQL: 'xml'}), 597 new $.fn.oembed.OEmbedProvider("National Film Board of Canada", "video", ["nfb\\.ca/film/.+"], 'http://www.nfb.ca/remote/services/oembed/', {useYQL: 'json'}), 598 new $.fn.oembed.OEmbedProvider("qik", "video", ["qik\\.com/\\w+"], 'http://qik.com/api/oembed.json', {useYQL: 'json'}), 599 new $.fn.oembed.OEmbedProvider("revision3", "video", ["revision3\\.com"], "http://revision3.com/api/oembed/"), 600 new $.fn.oembed.OEmbedProvider("dotsub", "video", ["dotsub\\.com/view/.+"], "http://dotsub.com/services/oembed", {useYQL: 'json'}), 601 new $.fn.oembed.OEmbedProvider("clikthrough", "video", ["clikthrough\\.com/theater/video/\\d+"], "http://clikthrough.com/services/oembed"), 602 new $.fn.oembed.OEmbedProvider("Kinomap", "video", ["kinomap\\.com/.+"], "http://www.kinomap.com/oembed"), 603 new $.fn.oembed.OEmbedProvider("VHX", "video", ["vhx.tv/.+"], "http://vhx.tv/services/oembed.json"), 604 new $.fn.oembed.OEmbedProvider("bambuser", "video", ["bambuser.com/.+"], "http://api.bambuser.com/oembed/iframe.json"), 605 new $.fn.oembed.OEmbedProvider("justin.tv", "video", ["justin.tv/.+"], 'http://api.justin.tv/api/embed/from_url.json', {useYQL: 'json'}), 606 new $.fn.oembed.OEmbedProvider("vine", "video", ["vine.co/v/.*"], null, 607 { 608 templateRegex: /https?:\/\/w?w?w?.?vine\.co\/v\/([a-zA-Z0-9]*).*/, 609 template: '<iframe src="https://vine.co/v/$1/embed/postcard" width="600" height="600" allowfullscreen="true" allowscriptaccess="always" scrolling="no" frameborder="0"></iframe>' + 610 '<script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script>', 611 nocache: 1 612 }), 613 new $.fn.oembed.OEmbedProvider("boxofficebuz", "video", ["boxofficebuz\\.com\\/embed/.+"], "http://boxofficebuz.com/embed/$1/$2", {templateRegex: [/.*boxofficebuz\.com\/embed\/(\w+)\/([\w*\-*]+)/], embedtag: {tag: 'iframe', width: 480, height: 360 }}), 614 new $.fn.oembed.OEmbedProvider("clipsyndicate", "video", ["clipsyndicate\\.com/video/play/.+", "clipsyndicate\\.com/embed/iframe\?.+"], "http://eplayer.clipsyndicate.com/embed/iframe?pf_id=1&show_title=0&va_id=$1&windows=1", {templateRegex: [/.*www\.clipsyndicate\.com\/video\/play\/(\w+)\/.*/, /.*eplayer\.clipsyndicate\.com\/embed\/iframe\?.*va_id=(\w+).*.*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 615 new $.fn.oembed.OEmbedProvider("coub", "video", ["coub\\.com/.+"], "http://www.coub.com/embed/$1?muted=false&autostart=false&originalSize=false&hideTopBar=false&noSiteButtons=false&startWithHD=false", {templateRegex: [/.*coub\.com\/embed\/(\w+)\?*.*/, /.*coub\.com\/view\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 616 new $.fn.oembed.OEmbedProvider("discoverychannel", "video", ["snagplayer\\.video\\.dp\\.discovery\\.com/.+"], "http://snagplayer.video.dp.discovery.com/$1/snag-it-player.htm?auto=no", {templateRegex: [/.*snagplayer\.video\.dp\.discovery\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }}), 617 new $.fn.oembed.OEmbedProvider("telly", "video", ["telly\\.com/.+"], "http://www.telly.com/embed.php?guid=$1&autoplay=0", {templateRegex: [/.*telly\.com\/embed\.php\?guid=(\w+).*/, /.*telly\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }}), 618 new $.fn.oembed.OEmbedProvider("minilogs", "video", ["minilogs\\.com/.+"], "http://www.minilogs.com/e/$1", {templateRegex: [/.*minilogs\.com\/e\/(\w+).*/, /.*minilogs\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 619 new $.fn.oembed.OEmbedProvider("viddy", "video", ["viddy\\.com/.+"], "http://www.viddy.com/embed/video/$1", {templateRegex: [/.*viddy\.com\/embed\/video\/(\.*)/, /.*viddy\.com\/video\/(\.*)/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
620 new $.fn.oembed.OEmbedProvider("worldstarhiphop", "video", ["worldstarhiphop\\.com\/embed/.+"], "http://www.worldstarhiphop.com/embed/$1", {templateRegex: /.*worldstarhiphop\.com\/embed\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 621 new $.fn.oembed.OEmbedProvider("zapiks", "video", ["zapiks\\.fr\/.+"], "http://www.zapiks.fr/index.php?action=playerIframe&media_id=$1&autoStart=fals", {templateRegex: /.*zapiks\.fr\/index.php\?[\w\=\&]*media_id=(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 622 623 //Audio 624 new $.fn.oembed.OEmbedProvider("official.fm", "rich", ["official.fm/.+"], 'http://official.fm/services/oembed', {useYQL: 'json'}), 625 new $.fn.oembed.OEmbedProvider("chirbit", "rich", ["chirb.it/.+"], 'http://chirb.it/oembed.json', {useYQL: 'json'}), 626 new $.fn.oembed.OEmbedProvider("chirbit", "audio", ["chirb\\.it/.+"], "http://chirb.it/wp/$1", {templateRegex: [/.*chirb\.it\/wp\/(\w+).*/, /.*chirb\.it\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 627 new $.fn.oembed.OEmbedProvider("Huffduffer", "rich", ["huffduffer.com/[-.\\w@]+/\\d+"], "http://huffduffer.com/oembed"), 628 new $.fn.oembed.OEmbedProvider("Spotify", "rich", ["open.spotify.com/(track|album|user)/"], "https://embed.spotify.com/oembed/"), 629 new $.fn.oembed.OEmbedProvider("shoudio", "rich", ["shoudio.com/.+", "shoud.io/.+"], "http://shoudio.com/api/oembed"), 630 new $.fn.oembed.OEmbedProvider("mixcloud", "rich", ["mixcloud.com/.+"], 'http://www.mixcloud.com/oembed/', {useYQL: 'json'}), 631 new $.fn.oembed.OEmbedProvider("rdio.com", "rich", ["rd.io/.+", "rdio.com"], "http://www.rdio.com/api/oembed/"), 632 new $.fn.oembed.OEmbedProvider("Soundcloud", "rich", ["soundcloud.com/.+", "snd.sc/.+"], "//soundcloud.com/oembed", {format: 'js'}), 633 new $.fn.oembed.OEmbedProvider("bandcamp", "rich", ["bandcamp\\.com/album/.+"], null, 634 { 635 yql: { 636 xpath: "//meta[contains(@content, \\'EmbeddedPlayer\\')]", 637 from: 'html', 638 datareturn: function (results) { 639 return results.meta ? '<iframe width="400" height="100" src="' + results.meta.content + '" allowtransparency="true" frameborder="0"></iframe>' : false; 640 } 641 } 642 }), 643 644 //Photo 645 new $.fn.oembed.OEmbedProvider("deviantart", "photo", ["deviantart.com/.+", "fav.me/.+", "deviantart.com/.+"], "//backend.deviantart.com/oembed", {format: 'jsonp'}), 646 new $.fn.oembed.OEmbedProvider("skitch", "photo", ["skitch.com/.+"], null, 647 { 648 yql: { 649 xpath: "json", 650 from: 'json', 651 url: function (externalurl) { 652 return 'http://skitch.com/oembed/?format=json&url=' + externalurl 653 }, 654 datareturn: function (data) { 655 return $.fn.oembed.getPhotoCode(data.json.url, data.json); 656 } 657 } 658 }), 659 new $.fn.oembed.OEmbedProvider("mobypicture", "photo", ["mobypicture.com/user/.+/view/.+", "moby.to/.+"], "http://api.mobypicture.com/oEmbed"), 660 new $.fn.oembed.OEmbedProvider("flickr", "photo", ["flickr\\.com/photos/.+"], "//flickr.com/services/oembed", {callbackparameter: 'jsoncallback'}), 661 new $.fn.oembed.OEmbedProvider("photobucket", "photo", ["photobucket\\.com/(albums|groups)/.+"], "http://photobucket.com/oembed/"), 662 new $.fn.oembed.OEmbedProvider("instagram", "photo", ["instagr\\.?am(\\.com)?/.+"], "//api.instagram.com/oembed"), 663 //new $.fn.oembed.OEmbedProvider("yfrog", "photo", ["yfrog\\.(com|ru|com\\.tr|it|fr|co\\.il|co\\.uk|com\\.pl|pl|eu|us)/.+"], "http://www.yfrog.com/api/oembed",{useYQL:"json"}), 664 new $.fn.oembed.OEmbedProvider("SmugMug", "photo", ["smugmug.com/[-.\\w@]+/.+"], "http://api.smugmug.com/services/oembed/"), 665 new $.fn.oembed.OEmbedProvider("dribbble", "photo", ["dribbble.com/shots/.+"], "http://api.dribbble.com/shots/$1?callback=?", 666 { 667 templateRegex: /.*shots\/([\d]+).*/, 668 templateData: function (data) { 669 if (!data.image_teaser_url) { 670 return false; 671 } 672 return '<img src="' + data.image_teaser_url + '"/>'; 673 } 674 }), 675 new $.fn.oembed.OEmbedProvider("chart.ly", "photo", ["chart\\.ly/[a-z0-9]{6,8}"], "http://chart.ly/uploads/large_$1.png", 676 {templateRegex: /.*ly\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}), 677 //new $.fn.oembed.OEmbedProvider("stocktwits.com", "photo", ["stocktwits\\.com/message/.+"], "http://charts.stocktwits.com/production/original_$1.png?", 678 // { templateRegex: /.*message\/([^\/]+).*/, embedtag: { tag: 'img'},nocache:1 }), 679 new $.fn.oembed.OEmbedProvider("circuitlab", "photo", ["circuitlab.com/circuit/.+"], "https://www.circuitlab.com/circuit/$1/screenshot/540x405/", 680 {templateRegex: /.*circuit\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}), 681 new $.fn.oembed.OEmbedProvider("23hq", "photo", ["23hq.com/[-.\\w@]+/photo/.+"], "http://www.23hq.com/23/oembed", {useYQL: "json"}), 682 new $.fn.oembed.OEmbedProvider("img.ly", "photo", ["img\\.ly/.+"], "//img.ly/show/thumb/$1", 683 {templateRegex: /.*ly\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}), 684 new $.fn.oembed.OEmbedProvider("twitgoo.com", "photo", ["twitgoo\\.com/.+"], "http://twitgoo.com/show/thumb/$1", 685 {templateRegex: /.*com\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}), 686 new $.fn.oembed.OEmbedProvider("imgur.com", "photo", ["imgur\\.com/gallery/.+"], "http://imgur.com/$1l.jpg", 687 {templateRegex: /.*gallery\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}), 688 new $.fn.oembed.OEmbedProvider("visual.ly", "rich", ["visual\\.ly/.+"], null, 689 { 690 yql: { 691 xpath: "//a[@id=\\'gc_article_graphic_image\\']/img", 692 from: 'htmlstring' 693 } 694 }), 695 new $.fn.oembed.OEmbedProvider("achewood", "photo", ["achewood\\.com\\/index.php\\?date=.+"], "http://www.achewood.com/comic.php?date=$1", {templateRegex: /.*achewood\.com\/index.php\?date=(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 696 new $.fn.oembed.OEmbedProvider("fotokritik", "photo", ["fotokritik\\.com/.+"], "http://www.fotokritik.com/embed/$1", {templateRegex: [/.*fotokritik\.com\/embed\/(\w+).*/, /.*fotokritik\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 697 new $.fn.oembed.OEmbedProvider("giflike", "photo", ["giflike\\.com/.+"], "http://www.giflike.com/embed/$1", {templateRegex: [/.*giflike\.com\/embed\/(\w+).*/, /.*giflike\.com\/a\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 698 699 //Rich 700 new $.fn.oembed.OEmbedProvider("twitter", "rich", ["twitter.com/.+"], "https://api.twitter.com/1/statuses/oembed.json"), 701 new $.fn.oembed.OEmbedProvider("gmep", "rich", ["gmep.imeducate.com/.*", "gmep.org/.*"], "http://gmep.org/oembed.json"), 702 new $.fn.oembed.OEmbedProvider("urtak", "rich", ["urtak.com/(u|clr)/.+"], "http://oembed.urtak.com/1/oembed"), 703 new $.fn.oembed.OEmbedProvider("cacoo", "rich", ["cacoo.com/.+"], "http://cacoo.com/oembed.json"), 704 new $.fn.oembed.OEmbedProvider("dailymile", "rich", ["dailymile.com/people/.*/entries/.*"], "http://api.dailymile.com/oembed"), 705 new $.fn.oembed.OEmbedProvider("documentcloud", "rich", ["documentcloud.org/documents/.+"], "https://www.documentcloud.org/api/oembed.json"), 706 new $.fn.oembed.OEmbedProvider("dipity", "rich", ["dipity.com/timeline/.+"], 'http://www.dipity.com/oembed/timeline/', {useYQL: 'json'}), 707 new $.fn.oembed.OEmbedProvider("sketchfab", "rich", ["sketchfab.com/show/.+"], 'http://sketchfab.com/oembed', {useYQL: 'json'}), 708 new $.fn.oembed.OEmbedProvider("speakerdeck", "rich", ["speakerdeck.com/.+"], 'http://speakerdeck.com/oembed.json', {useYQL: 'json'}), 709 new $.fn.oembed.OEmbedProvider("popplet", "rich", ["popplet.com/app/.*"], "http://popplet.com/app/Popplet_Alpha.swf?page_id=$1&em=1", 710 { 711 templateRegex: /.*#\/([^\/]+).*/, 712 embedtag: { 713 width: 460, 714 height: 460 715 } 716 }), 717 718 new $.fn.oembed.OEmbedProvider("pearltrees", "rich", ["pearltrees.com/.*"], "http://cdn.pearltrees.com/s/embed/getApp?", 719 { 720 templateRegex: /.*N-f=1_(\d+).*N-p=(\d+).*/, 721 embedtag: { 722 width: 460, 723 height: 460, 724 flashvars: "lang=en_US&embedId=pt-embed-$1-693&treeId=$1&pearlId=$2&treeTitle=Diagrams%2FVisualization&site=www.pearltrees.com%2FF" 725 } 726 }), 727 728 new $.fn.oembed.OEmbedProvider("prezi", "rich", ["prezi.com/.*"], "//prezi.com/bin/preziloader.swf?", 729 { 730 templateRegex: /.*com\/([^\/]+)\/.*/, 731 embedtag: { 732 width: 550, 733 height: 400, 734 flashvars: "prezi_id=$1&lock_to_path=0&color=ffffff&autoplay=no&autohide_ctrls=0" 735 } 736 }), 737 738 new $.fn.oembed.OEmbedProvider("tourwrist", "rich", ["tourwrist.com/tours/.+"], null, 739 { 740 templateRegex: /.*tours.([\d]+).*/, 741 template: function (wm, tourid) { 742 setTimeout(function () { 743 if (loadEmbeds)loadEmbeds(); 744 }, 2000); 745 return "<div id='" + tourid + "' class='tourwrist-tour-embed direct'></div> <script type='text/javascript' src='http://tourwrist.com/tour_embed.js'></script>"; 746 } 747 }), 748 749 new $.fn.oembed.OEmbedProvider("meetup", "rich", ["meetup\\.(com|ps)/.+"], "http://api.meetup.com/oembed"), 750 new $.fn.oembed.OEmbedProvider("ebay", "rich", ["ebay\\.*"], "http://togo.ebay.com/togo/togo.swf?2008013100", 751 { 752 templateRegex: /.*\/([^\/]+)\/(\d{10,13}).*/, 753 embedtag: { 754 width: 355, 755 height: 300, 756 flashvars: "base=http://togo.ebay.com/togo/&lang=en-us&mode=normal&itemid=$2&query=$1" 757 } 758 }), 759 new $.fn.oembed.OEmbedProvider("wikipedia", "rich", ["wikipedia.org/wiki/.+"], "http://$1.wikipedia.org/w/api.php?action=parse&page=$2&format=json§ion=0&callback=?", { 760 templateRegex: /.*\/\/([\w]+).*\/wiki\/([^\/]+).*/, 761 templateData: function (data) { 762 if (!data.parse) 763 return false; 764 var text = data.parse['text']['*'].replace(/href="\/wiki/g, 'href="http://en.wikipedia.org/wiki'); 765 return '<div id="content"><h3><a class="nav-link" href="http://en.wikipedia.org/wiki/' + data.parse['displaytitle'] + '">' + data.parse['displaytitle'] + '</a></h3>
765' + text + '</div>'; 766 } 767 }), 768 new $.fn.oembed.OEmbedProvider("imdb", "rich", ["imdb.com/title/.+"], "http://www.imdbapi.com/?i=$1&callback=?", 769 { 770 templateRegex: /.*\/title\/([^\/]+).*/, 771 templateData: function (data) { 772 if (!data.Title) 773 return false; 774 return '<div id="content"><h3><a class="nav-link" href="http://imdb.com/title/' + data.imdbID + '/">' + data.Title + '</a> (' + data.Year + ')</h3><p>Rating: ' + data.imdbRating + '<br/>Genre: ' + data.Genre + '<br/>Starring: ' + data.Actors + '</p></div> <div id="view-photo-caption">' + data.Plot + '</div></div>'; 775 } 776 }), 777 new $.fn.oembed.OEmbedProvider("livejournal", "rich", ["livejournal.com/"], "http://ljpic.seacrow.com/json/$2$4?jsonp=?" 778 , { 779 templateRegex: /(http:\/\/(((?!users).)+)\.livejournal\.com|.*users\.livejournal\.com\/([^\/]+)).*/, 780 templateData: function (data) { 781 if (!data.username) 782 return false; 783 return '<div><img src="' + data.image + '" align="left" style="margin-right: 1em;" /><span class="oembedall-ljuser"><a href="http://' + data.username + '.livejournal.com/profile"><img src="http://www.livejournal.com/img/userinfo.gif" alt="[info]" width="17" height="17" /></a><a href="http://' + data.username + '.livejournal.com/">' + data.username + '</a></span><br />' + data.name + '</div>'; 784 } 785 }), 786 new $.fn.oembed.OEmbedProvider("circuitbee", "rich", ["circuitbee\\.com/circuit/view/.+"], "http://c.circuitbee.com/build/r/schematic-embed.html?id=$1", 787 { 788 templateRegex: /.*circuit\/view\/(\d+).*/, 789 embedtag: { 790 tag: 'iframe', 791 width: '500', 792 height: '350' 793 } 794 }), 795 796 new $.fn.oembed.OEmbedProvider("googlecalendar", "rich", ["www.google.com/calendar/embed?.+"], "$1", 797 {templateRegex: /(.*)/, embedtag: {tag: 'iframe', width: '800', height: '600' }}), 798 new $.fn.oembed.OEmbedProvider("jsfiddle", "rich", ["jsfiddle.net/[^/]+/?"], "http://jsfiddle.net/$1/embedded/result,js,resources,html,css/?", 799 {templateRegex: /.*net\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '100%', height: '300' }}), 800 new $.fn.oembed.OEmbedProvider("jsbin", "rich", ["jsbin.com/.+"], "http://jsbin.com/$1/?", 801 {templateRegex: /.*com\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '100%', height: '300' }}), 802 new $.fn.oembed.OEmbedProvider("jotform", "rich", ["form.jotform.co/form/.+"], "$1?", 803 {templateRegex: /(.*)/, embedtag: {tag: 'iframe', width: '100%', height: '507' }}), 804 new $.fn.oembed.OEmbedProvider("reelapp", "rich", ["reelapp\\.com/.+"], "http://www.reelapp.com/$1/embed", 805 {templateRegex: /.*com\/(\S{6}).*/, embedtag: {tag: 'iframe', width: '400', height: '338'}}), 806 new $.fn.oembed.OEmbedProvider("linkedin", "rich", ["linkedin.com/pub/.+"], "https://www.linkedin.com/cws/member/public_profile?public_profile_url=$1&format=inline&isFramed=true", 807 {templateRegex: /(.*)/, embedtag: {tag: 'iframe', width: '368px', height: 'auto'}}), 808 new $.fn.oembed.OEmbedProvider("timetoast", "rich", ["timetoast.com/timelines/[0-9]+"], "http://www.timetoast.com/flash/TimelineViewer.swf?passedTimelines=$1", 809 {templateRegex: /.*timelines\/([0-9]*)/, embedtag: { width: 550, height: 400}, nocache: 1}), 810 new $.fn.oembed.OEmbedProvider("pastebin", "rich", ["pastebin\\.com/[\\S]{8}"], "http://pastebin.com/embed_iframe.php?i=$1", 811 {templateRegex: /.*\/(\S{8}).*/, embedtag: {tag: 'iframe', width: '100%', height: 'auto'}}), 812 new $.fn.oembed.OEmbedProvider("mixlr", "rich", ["mixlr.com/.+"], "http://mixlr.com/embed/$1?autoplay=ae", 813 {templateRegex: /.*com\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '100%', height: 'auto' }}), 814 new $.fn.oembed.OEmbedProvider("pastie", "rich", ["pastie\\.org/pastes/.+"], null, {yql: {xpath: '//pre[@class="textmate-source"]'}}), 815 new $.fn.oembed.OEmbedProvider("github", "rich", ["gist.github.com/.+"], "https://github.com/api/oembed"), 816 new $.fn.oembed.OEmbedProvider("github", "rich", ["github.com/[-.\\w@]+/[-.\\w@]+"], "https://api.github.com/repos/$1/$2?callback=?" 817 , {templateRegex: /.*\/([^\/]+)\/([^\/]+).*/, 818 templateData: function (data) { 819 if (!data.data.html_url)return false; 820 return '<div class="oembedall-githubrepos"><ul class="oembedall-repo-stats"><li>' + data.data.language + '</li><li class="oembedall-watchers"><a title="Watchers" href="' + data.data.html_url + '/watchers">◉ ' + data.data.watchers + '</a></li>' 821 + '<li class="oembedall-forks"><a title="Forks" href="' + data.data.html_url + '/network">ɥ ' + data.data.forks + '</a></li></ul><h3><a href="' + data.data.html_url + '">' + data.data.name + '</a></h3><div class="oembedall-body"><p class="oembedall-description">' + data.data.description + '</p>' 822 + '<p class="oembedall-updated-at">Last updated: ' + data.data.pushed_at + '</p></div></div>'; 823 } 824 }), 825 new $.fn.oembed.OEmbedProvider("facebook", "rich", ["facebook.com"], null 826 , {templateRegex: /.*\/([^\/]+)\/([^\/]+).*/, 827 template: function (url) { 828 // adding script directly to DOM to make sure that it is loaded correctly. 829 if (!$.fn.oembed.facebokScriptHasBeenAdded) { 830 $('<div id="fb-root"></div>').appendTo('body'); 831 var script = document.createElement('script'); 832 script.type = 'text/javascript'; 833 script.text = '(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";fjs.parentNode.insertBefore(js, fjs);}(document, "script", "facebook-jssdk"));'; 834 document.body.appendChild(script); 835 $.fn.oembed.facebokScriptHasBeenAdded = true; 836 } 837 838 // returning template with url of facebook post. 839 return '<div class="fb-post" data-href="' + url + '" data-width="520"><div class="fb-xfbml-parse-ignore"><a href="' + url + '"></div></div>'; 840 841 } 842 }), 843 /* 844 // Saving old implementation of Facebook in case we will need it as example in the future. 845 new $.fn.oembed.OEmbedProvider("facebook", "rich", ["facebook.com/(people/[^\\/]+/\\d+|[^\\/]+$)"], "https://graph.facebook.com/$2$3/?callback=?" 846 ,{templateRegex:/.*facebook.com\/(people\/[^\/]+\/(\d+).*|([^\/]+$))/, 847 templateData : function(data){ if(!data.id)return false; 848 var out = '<div class="oembedall-facebook1"><div class="oembedall-facebook2"><a href="http://www.facebook.com/">facebook</a> '; 849 if(data.from) out += '<a href="http://www.facebook.com/'+
849data.from.id+'">'+data.from.name+'</a>'; 850 else if(data.link) out += '<a href="'+data.link+'">'+data.name+'</a>'; 851 else if(data.username) out += '<a href="http://www.facebook.com/'+data.username+'">'+data.name+'</a>'; 852 else out += '<a href="http://www.facebook.com/'+data.id+'">'+data.name+'</a>'; 853 out += '</div><div class="oembedall-facebookBody"><div class="contents">'; 854 if(data.picture) out += '<a href="'+data.link+'"><img src="'+data.picture+'"></a>'; 855 else out += '<img src="https://graph.facebook.com/'+data.id+'/picture">'; 856 if(data.from) out += '<a href="'+data.link+'">'+data.name+'</a>'; 857 if(data.founded) out += 'Founded: <strong>'+data.founded+'</strong><br>'; 858 if(data.category) out += 'Category: <strong>'+data.category+'</strong><br>'; 859 if(data.website) out += 'Website: <strong><a href="'+data.website+'">'+data.website+'</a></strong><br>'; 860 if(data.gender) out += 'Gender: <strong>'+data.gender+'</strong><br>'; 861 if(data.description) out += data.description + '<br>'; 862 out += '</div></div>'; 863 return out; 864 } 865 }), 866 */ 867 new $.fn.oembed.OEmbedProvider("stackoverflow", "rich", ["stackoverflow.com/questions/[\\d]+"], "http://api.stackoverflow.com/1.1/questions/$1?body=true&jsonp=?" 868 , {templateRegex: /.*questions\/([\d]+).*/, 869 templateData: function (data) { 870 if (!data.questions) 871 return false; 872 var q = data.questions[0]; 873 var body = $(q.body).text(); 874 var out = '<div class="oembedall-stoqembed"><div class="oembedall-statscontainer"><div class="oembedall-statsarrow"></div><div class="oembedall-stats"><div class="oembedall-vote"><div class="oembedall-votes">' 875 + '<span class="oembedall-vote-count-post"><strong>' + (q.up_vote_count - q.down_vote_count) + '</strong></span><div class="oembedall-viewcount">vote(s)</div></div>' 876 + '</div><div class="oembedall-status"><strong>' + q.answer_count + '</strong>answer</div></div><div class="oembedall-views">' + q.view_count + ' view(s)</div></div>' 877 + '<div class="oembedall-summary"><h3><a class="oembedall-question-hyperlink" href="http://stackoverflow.com/questions/' + q.question_id + '/">' + q.title + '</a></h3>' 878 + '<div class="oembedall-excerpt">' + body.substring(0, 100) + '...</div><div class="oembedall-tags">'; 879 for (i in q.tags) { 880 out += '<a title="" class="oembedall-post-tag" href="http://stackoverflow.com/questions/tagged/' + q.tags[i] + '">' + q.tags[i] + '</a>'; 881 } 882 883 out += '</div><div class="oembedall-fr"><div class="oembedall-user-info"><div class="oembedall-user-gravatar32"><a href="http://stackoverflow.com/users/' + q.owner.user_id + '/' + q.owner.display_name + '">' 884 + '<img width="32" height="32" alt="" src="http://www.gravatar.com/avatar/' + q.owner.email_hash + '?s=32&d=identicon&r=PG"></a></div><div class="oembedall-user-details">' 885 + '<a href="http://stackoverflow.com/users/' + q.owner.user_id + '/' + q.owner.display_name + '">' + q.owner.display_name + '</a><br><span title="reputation score" class="oembedall-reputation-score">' 886 + q.owner.reputation + '</span></div></div></div></div></div>'; 887 return out; 888 } 889 }), 890 new $.fn.oembed.OEmbedProvider("wordpress", "rich", ["wordpress\\.com/.+", "blogs\\.cnn\\.com/.+", "techcrunch\\.com/.+", "wp\\.me/.+"], "http://public-api.wordpress.com/oembed/1.0/?for=jquery-oembed-all"), 891 new $.fn.oembed.OEmbedProvider("screenr", "rich", ["screenr\.com"], "http://www.screenr.com/embed/$1", 892 {templateRegex: /.*\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '650', height: 396}}) , 893 new $.fn.oembed.OEmbedProvider("gigpans", "rich", ["gigapan\\.org/[-.\\w@]+/\\d+"], "http://gigapan.org/gigapans/$1/options/nosnapsh
893ots/iframe/flash.html", 894 {templateRegex: /.*\/(\d+)\/?.*/, embedtag: {tag: 'iframe', width: '100%', height: 400 }}), 895 new $.fn.oembed.OEmbedProvider("scribd", "rich", ["scribd\\.com/.+"], "http://www.scribd.com/embeds/$1/content?start_page=1&view_mode=list", 896 {templateRegex: /.*doc\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '100%', height: 600}}), 897 new $.fn.oembed.OEmbedProvider("kickstarter", "rich", ["kickstarter\\.com/projects/.+"], "$1/widget/card.html", 898 {templateRegex: /([^\?]+).*/, embedtag: {tag: 'iframe', width: '220', height: 380}}), 899 new $.fn.oembed.OEmbedProvider("amazon", "rich", ["amzn.com/B+", "amazon.com.*/(B\\S+)($|\\/.*)"], "http://rcm.amazon.com/e/cm?t=_APIKEY_&o=1&p=8&l=as1&asins=$1&ref=qf_br_asin_til&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr", 900 { 901 apikey: true, 902 templateRegex: /.*\/(B[0-9A-Z]+)($|\/.*)/, 903 embedtag: { 904 tag: 'iframe', 905 width: '120px', 906 height: '240px'} 907 }), 908 new $.fn.oembed.OEmbedProvider("slideshare", "rich", ["slideshare\.net"], "//www.slideshare.net/api/oembed/2", {format: 'jsonp'}), 909 new $.fn.oembed.OEmbedProvider("roomsharejp", "rich", ["roomshare\\.jp/(en/)?post/.*"], "http://roomshare.jp/oembed.json"), 910 new $.fn.oembed.OEmbedProvider("lanyard", "rich", ["lanyrd.com/\\d+/.+"], null, 911 { 912 yql: { 913 xpath: '(//div[@class="primary"])[1]', 914 from: 'htmlstring', 915 datareturn: function (results) { 916 if (!results.result) 917 return false; 918 return '<div class="oembedall-lanyard">' + results.result + '</div>'; 919 } 920 } 921 }), 922 new $.fn.oembed.OEmbedProvider("asciiartfarts", "rich", ["asciiartfarts.com/\\d+.html"], null, 923 { 924 yql: { 925 xpath: '//pre/font', 926 from: 'htmlstring', 927 datareturn: function (results) { 928 if (!results.result) 929 return false; 930 return '<pre style="background-color:#000;">' + results.result + '</div>'; 931 } 932 } 933 }), 934 new $.fn.oembed.OEmbedProvider("coveritlive", "rich", ["coveritlive.com/"], null, { 935 templateRegex: /(.*)/, 936 template: '<iframe src="$1" allowtransparency="true" scrolling="no" width="615px" frameborder="0" height="625px"></iframe>'}), 937 new $.fn.oembed.OEmbedProvider("polldaddy", "rich", ["polldaddy.com/"], null, { 938 templateRegex: /(?:https?:\/\/w?w?w?.?polldaddy.com\/poll\/)([0-9]*)\//, 939 template: '<script async type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/$1.js"></script>', 940 nocache: 1 941 }), 942 new $.fn.oembed.OEmbedProvider("360io", "rich", ["360\\.io/.+"], "http://360.io/$1", {templateRegex: /.*360\.io\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 943 new $.fn.oembed.OEmbedProvider("bubbli", "rich", ["on\\.bubb\\.li/.+"], "http://on.bubb.li/$1", {templateRegex: /.*on\.bubb\.li\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360}, nocache: 1 }), 944 new $.fn.oembed.OEmbedProvider("cloudup", "rich", ["cloudup\\.com/.+"], "http://cloudup.com/$1?chromeless", {templateRegex: [/.*cloudup\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }}), 945 new $.fn.oembed.OEmbedProvider("codepen", "rich", ["codepen.io/.+"], "http://codepen.io/$1/embed/$2", {templateRegex: [/.*io\/(\w+)\/pen\/(\w+).*/, /.*io\/(\w+)\/full\/(\w+).*/], embedtag: {tag: 'iframe', width: '100%', height: '300'}, nocache: 1 }), 946 new $.fn.oembed.OEmbedProvider("googleviews", "rich", ["(.*maps\\.google\\.com\\/maps\\?).+(output=svembed).+(cbp=(.*)).*"], "https://maps.google.com/maps?layer=c&panoid=$3&ie=UTF8&source=embed&output=svembed&cbp=$5", {templateRegex: /(.*maps\.google\.com\/maps\?).+(panoid=(\w+)&).*(cbp=(.*)).*/, embedtag: {tag: 'iframe', width: 480, height: 360}, nocache: 1 }), 947 new $.fn.oembed.OEmbedProvider("googlemaps", "rich", ["google\\.com\/maps\/place/.+"], "http://maps.google.com/maps?t=m&q=$1&output=embed", {templateRegex: /.*google\.com\/maps\/place\/([\w\+]*)\/.*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 948 new $.fn.oembed.OEmbedProvider("imajize", "rich", ["embed\\.imajize\\.com/.+"], "http://embed.imajize.com/$1", {templateRegex: /.*embed\.imajize\.com\/(.*)/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 949 new $.fn.oembed.OEmbedProvider("mapjam", "rich", ["mapjam\\.com/.+"], "http://www.mapjam.com/$1", {templateRegex: /.*mapjam\.com\/(.*)/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 950 new $.fn.oembed.OEmbedProvider("polar", "rich", ["polarb\\.com/.+"], "http://assets-polarb-com.a.ssl.fastly.net/api/v4/publishers/unknown/embedded_polls/iframe?poll_id=$1", {templateRegex: /.*polarb\.com\/polls\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 951 new $.fn.oembed.OEmbedProvider("ponga", "rich", ["ponga\\.com/.+"], "https://www.ponga.com/embedded?id=$1", {templateRegex: [/.*ponga\.com\/embedded\?id=(\w+).*/, /.*ponga\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}), 952 953 //Use Open Graph Where applicable 954 new $.fn.oembed.OEmbedProvider("opengraph", "rich", [".*"], null, 955 { 956 yql: { 957 xpath: "//meta|//title|//link", 958 from: 'html', 959 datareturn: function (results) { 960 if (!results['og:title'] && results['title'] && results['description']) 961 results['og:title'] = results['title']; 962 963 if (!results['og:title'] && !results['title']) 964 return false; 965 966 var code = $('<p/>'); 967 if (results['og:video']) { 968 var embed = $('<embed src="' + results['og:video'] + '"/>'); 969 embed.attr('type', results['og:video:type'] || "application/x-shockwave-flash") 970 .css('max-height', settings.maxHeight || 'auto') 971 .css('max-width', settings.maxWidth || 'auto'); 972 if (results['og:video:width']) 973 embed.attr('width', results['og:video:width']); 974 if (results['og:video:height']) 975 embed.attr('height', results['og:video:height']); 976 code.append(embed); 977 } else if (results['og:image']) { 978 var img = $('<img src="' + results['og:image'] + '">'); 979 img.css('max-height', settings.maxHeight || 'auto').css('max-width', settings.maxWidth || 'auto'); 980 if (results['og:image:width']) 981 img.attr('width', results['og:image:width']); 982 if (results['og:image:height']) 983 img.attr('height', results['og:image:height']); 984 code.append(img); 985 } 986 987 if (results['og:title']) 988 code.append('<b>' + results['og:title'] + '</b><br/>'); 989 990 if (results['og:description']) 991 code.append(results['og:description'] + '<br/>'); 992 else if (results['description']) 993 code.append(results['description'] + '<br/>'); 994 995 return code; 996 } 997 } 998 } 999 ) 1000 1001 ]; 1002})(jQuery);
1003//This is needed for gravatar :( 1004String.prototype.md5=function(){var a=function(a,b){var c=(a&65535)+(b&65535);var d=(a>>16)+(b>>16)+(c>>16);return d<<16|c&65535};var b=function(a,b){return a<<b|a>>>32-b};var c=function(c,d,e,f,g,h){return a(b(a(a(d,c),a(f,h)),g),e)};var d=function(a,b,d,e,f,g,h){return c(b&d|~b&e,a,b,f,g,h)};var e=function(a,b,d,e,f,g,h){return c(b&e|d&~e,a,b,f,g,h)};var f=function(a,b,d,e,f,g,h){return c(b^d^e,a,b,f,g,h)};var g=function(a,b,d,e,f,g,h){return c(d^(b|~e),a,b,f,g,h)};var h=function(b){var c,h,i,j,k,l=b.length;var m=1732584193;var n=-271733879;var o=-1732584194;var p=271733878;for(k=0;k<l;k+=16){c=m;h=n;i=o;j=p;m=d(m,n,o,p,b[k+0],7,-680876936);p=d(p,m,n,o,b[k+1],12,-389564586);o=d(o,p,m,n,b[k+2],17,606105819);n=d(n,o,p,m,b[k+3],22,-1044525330);m=d(m,n,o,p,b[k+4],7,-176418897);p=d(p,m,n,o,b[k+5],12,1200080426);o=d(o,p,m,n,b[k+6],17,-1473231341);n=d(n,o,p,m,b[k+7],22,-45705983);m=d(m,n,o,p,b[k+8],7,1770035416);p=d(p,m,n,o,b[k+9],12,-1958414417);o=d(o,p,m,n,b[k+10],17,-42063);n=d(n,o,p,m,b[k+11],22,-1990404162);m=d(m,n,o,p,b[k+12],7,1804603682);p=d(p,m,n,o,b[k+13],12,-40341101);o=d(o,p,m,n,b[k+14],17,-1502002290);n=d(n,o,p,m,b[k+15],22,1236535329);m=e(m,n,o,p,b[k+1],5,-165796510);p=e(p,m,n,o,b[k+6],9,-1069501632);o=e(o,p,m,n,b[k+11],14,643717713);n=e(n,o,p,m,b[k+0],20,-373897302);m=e(m,n,o,p,b[k+5],5,-701558691);p=e(p,m,n,o,b[k+10],9,38016083);o=e(o,p,m,n,b[k+15],14,-660478335);n=e(n,o,p,m,b[k+4],20,-405537848);m=e(m,n,o,p,b[k+9],5,568446438);p=e(p,m,n,o,b[k+14],9,-1019803690);o=e(o,p,m,n,b[k+3],14,-187363961);n=e(n,o,p,m,b[k+8],20,1163531501);m=e(m,n,o,p,b[k+13],5,-1444681467);p=e(p,m,n,o,b[k+2],9,-51403784);o=e(o,p,m,n,b[k+7],14,1735328473);n=e(n,o,p,m,b[k+12],20,-1926607734);m=f(m,n,o,p,b[k+5],4,-378558);p=f(p,m,n,o,b[k+8],11,-2022574463);o=f(o,p,m,n,b[k+11],16,1839030562);n=f(n,o,p,m,b[k+14],23,-35309556);m=f(m,n,o,p,b[k+1],4,-1530992060);p=f(p,m,n,o,b[k+4],11,1272893353);o=f(o,p,m,n,b[k+7],16,-155497632);n=f(n,o,p,m,b[k+10],23,-1094730640);m=f(m,n,o,p,b[k+13],4,681279174);p=f(p,m,n,o,b[k+0],11,-358537222);o=f(o,p,m,n,b[k+3],16,-722521979);n=f(n,o,p,m,b[k+6],23,76029189);m=f(m,n,o,p,b[k+9],4,-640364487);p=f(p,m,n,o,b[k+12],11,-421815835);o=f(o,p,m,n,b[k+15],16,530742520);n=f(n,o,p,m,b[k+2],23,-995338651);m=g(m,n,o,p,b[k+0],6,-198630844);p=g(p,m,n,o,b[k+7],10,1126891415);o=g(o,p,m,n,b[k+14],15,-1416354905);n=g(n,o,p,m,b[k+5],21,-57434055);m=g(m,n,o,p,b[k+12],6,1700485571);p=g(p,m,n,o,b[k+3],10,-1894986606);o=g(o,p,m,n,b[k+10],15,-1051523);n=g(n,o,p,m,b[k+1],21,-2054922799);m=g(m,n,o,p,b[k+8],6,1873313359);p=g(p,m,n,o,b[k+15],10,-30611744);o=g(o,p,m,n,b[k+6],15,-1560198380);n=g(n,o,p,m,b[k+13],21,1309151649);m=g(m,n,o,p,b[k+4],6,-145523070);p=g(p,m,n,o,b[k+11],10,-1120210379);o=g(o,p,m,n,b[k+2],15,718787259);n=g(n,o,p,m,b[k+9],21,-343485551);m=a(m,c);n=a(n,h);o=a(o,i);p=a(p,j)}return[m,n,o,p]};var i=function(a){var b="0123456789abcdef",c="",d,e=a.length*4;for(d=0;d<e;d++){c+=b.charAt(a[d>>2]>>d%4*8+4&15)+b.charAt(a[d>>2]>>d%4*8&15)}return c};var j=function(a){var b=(a.length+8>>6)+1;var c=[],d,e=b*16,f,g=a.length;for(d=0;d<e;d++){c.push(0)}for(f=0;f<g;f++){c[f>>2]|=(a.charCodeAt(f)&255)<<f%4*8}c[f>>2]|=128<<f%4*8;c[b*16-2]=g*8;return c};return i(h(j(this)))};
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.