home *** CD-ROM | disk | FTP | other *** search
/ Clickx 47 / Clickx 47.iso / assets / software / Miro_Installer.exe / xulrunner / python / compiled_templates / tablist.py < prev    next >
Encoding:
Python Source  |  2008-01-10  |  28.4 KB  |  348 lines

  1. # This is a generated file. Do not edit.
  2. from template import Handle, fillAttr, quoteAndFillAttr, fillStaticTemplate
  3. from StringIO import StringIO
  4. from xhtmltools import urlencode
  5. from templatehelper import quoteattr, escape
  6. from string import Template
  7. import app
  8. import views
  9. import sorts
  10. import indexes
  11. import filters
  12. import resources
  13. import gtcache
  14. _ = gtcache.gettext
  15. def fillTemplate(domHandler, dtvPlatform, eventCookie, bodyTagExtra, *args, **kargs):
  16.     # Start of handle
  17.  
  18.     # Start user code
  19.     
  20.     guideTabs = views.guideTabs
  21.     staticTabs = views.staticTabs
  22.     feedTabs = kargs['channelTabOrder'].getView()
  23.     playlistTabs = kargs['playlistTabOrder'].getView()
  24.     
  25.         
  26.     # End user code
  27.  
  28.     localvars = locals()
  29.     localvars.update(globals())
  30.     handle = Handle(domHandler, localvars, onUnlink = lambda:None)
  31.  
  32.     def rep_0_handle(this, viewName, view, tid):
  33.         out = StringIO()
  34.         out.write(u'<li onmousedown="return handleContextMenuSelect(event);" selectArea="tablist" onclick="return handleSelect(event);" selectViewName="guideTabs" selectID="')
  35.         out.write(quoteattr(this.objID()))
  36.         out.write(u'" class="')
  37.         out.write(quoteattr(this.getState()))
  38.         out.write(u'" id="')
  39.         out.write(quoteattr(tid))
  40.         out.write(u'">\n\t      ')
  41.         out.write(u'\n<a class="feeditem">\n    <img src="')
  42.         out.write(quoteattr(this.obj.getIconURL()))
  43.         out.write(u'" alt="" class="icon"></img>\n    <div class="name">')
  44.         out.write(escape(this.obj.getTitle()))
  45.         out.write(u'</div>\n</a>\n')
  46.         out.write(u'\n\t</li>')
  47.         out.seek(0)
  48.         return out
  49.     handle.addView('tmplcomp58679699','nextSibling',guideTabs,rep_0_handle, u'guideTabs')
  50.     def rep_1_handle(this, viewName, view, tid):
  51.         out = StringIO()
  52.         out.write(u'<li selectID="')
  53.         out.write(quoteattr(this.objID()))
  54.         out.write(u'" selectArea="tablist" onclick="return handleSelect(event);" selectViewName="staticTabs" class="')
  55.         out.write(quoteattr(this.getState()))
  56.         out.write(u'" id="')
  57.         out.write(quoteattr(tid))
  58.         out.write(u'">\n\t    ')
  59.         out.write(u'\n<a class="feeditem noselect">\n    <img src="')
  60.         out.write(quoteattr(this.obj.getIconURL()))
  61.         out.write(u'" alt="" class="icon"></img>\n    ')
  62.         if not (this.obj.getNumber() == 0):
  63.             out.write(u'<div class="left-bubble ')
  64.             out.write(quoteattr(urlencode(this.obj.getNumberColor())))
  65.             out.write(u'">\n        <div class="right-bubble ')
  66.             out.write(quoteattr(urlencode(this.obj.getNumberColor())))
  67.             out.write(u'">\n            <div class="number-count ')
  68.             out.write(quoteattr(urlencode(this.obj.getNumberColor())))
  69.             out.write(u'">')
  70.             out.write(escape(this.obj.getNumber()))
  71.             out.write(u'</div>\n        </div>\n        ')
  72.             if not (not (this.obj.enableNewVideoPlayButton())):
  73.                 out.write(u'<div href="#" class="new-video-play-button" onclick="return playNewVideos(event, ')
  74.                 out.write(quoteattr(this.objID()))
  75.                 out.write(u');">\n            <img src="')
  76.                 out.write(quoteattr(resources.url(u'images/play.png')))
  77.                 out.write(u'"></img>\n        </div>')
  78.             out.write(u'\n    </div>')
  79.         out.write(u'\n    <div class="name">')
  80.         out.write(escape(this.obj.getTitle()))
  81.         out.write(u'</div>\n</a>\n\n')
  82.         out.write(u'\n\t</li>')
  83.         out.seek(0)
  84.         return out
  85.     handle.addView('tmplcomp46656577','nextSibling',staticTabs,rep_1_handle, u'staticTabs')
  86.     def rep_2_handle(this, viewName, view, tid):
  87.         out = StringIO()
  88.         out.write(u'<li onmousedown="return handleContextMenuSelect(event);" selectArea="tablist" onclick="return handleSelect(event)" selectViewName="feedTabs" selectID="')
  89.         out.write(quoteattr(this.objID()))
  90.         out.write(u'" class="')
  91.         out.write(quoteattr(this.getState()))
  92.         out.write(u'" id="')
  93.         out.write(quoteattr(tid))
  94.         out.write(u'">\n        <div id="')
  95.         out.write(quoteattr(this.getFragment()))
  96.         out.write(u'">\n\t  ')
  97.         if not (not (this.isFeed())):
  98.             out.write(u'<div>\n\t      ')
  99.             out.write(u'\n\n<div dragdestdata="channel-')
  100.             out.write(quoteattr(this.objID()))
  101.             out.write(u'" dragdesttype="')
  102.             out.write(quoteattr(this.obj.getDragDestType()))
  103.             out.write(u'" drageffectchannel="move" class="tab-drop-target ')
  104.             out.write(quoteattr(this.obj.getFolder() and 'child' or ''))
  105.             out.write(u'" drageffectchannelfolder="move">\n<div class="dnd-reorder-indicator circle"></div>\n<div class="dnd-reorder-indicator line"></div>\n<a dragsourcetype="')
  106.             out.write(quoteattr(this.getDragSourceType()))
  107.             out.write(u'" dragicon="channel-tnail-')
  108.             out.write(quoteattr(this.objID()))
  109.             out.write(u'" class="feeditem draggable noselect ')
  110.             out.write(quoteattr(this.obj.isBlinking() and 'blinking' or ''))
  111.             out.write(u'" dragsourcedata="tablist-')
  112.             out.write(quoteattr(this.objID()))
  113.             out.write(u'">\n')
  114.             if not (not (this.obj.showA())):
  115.                 out.write(u'<div class="left-bubble blue ')
  116.                 out.write(quoteattr(this.obj.showU() and 'second' or ''))
  117.                 out.write(u'">\n <div class="right-bubble blue">\n  <div class="number-count blue">')
  118.                 out.write(escape(this.obj.numAvailable()))
  119.                 out.write(u'</div>\n </div>\n</div>')
  120.             out.write(u'\n')
  121.             if not (not (this.obj.showU())):
  122.                 out.write(u'<div class="left-bubble green">\n <div class="right-bubble green">\n  <div class="number-count green">')
  123.                 out.write(escape(this.obj.numUnwatched()))
  124.                 out.write(u'</div>\n </div>\n <div href="#" class="new-video-play-button" onclick="return playNewVideos(event, ')
  125.                 out.write(quoteattr(this.objID()))
  126.                 out.write(u');">\n     <img src="')
  127.                 out.write(quoteattr(resources.url(u'images/play.png')))
  128.                 out.write(u'"></img>\n </div>\n</div>')
  129.             out.write(u'\n')
  130.             if not (not (this.obj.isUpdating())):
  131.                 out.write(u'<div class="feed-loading-icon"></div>')
  132.             out.write(u'\n\n<img src="')
  133.             out.write(quoteattr(this.obj.getTablistThumbnail()))
  134.             out.write(u'" id="channel-tnail-')
  135.             out.write(quoteattr(this.objID()))
  136.             out.write(u'" class="icon"></img><div class="name noselect">')
  137.             out.write(escape(this.obj.getTitle()))
  138.             out.write(u'</div>\n</a>\n</div>\n\n')
  139.             out.write(u'\n\t    </div>')
  140.         out.write(u'\n\t  ')
  141.         if not (not (this.isChannelFolder())):
  142.             out.write(u'<div>\n\t      ')
  143.             out.write(u'\n\n<div dragdestdata="channelfolder-')
  144.             out.write(quoteattr(this.objID()))
  145.             out.write(u'" dragdesttype="channelfolder" class="tab-drop-target" drageffectchannelfolder="move">\n<div class="dnd-reorder-indicator circle"></div>\n<div class="dnd-reorder-indicator line"></div>\n<div dragdestdata="channelfolder-')
  146.             out.write(quoteattr(this.objID()))
  147.             out.write(u'" dragdesttype="channel" drageffectchannel="move" class="tab-container-drop-target">\n<div class="dnd-container-drop-indicator left"></div>\n<div class="dnd-container-drop-indicator mid"></div>\n<div class="dnd-container-drop-indicator right"></div>\n<a dragsourcetype="channelfolder" dragicon="channel-tnail-')
  148.             out.write(quoteattr(this.objID()))
  149.             out.write(u'" class="feeditem noselect draggable folder" dragsourcedata="tablist-')
  150.             out.write(quoteattr(this.objID()))
  151.             out.write(u'">\n')
  152.             if not (this.obj.getExpanded()):
  153.                 out.write(u'<img src="')
  154.                 out.write(quoteattr(resources.url(u'images/tab-arrow-up.png')))
  155.                 out.write(u'" alt="expanded" onmousedown="return eventURL(\'action:toggleExpand?id=\' + ')
  156.                 out.write(quoteattr(this.objID()))
  157.                 out.write(u');" class="expanded-triangle"></img>')
  158.             out.write(u'\n')
  159.             if not (not (this.obj.getExpanded())):
  160.                 out.write(u'<img src="')
  161.                 out.write(quoteattr(resources.url(u'images/tab-arrow-down.png')))
  162.                 out.write(u'" alt="unexpanded" class="expanded-triangle" onmousedown="return eventURL(\'action:toggleExpand?id=\' + ')
  163.                 out.write(quoteattr(this.objID()))
  164.                 out.write(u');"></img>')
  165.             out.write(u'\n')
  166.             if not (not (this.obj.showA())):
  167.                 out.write(u'<div class="left-bubble blue ')
  168.                 out.write(quoteattr(this.obj.showU() and 'second' or ''))
  169.                 out.write(u'">\n <div class="right-bubble blue">\n  <div class="number-count blue">')
  170.                 out.write(escape(this.obj.numAvailable()))
  171.                 out.write(u'</div>\n </div>\n</div>')
  172.             out.write(u'\n')
  173.             if not (not (this.obj.showU())):
  174.                 out.write(u'<div class="left-bubble green">\n <div class="right-bubble green">\n  <div class="number-count green">')
  175.                 out.write(escape(this.obj.numUnwatched()))
  176.                 out.write(u'</div>\n </div>\n <div href="#" class="new-video-play-button" onclick="return playNewVideos(event, ')
  177.                 out.write(quoteattr(this.objID()))
  178.                 out.write(u');">\n     <img src="')
  179.                 out.write(quoteattr(resources.url(u'images/play.png')))
  180.                 out.write(u'"></img>\n </div>\n</div>')
  181.             out.write(u'\n<img src="')
  182.             out.write(quoteattr(resources.url(u'images/folder-icon-tablist.png')))
  183.             out.write(u'" id="channel-tnail-')
  184.             out.write(quoteattr(this.objID()))
  185.             out.write(u'" class="icon"></img><div class="name">')
  186.             out.write(escape(this.obj.getTitle()))
  187.             out.write(u'</div>\n</a>\n</div>\n</div>\n')
  188.             out.write(u'\n\t  </div>')
  189.         out.write(u'\n        </div>\n      </li>')
  190.         out.seek(0)
  191.         return out
  192.     handle.addView('tmplcomp14890511','nextSibling',feedTabs,rep_2_handle, u'feedTabs')
  193.     def rep_3_handle(this, viewName, view, tid):
  194.         out = StringIO()
  195.         out.write(u'<li onmousedown="return handleContextMenuSelect(event);" selectArea="tablist" onclick="return handleSelect(event);" selectViewName="playlistTabs" selectID="')
  196.         out.write(quoteattr(this.objID()))
  197.         out.write(u'" class="')
  198.         out.write(quoteattr(this.getState()))
  199.         out.write(u'" id="')
  200.         out.write(quoteattr(tid))
  201.         out.write(u'">\n        <div id="')
  202.         out.write(quoteattr(this.getFragment()))
  203.         out.write(u'">\n\t  ')
  204.         if not (not (this.isPlaylist())):
  205.             out.write(u'<div>\n\t      ')
  206.             out.write(u'\n\n<div dragdestdata="playlist-')
  207.             out.write(quoteattr(this.objID()))
  208.             out.write(u'" drageffectplaylist="move" dragdesttype="')
  209.             out.write(quoteattr(this.obj.getDragDestType()))
  210.             out.write(u'" drageffectplaylistfolder="move" class="tab-drop-target ')
  211.             out.write(quoteattr(this.obj.getFolder() and 'child' or ''))
  212.             out.write(u'">\n<div class="dnd-reorder-indicator circle"></div>\n<div class="dnd-reorder-indicator line"></div>\n<div dragdestdata="playlist-')
  213.             out.write(quoteattr(this.objID()))
  214.             out.write(u'" dragdesttype="downloadeditem" drageffectdownloadeditem="copy" class="tab-container-drop-target">\n<div class="dnd-container-drop-indicator left"></div>\n<div class="dnd-container-drop-indicator mid"></div>\n<div class="dnd-container-drop-indicator right"></div>\n<a dragsourcetype="')
  215.             out.write(quoteattr(this.getDragSourceType()))
  216.             out.write(u'" dragicon="playlist-tnail-')
  217.             out.write(quoteattr(this.objID()))
  218.             out.write(u'" class="feeditem draggable noselect" dragsourcedata="tablist-')
  219.             out.write(quoteattr(this.objID()))
  220.             out.write(u'">\n<img src="')
  221.             out.write(quoteattr(resources.url(u'images/playlist-icon-tablist.png')))
  222.             out.write(u'" id="playlist-tnail-')
  223.             out.write(quoteattr(this.objID()))
  224.             out.write(u'" class="icon"></img><div class="name">')
  225.             out.write(escape(this.obj.getTitle()))
  226.             out.write(u'</div>\n</a>\n</div>\n</div>\n')
  227.             out.write(u'\n\t  </div>')
  228.         out.write(u'\n\t  ')
  229.         if not (not (this.isPlaylistFolder())):
  230.             out.write(u'<div>\n              ')
  231.             out.write(u'\n\n<div dragdestdata="playlistfolder-')
  232.             out.write(quoteattr(this.objID()))
  233.             out.write(u'" dragdesttype="playlistfolder" drageffectplaylistfolder="move" class="tab-drop-target">\n<div class="dnd-reorder-indicator circle"></div>\n<div class="dnd-reorder-indicator line"></div>\n<div dragdestdata="playlistfolder-')
  234.             out.write(quoteattr(this.objID()))
  235.             out.write(u'" drageffectplaylist="move" dragdesttype="playlist" class="tab-container-drop-target">\n<div class="dnd-container-drop-indicator left"></div>\n<div class="dnd-container-drop-indicator mid"></div>\n<div class="dnd-container-drop-indicator right"></div>\n<a dragsourcetype="playlistfolder" dragicon="playlist-tnail-')
  236.             out.write(quoteattr(this.objID()))
  237.             out.write(u'" class="feeditem noselect draggable folder" dragsourcedata="tablist-')
  238.             out.write(quoteattr(this.objID()))
  239.             out.write(u'">\n')
  240.             if not (this.obj.getExpanded()):
  241.                 out.write(u'<img src="')
  242.                 out.write(quoteattr(resources.url(u'images/tab-arrow-up.png')))
  243.                 out.write(u'" alt="expanded" onmousedown="return eventURL(\'action:toggleExpand?id=\' + ')
  244.                 out.write(quoteattr(this.objID()))
  245.                 out.write(u');" class="expanded-triangle"></img>')
  246.             out.write(u'\n')
  247.             if not (not (this.obj.getExpanded())):
  248.                 out.write(u'<img src="')
  249.                 out.write(quoteattr(resources.url(u'images/tab-arrow-down.png')))
  250.                 out.write(u'" alt="unexpanded" class="expanded-triangle" onmousedown="return eventURL(\'action:toggleExpand?id=\' + ')
  251.                 out.write(quoteattr(this.objID()))
  252.                 out.write(u');"></img>')
  253.             out.write(u'\n<img src="')
  254.             out.write(quoteattr(resources.url(u'images/folder-icon-tablist.png')))
  255.             out.write(u'" id="playlist-tnail-')
  256.             out.write(quoteattr(this.objID()))
  257.             out.write(u'" class="icon"></img><div class="name">')
  258.             out.write(escape(this.obj.getTitle()))
  259.             out.write(u'</div>\n</a>\n</div>\n</div>\n')
  260.             out.write(u'\n\t  </div>')
  261.         out.write(u'\n        </div>\n      </li>')
  262.         out.seek(0)
  263.         return out
  264.     handle.addView('tmplcomp34485995','nextSibling',playlistTabs,rep_3_handle, u'playlistTabs')
  265.     # Start of handle
  266.  
  267.     # Start user code
  268.     # End user code
  269.  
  270.     localvars = locals()
  271.     localvars.update(globals())
  272.     handle_0 = Handle(domHandler, localvars, onUnlink = lambda:None)
  273.  
  274.     handle.addSubHandle(handle_0)
  275.     # Start of handle
  276.  
  277.     # Start user code
  278.     # End user code
  279.  
  280.     localvars = locals()
  281.     localvars.update(globals())
  282.     handle_1 = Handle(domHandler, localvars, onUnlink = lambda:None)
  283.  
  284.     handle.addSubHandle(handle_1)
  285.     # Start of handle
  286.  
  287.     # Start user code
  288.     # End user code
  289.  
  290.     localvars = locals()
  291.     localvars.update(globals())
  292.     handle_2 = Handle(domHandler, localvars, onUnlink = lambda:None)
  293.  
  294.     handle.addSubHandle(handle_2)
  295.     # Start of handle
  296.  
  297.     # Start user code
  298.     # End user code
  299.  
  300.     localvars = locals()
  301.     localvars.update(globals())
  302.     handle_3 = Handle(domHandler, localvars, onUnlink = lambda:None)
  303.  
  304.     handle.addSubHandle(handle_3)
  305.     # Start of handle
  306.  
  307.     # Start user code
  308.     # End user code
  309.  
  310.     localvars = locals()
  311.     localvars.update(globals())
  312.     handle_4 = Handle(domHandler, localvars, onUnlink = lambda:None)
  313.  
  314.     handle.addSubHandle(handle_4)
  315.     # Start of handle
  316.  
  317.     # Start user code
  318.     # End user code
  319.  
  320.     localvars = locals()
  321.     localvars.update(globals())
  322.     handle_5 = Handle(domHandler, localvars, onUnlink = lambda:None)
  323.  
  324.     handle.addSubHandle(handle_5)
  325.  
  326.  
  327.     out = StringIO()
  328.     out.write(u"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n")
  329.     out.write(u'<html dtvPlatform="')
  330.     out.write(quoteattr(urlencode(dtvPlatform)))
  331.     out.write(u'" eventCookie="')
  332.     out.write(quoteattr(urlencode(eventCookie)))
  333.     out.write(u'" xmlns:t="http://www.participatorypolitics.org/" xmlns="http://www.w3.org/1999/xhtml" xmlns:i18n="http://www.participatoryculture.org/i18n">\n<head>\n    <title>video player interface</title>\n\n    <link href="')
  334.     out.write(quoteattr(resources.url(u'css/style.css')))
  335.     out.write(u'" type="text/css" rel="stylesheet"></link>\n    <meta content="text/html; charset=utf-8" http-equiv="content-type"></meta>\n    <script type="text/javascript">\n<!-- // Protect from our XML parser, which doesn\'t know to protect <script>\n\n///////////////////////////////////////////////////////////////////////////////\n//// For use on your page                                                  ////\n///////////////////////////////////////////////////////////////////////////////\n\nfunction getDTVPlatform() {\n    var elt = document.getElementsByTagName("html")[0];\n    return elt.getAttribute(\'dtvPlatform\');\n}\n\nfunction loadURL(url) {\n    try {\n        document.location.href = url;\n    } catch (e) {\n        // This may happen if the backend decides to handle the url load\n        // itself.\n    }\n}\n\n// For calling from page Javascript: Cause a URL to be loaded. The\n// assumption is that the application will notice, abort the load, and\n// take some action based on the URL.\nfunction eventURL(url) {\n    if (typeof(window.frontend) == \'undefined\') {\n\t// Generic strategy: trigger a load, and hope the application\n\t// catches it and cancels it without creating a race\n\t// condition.\n        loadURL(url)\n    } else {\n\t// OS X WebKit (KHTML) strategy: pass in an Objective C object\n\t// through the window object and call a method on it.\n\twindow.frontend.eventURL(url);\n    }\n\n    return false;\n}\n\n// Calls eventURL, then calls event.stopPropagation() and\n// event.preventDefault() so that the event chain is stopped.\nfunction eventURLAndStop(url, event) {\n  eventURL(url);\n  event.stopPropagation();\n  event.preventDefault();\n}\n\nfunction recommendItem(title, url) {\n    loadURL(\'http://www.videobomb.com/index/democracyemail?url=\' + \n            url + \'&title=\' + title);\n    return false;\n}\n\nfunction recommendChannel(title, url) {\n    // See also app.py if changing this URL\n    loadURL(\'http://www.videobomb.com/democracy_channel/email_friend\' +\n        \'?url=\' + url + \'&title=\' + title);\n    return false;\n}\n\n// Start the video player. The playlist will be the items in the view\n// named by viewName. If firstItemId is the id of an item in the view,\n// playback will start on that item; otherwise playback will start on\n// the first item.\nfunction playViewNamed(viewName, firstItemId) {\n    url = \'action:playViewNamed?\';\n    url = url + \'viewName=\' + URLencode(viewName);\n    url = url + \'&firstItemId=\' + URLencode(firstItemId);\n    eventURL(url);\n    return false;\n}\n\n// You can make \'incremental search\' text boxes on your page that\n// effectively tie the text box to the \'parameter\' argument of setViewFilter,\n// with the other argumens fixed. To do this, add these two attributes to\n// the text box:\n//   onfocus="startEditSearch(this)"\n//   onblur="endEditFilter()"\n// replacing the arguments in parentheses with the desired strings.\n//\n// You\'ll also need to provide a updateSearchString function at the\n// top of your template to perform the actual update\n\nvar editSearchField = null;\nvar editSearchOldValue = \'\';\nvar editSearchTimer = null;\nvar editSearchCallback = null;\n\nfunction onSearchFocus(obj){\n  if (obj.getAttribute(\'searching\') != \'1\') {\n\tobj.value="";\n\tobj.searching = \'1\';\n  }\n  startEditSearch(obj, null);\n}\n\nfunction startEditSearch(obj, callback) {\n  editSearchOldValue = obj.value;\n\n  editSearchField = obj;\n  editSearchCallback = callback;\n  editSearchTimerTick();\n}\n\nfunction editSearchUpdate() {\n    value = editSearchField.value;\n    if (editSearchOldValue != value) {\n\turl = \'action:setSearchString?searchString=\' + URLencode(value);\n\teventURL(url);\n\teditSearchOldValue = value;\n\tif(editSearchCallback) editSearchCallback();\n    }\n}\n\nfunction editSearchTimerTick() {\n    editSearchUpdate();\n    editSearchTimer = setTimeout(editSearchTimerTick, 50);\n}\n\nfunction endEditSearch() {\n  clearTimeout(editSearchTimer);\n  editSearchUpdate();\n}\n\n// Internal use: \'URL encode\' the given string.\nfunction URLencode(str) {\n    return encodeURIComponent(str)\n}\n\nfunction URLdecode(str) {\n  return decodeURIComponent(str)\n}\n\nvar currentSelectBoxMenu = null;\nfunction showSelectBoxMenu(id) {\n    document.getElementById(id).style.display = \'block\';\n    currentSelectBoxMenu = id;\n    document.addEventListener(\'click\', hideSelectBoxMenu, true)\n}\n\nfunction hideSelectBoxMenu(event) {\n    document.getElementById(currentSelectBoxMenu).style.display = \'\';\n    currentSelectBoxMenu = null;\n    document.removeEventListener(\'click\', hideSelectBoxMenu, true)\n}\n\n///////////////////////////////////////////////////////////////////////////////\n//// For calling by host templating code                                   ////\n///////////////////////////////////////////////////////////////////////////////\n\n// For calling by host templating code: Set CSS styles on the item\n// with the given ID to make it disappear.\nfunction hideItem(id) {\n    elt = document.getElementById(id);\n    elt.style.display = \'none\';\n    forceRedisplay(elt);\n}\n\n// For calling by host templating code: Set CSS styles on the item\n// with the given ID to make it visible if it was previously hidden.\nfunction showItem(id) {\n    elt = document.getElementById(id);\n    elt.style.display = \'\';\n    forceRedisplay(elt);\n}\n\n// For calling by host templating code: Replace the item with the\n// given id with the element described by the proided XML.\nfunction changeItem(id, newXML) {\n    elt = document.getElementById(id);\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.createContextualFragment(newXML);\n    elt.parentNode.replaceChild(frag, elt);\n}\n\n// For calling by host templating code: Parse the XML in newXML into a\n// new element, and insert the new element immediately before the item\n// with the given id, such that the newly inserted item has the same\n// parent.\nfunction addItemBefore(newXML, id) {\n    elt = document.getElementById(id);\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.createContextualFragment(newXML);\n    elt.parentNode.insertBefore(frag, elt);\n}    \n\n// For calling by host templating code: Parse the XML in newXML into a\n// new element, and insert the new element as the final child of the\n// item with the given id.\nfunction addItemAtEnd(newXML, id) {\n    elt = document.getElementById(id);\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.createContextualFragment(newXML);\n    elt.insertBefore(frag, null);\n}    \n\n// For calling by host templating code: Remove the item with the given\n// id.\nfunction removeItem(id) {\n    elt = document.getElementById(id);\n    elt.parentNode.removeChild(elt);\n}    \n\n// Internal use: Sometime if all you do is change the style on a node,\n// Safari doesn\'t update the view until your mouse is next over the\n// window. Force the issue by making a drastic change in the vicinity\n// of the given element and then reversing it.\nfunction forceRedisplay(elt) {\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.extractContents();\n    r.insertNode(frag);\n}\n\nfunction handleContextMenuSelect(event) {\n  if(event.button == 2) {\n    var area = event.currentTarget.getAttribute("selectArea");\n    var id = event.currentTarget.getAttribute("selectID");\n    var viewName = event.currentTarget.getAttribute("selectViewName");\n    var url = \'action:handleContextMenuSelect?id=\' + id + \'&area=\' + area +\n              \'&viewName=\' + viewName;\n    eventURL(url);\n  }\n  return true;\n}\n\nfunction handleSelect(event) {\n   if(event.target.tagName && event.target.tagName.toUpperCase() == \'A\') {\n       // Either a link in the descrption, or a bomb/mailto/trash click\n       return true;\n    }\n    var id = event.currentTarget.getAttribute("selectID");\n    var viewName = event.currentTarget.getAttribute("selectViewName");\n    var area = event.currentTarget.getAttribute("selectArea");\n    var shiftKey = \'0\';\n    var ctrlKey = \'0\';\n    if(event.shiftKey) shiftKey = \'1\';\n    if(event.ctrlKey || event.metaKey) ctrlKey = \'1\';\n    eventURL(\'action:handleSelect?area=\' + area + \'&viewName=\' + viewName + \n\t\'&id=\' + id + \'&shiftDown=\' + shiftKey + \'&ctrlDown=\' + ctrlKey);\n    return true;\n}\n\nfunction handleDblClick(event, viewName, id) {\n   var target = event.target;\n   while (target != undefined && target.ondblclick === null && target.tagName.toUpperCase() != \'A\') {\n       target = target.parentNode;\n   }\n\n   if(target.tagName.toUpperCase() == \'A\') {\n       // Either a link in the descrption, or a bomb/mailto/trash click\n       return true;\n   } else {\n       return eventURL(\'action:playViewNamed?viewName=\' + viewName + \n           \'&firstItemId=\' + id);\n   }\n}\n\nfunction getKeyFromEvent(evt) {\n  var key = 0;\n  if (window.event)  {\n    key = evt.keyCode;\n  } else if (evt.which) {\n  \tkey = evt.which;\n  }\n\n  return key;\n}\n\nfunction sendKeyToSearchBox(event) {\n  if(event.altKey || event.ctrlKey || event.metaKey ||\n      (event.target.tagName && event.target.tagName.toUpperCase() == \'INPUT\'))\n      return true;\n  var key = getKeyFromEvent(event);\n  if ((key == 33) || (key == 34) || (key == 35) || (key == 36) || \n      (key == 37) || (key == 38) || (key == 39) || (key == 40))\n      return true;\n  var searchBox = document.getElementById("search-box");\n  searchBox.focus();\n  return true;\n}\n\nfunction playNewVideos(event, id) {\n  eventURL(\'action:playNewVideos?id=\' + id);\n  event.stopPropagation(); // don\'t want handleSelect to deal with this event\n  return false;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n///////////////////////////////////////////////////////////////////////////////\n\n-->\n</script>\n\n    <script src="')
  336.     out.write(quoteattr(resources.url(u'templates/osxdnd.js')))
  337.     out.write(u'" type="text/javascript"></script>\n    \n</head>\n<body')
  338.     out.write(u" " + bodyTagExtra)
  339.     out.write(u'>\n\n<div id="sidebar">\n  <div dragdestdata="channel-START" dragdesttype="channel:channelfolder" drageffectchannel="move" class="tab-list-drop-target" drageffectchannelfolder="move">\n    <ul class="tab-list first">\n\t')
  340.     out.write(u'<span id="tmplcomp58679699"/>\n\t')
  341.     out.write(u'<span id="tmplcomp46656577"/>\n    </ul>\n    <div class="dnd-reorder-indicator circle"></div>\n    <div class="dnd-reorder-indicator line"></div>\n  </div>\n  <div dragdestdata="playlist-START" drageffectplaylist="move" dragdesttype="playlist:playlistfolder" drageffectplaylistfolder="move" class="tab-list-drop-target">\n    <ul class="tab-list">\n      ')
  342.     out.write(u'<span id="tmplcomp14890511"/>\n    </ul>\n    <div class="dnd-reorder-indicator circle"></div>\n    <div class="dnd-reorder-indicator line"></div>\n  </div>\n  <div dragdestdata="channel-END" dragdesttype="channel:channelfolder" drageffectchannel="move" class="tab-list-drop-target" drageffectchannelfolder="move">\n\t<div class="dnd-reorder-indicator show-on-top circle"></div>\n\t<div class="dnd-reorder-indicator show-on-top line"></div>\n      <ul class="tab-list">\n      ')
  343.     out.write(u'<span id="tmplcomp34485995"/>\n    </ul>\n  </div>\n  <div dragdestdata="playlist-END" drageffectplaylist="move" dragdesttype="playlist:playlistfolder" drageffectplaylistfolder="move" class="tab-list-drop-target">\n      <div class="dnd-reorder-indicator show-on-top circle"></div>\n      <div class="dnd-reorder-indicator show-on-top line"></div>\n    </div>\n</div>\n</body>\n</html>')
  344.     out.seek(0)
  345.  
  346.  
  347.     return (out, handle)
  348.