Пример #1
0
exports.testGetPreferedLocales = function(assert) {
  let currentLocales = Services.locale.getRequestedLocales();

  Services.locale.setRequestedLocales(['pl']);

  assert.equal(getPreferedLocales().includes('en-US'), true, "en-US should always be in the list");

  Services.locale.setRequestedLocales(currentLocales);
};
    search: async(function*(query) {
         let response = yield this._qs.queueRequest(baseURL+"search?"+querystring.stringify(
             {
                 "part": "id",
                 "fields": "items(id/videoId)",
                 "eventType": "live",
                 "type": "video",
                 "order": "relevance",
                 "relevanceLanguage": getPreferedLocales(true)[0].substr(0,2),
                 "safeSearch": this._mature ? "moderate" : "strict",
                 "q": query,
                 "key": apiKey
             }
         ), headers);

         let streamIds = [];
         if(response.json && response.json.items && response.json.items.length)
              streamIds = response.json.items.map((entry) => entry.id.videoId);
         else
            throw "No search results found for " + this.name + " with " + query;

         let videos = yield this._qs.queueRequest(baseURL+"videos?"+querystring.stringify(
             {
                 "part": "id, snippet, liveStreamingDetails",
                 "id": streamIds.join(","),
                 "fields": "items(id,snippet(channelId,title,thumbnails/medium/url,categoryId),liveStreamingDetails/concurrentViewers)",
                 "key": apiKey,
                 "hl": getLocale()
             }
         ), headers);

         if(videos.json && videos.json.items) {
             return yield Promise.all(videos.json.items.map(async(function*(video) {
                 var channel = yield this._getChannelById(video.snippet.channelId);
                 channel.live.setLive(true);
                 channel.url = [
                     "https://youtube.com/watch?v="+video.id,
                     "https://gaming.youtube.com/watch?v="+video.id
                 ];
                 channel.title = video.snippet.title;
                 channel.thumbnail = video.snippet.thumbnails.medium.url;
                 if("liveStreamingDetails" in video)
                    channel.viewers = video.liveStreamingDetails.concurrentViewers;
                 channel.category = yield this._getCategory(video.snippet.categoryId);

                 return channel;
             }).bind(this)));
         }

         throw "None of the searchresults exist for " + this.name;
     })
Пример #3
0
panel.on('show', () => {
    let preferedLocales = locale.getPreferedLocales(true).shift();

    panel.port.emit('onLocaleResponse', preferedLocales.split('-').shift());
});
var getLocale = function() {
    return getPreferedLocales(true)[0].replace("-","_");
};
Пример #5
0
	return windowMediator.getMostRecentWindow(null);
}
window = {};
window.setTimeout=timers.setTimeout;
setTimeout=window.setTimeout;
//document = {
//	createElement: function(nam){
//		return topLevelWindow().document.createElementNS('http://www.w3.org/1999/xhtml', 'html:'+nam);
//	}
//}
LOCALE = 'en';
COMN_DBUG=false;
BLOOP_MAX=75;
DESC_INCL='main.js ';

loc=locale.getPreferedLocales();
for(var i=0,l=loc.length;i<l;i++){
	if(loc[i].indexOf('-')==2 || loc[i].length==2){
		LOCALE=loc[i].substr(0,2);
		break;
	}
}

var contentWinOffsetX=0,contentWinOffsetY=0;
var capture = function() {
	//	var windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"]
	//      .getService(Ci.nsIWindowMediator);
	//	
	//	var win=windowMediator.getMostRecentWindow(null);

	try{