iframe-photo.js
Go to the documentation of this file.
1 Components.utils.import("resource://mashTape/mtUtils.jsm");
2 
3 var nS5;
4 
5 document.addEvent('mousewheel', function(event) {
6  event = new Event(event);
7 
8  if (typeof(nS5) == "undefined")
9  return;
10  /* Mousewheel UP */
11  if (event.wheel > 0) {
12  nS5.previous();
13  }
14  /* Mousewheel DOWN*/
15  else if (event.wheel < 0) {
16  nS5.next();
17  }
18 });
19 
20 function _mashTape_setupPhotoStream(imageItems, paneWidth, paneHeight) {
21  var info = $('info').set('opacity', 0.5);
22 
23  imageItems[0].offset = 0;
24  $('box').getElements('img').each(function(img, idx) {
25  //dump("image[" + idx + "].width = " + img.width + " - " +
26  // img.src + "\n");
27  imageItems[idx].index = idx;
28  imageItems[idx].imgEl = img;
29  });
30 
31  var speed =
32  Application.prefs.getValue("extensions.mashTape.photo.speed", 50);
33  speed = speed * 40;
34 
35  nS5 = new noobSlide({
36  box: $('box'),
37  size: paneWidth,
38  interval: speed,
39  items: imageItems,
40  autoPlay: true,
41  addButtons: {
42  previous: $('prev'),
43  next: $('next'),
44  playpause: $('playpause')
45  },
46  onButtons: function(command, isPlaying) {
47  //dump("> " + command + "|" + isPlaying + "\n");
48  if (isPlaying) {
49  // Switch the icon to 'pause'
50  $('icon-playpause').src = "chrome://mashtape/skin/pause.png";
51  } else {
52  // Switch the icon to 'play'
53  $('icon-playpause').src = "chrome://mashtape/skin/play.png";
54  }
55  },
56  onWalk: function(currentItem) {
57  info.empty();
58  /*
59  dump("> Advanced to " + currentItem.index +
60  " - width: " + currentItem.imgEl.width +
61  " - offset: " + currentItem.offset +
62  "\n");
63  */
64  new Element('h4').set('html',
65  '<a href="' +
66  currentItem.link +'">' + currentItem.title + '</a>')
67  .inject(info);
68  var date = new Date(parseInt(currentItem.date));
69  new Element('p').set('html',
70  window.parent.mashTape.strings
71  .GetStringFromName("extensions.mashTape.msg.by") +
72  ' <b><a href="' + currentItem.authorUrl + '">' +
73  currentItem.author + '</a></b> (' + "<span title='" +
74  date.toLocaleString() + "'>" + date.ago() +
75  "</span>" + ")").inject(info);
76  }
77  });
78 }
79 
87  if (!nS5) return;
88 
89  var speed =
90  Application.prefs.getValue("extensions.mashTape.photo.speed", 50);
91  speed = speed * 40;
92 
93  nS5.interval = speed;
94  if (nS5.isPlaying) {
95  nS5.playpause(nS5.interval, 'next');
96  nS5.playpause(nS5.interval, 'next');
97  }
98 }
99 
100 function mashTape_triggerPhotoStream(imageItems, paneWidth) {
101  setTimeout(_mashTape_setupPhotoStream, 500, imageItems, paneWidth);
102 }
103 
function mashTape_updatePhotoStreamSpeed()
Definition: iframe-photo.js:86
_setDateDatepicker date
var Application
Definition: sbAboutDRM.js:37
var nS5
Definition: iframe-photo.js:3
function _mashTape_setupPhotoStream(imageItems, paneWidth, paneHeight)
Definition: iframe-photo.js:20
var event
var Element
var Event
let window
aWindow setTimeout(function(){_this.restoreHistory(aWindow, aTabs, aTabData, aIdMap);}, 0)
function mashTape_triggerPhotoStream(imageItems, paneWidth)
var noobSlide
function next()