diff options
| author | Stephen Blott | 2014-11-24 05:50:08 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2014-11-24 05:50:08 +0000 | 
| commit | 5bde38eda9e855a7ef673f3e57d07826d4d00ffe (patch) | |
| tree | 55dd8d96e3928f1d31e6884e30eb6ceb916442aa | |
| parent | 5c5fb4c3a9c365e3b2de02d1a2a55d056abb320b (diff) | |
| download | vimium-5bde38eda9e855a7ef673f3e57d07826d4d00ffe.tar.bz2 | |
Frames; eliminate Array::rotate.
Array::rotate extends the array object, polluting its name space; so,
instead, we just rotate the array manually.
| -rw-r--r-- | background_scripts/main.coffee | 5 | ||||
| -rw-r--r-- | lib/utils.coffee | 7 | 
2 files changed, 3 insertions, 9 deletions
| diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 10e6121f..48b54492 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -286,8 +286,9 @@ BackgroundCommands =      chrome.tabs.getSelected(null, (tab) ->        # We can't always track which frame chrome has focussed, but here we learn that it's frameId; so add an        # additional offset such that we do indeed start from frameId. -      offset = Math.max 0, frameIdsForTab[tab.id].indexOf frameId -      frames = frameIdsForTab[tab.id] = frameIdsForTab[tab.id].rotate(count+offset) +      count += Math.max 0, frameIdsForTab[tab.id].indexOf frameId +      frames = frameIdsForTab[tab.id] +      frames = frameIdsForTab[tab.id] = [frames[count..]..., frames[0...count]...]        chrome.tabs.sendMessage(tab.id, { name: "focusFrame", frameId: frames[0], highlight: true }))    closeTabsOnLeft: -> removeTabsRelative "before" diff --git a/lib/utils.coffee b/lib/utils.coffee index c8a02328..b7f8731a 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -145,13 +145,6 @@ Function::curry = ->  Array.copy = (array) -> Array.prototype.slice.call(array, 0) -Array::rotate = (count) -> -  if @length -    count = count % @length -    count += @length while count < 0 -    Array::push.apply(this, @splice(0, count)) -  this -  String::startsWith = (str) -> @indexOf(str) == 0  globalRoot = window ? global | 
