1 Components.utils.import(
"resource://gre/modules/XPCOMUtils.jsm");
2 Components.utils.import(
"resource://app/jsmodules/sbLibraryUtils.jsm");
3 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
5 const Cc = Components.classes;
6 const Ci = Components.interfaces;
7 const Cr = Components.results;
9 const DESCRIPTION =
"mashTape Provider: SmugMug Provider";
10 const CID =
"{68551fc0-6a50-11dd-ad8b-0800200c9a66}";
11 const CONTRACTID =
"@songbirdnest.com/mashTape/provider/photo/SmugMug;1";
15 this.wrappedJSObject =
this;
16 Components.utils.import(
"resource://mashtape/mtUtils.jsm");
25 Ci.sbIMashTapeProvider]),
27 providerName:
"SmugMug",
28 providerType:
"photo",
29 providerIcon:
"chrome://mashTape/content/tabs/smugmug.png",
31 query:
function(searchTerms, updateFn) {
32 var req =
Cc[
"@mozilla.org/xmlextras/xmlhttprequest;1"]
33 .createInstance(
Ci.nsIXMLHttpRequest);
35 var prefBranch =
Cc[
"@mozilla.org/preferences-service;1"]
36 .getService(
Ci.nsIPrefService).getBranch(
"extensions.mashTape.");
37 var keywords = prefBranch.getCharPref(
"photo.keywords");
39 searchTerms +=
"%20" + escape(keywords);
41 var
url =
"http://www.smugmug.com/hack/feed.mg?Type=keyword&format=rss&ImageCount=100&Data=" + escape(searchTerms);
42 req.open(
"GET", url,
true);
44 req.updateFn = updateFn;
45 req.onreadystatechange =
function() {
46 if (this.readyState != 4)
48 if (this.status == 200) {
49 var results =
new Array();
50 var x =
new XML(this.responseText.replace(
51 '<?xml version="1.0" encoding="utf-8"?>',
""));
52 var mediaNs =
new Namespace(
"http://search.yahoo.com/mrss/");
54 for each (var
entry in x..item) {
55 if (entry..mediaNs::content.length() < 4)
57 var small = entry..mediaNs::content[1].@
url;
58 var med = entry..mediaNs::content[2].@
url;
59 var large = entry..mediaNs::content[3].@
url;
60 var escapedTitle = entry.title.split(/[\n\r]/).join(
" ")
62 dump("title: " + escapedTitle + ":\n");
69 owner: entry.mediaNs::copyright.toString(),
70 ownerUrl: entry.mediaNs::copyright.@url.toString(),
71 time: Date.parse(entry.pubDate.toString()),
72 width: entry..mediaNs::content[2].@width,
73 height: entry..mediaNs::content[2].@height,
78 results.wrappedJSObject = results;
79 this.updateFn.wrappedJSObject.update(CONTRACTID, results);
86 var components = [SmugMug];
87 function NSGetModule(compMgr, fileSpec) {
88 return XPCOMUtils.generateModule([SmugMug]);
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
sbDeviceFirmwareAutoCheckForUpdate prototype classID