Permalink
Browse files

SCM rewrite first commit

  • Loading branch information...
cshum committed Sep 28, 2012
0 parents commit 17ad2c0ac8345a70cd6bcd60089ab1d88ba8a100
Showing with 10,372 additions and 0 deletions.
  1. +33 −0 config.js
  2. +4 −0 css/reset.css
  3. +36 −0 css/scm.css
  4. +43 −0 js/binding/caption.js
  5. +20 −0 js/binding/followleft.js
  6. +26 −0 js/binding/innerbound.js
  7. +33 −0 js/binding/maskbtn.js
  8. +44 −0 js/binding/slider.js
  9. +2 −0 js/lib/jquery/jquery-1.8.0.min.js
  10. +41 −0 js/lib/jquery/jquery-ui-1.8.23.custom.min.js
  11. +86 −0 js/lib/knockout/knockout-2.1.0.js
  12. +126 −0 js/lib/knockout/pauseable.js
  13. +95 −0 js/lib/knockout/undoable.js
  14. +129 −0 js/lib/require/domready.js
  15. +35 −0 js/lib/require/require.js
  16. +305 −0 js/lib/require/text.js
  17. +110 −0 js/lib/soundmanager/soundmanager2-jsmin.js
  18. +80 −0 js/lib/soundmanager/soundmanager2-nodebug-jsmin.js
  19. +2,511 −0 js/lib/soundmanager/soundmanager2-nodebug.js
  20. +5,530 −0 js/lib/soundmanager/soundmanager2.js
  21. +32 −0 js/lib/underscore/underscore.js
  22. +69 −0 js/playback/soundmanager.js
  23. +92 −0 js/playback/youtube.js
  24. +33 −0 js/playlist/rss.js
  25. +22 −0 js/playlist/youtube.js
  26. +215 −0 js/scm.js
  27. +34 −0 js/scm.ui.js
  28. +19 −0 js/song.js
  29. +59 −0 js/view/player.html
  30. +15 −0 js/view/playlist.html
  31. +83 −0 scm.html
  32. BIN skins/aquaBlue/bar.jpg
  33. BIN skins/aquaBlue/main.png
  34. BIN skins/aquaBlue/playBtn.png
  35. BIN skins/aquaBlue/sizerAndVol.png
  36. +29 −0 skins/aquaBlue/skin.css
  37. BIN skins/aquaGreen/bar.jpg
  38. BIN skins/aquaGreen/main.png
  39. BIN skins/aquaGreen/playBtn.png
  40. BIN skins/aquaGreen/sizerAndVol.png
  41. +29 −0 skins/aquaGreen/skin.css
  42. BIN skins/aquaOrange/bar.jpg
  43. BIN skins/aquaOrange/main.png
  44. BIN skins/aquaOrange/playBtn.png
  45. BIN skins/aquaOrange/sizerAndVol.png
  46. +29 −0 skins/aquaOrange/skin.css
  47. BIN skins/aquaPink/bar.jpg
  48. BIN skins/aquaPink/main.png
  49. BIN skins/aquaPink/playBtn.png
  50. BIN skins/aquaPink/sizerAndVol.png
  51. +29 −0 skins/aquaPink/skin.css
  52. BIN skins/aquaPurple/bar.jpg
  53. BIN skins/aquaPurple/main.png
  54. BIN skins/aquaPurple/playBtn.png
  55. BIN skins/aquaPurple/sizerAndVol.png
  56. +29 −0 skins/aquaPurple/skin.css
  57. BIN skins/aquaPurpleReal/bar.jpg
  58. BIN skins/aquaPurpleReal/main.png
  59. BIN skins/aquaPurpleReal/playBtn.png
  60. BIN skins/aquaPurpleReal/sizerAndVol.png
  61. +31 −0 skins/aquaPurpleReal/skin.css
  62. BIN skins/black/bar.jpg
  63. BIN skins/black/main.png
  64. BIN skins/black/playBtn.png
  65. BIN skins/black/sizerAndVol.png
  66. +30 −0 skins/black/skin.css
  67. BIN skins/blue/main.png
  68. BIN skins/blue/playBtn.png
  69. BIN skins/blue/sizerAndVol.png
  70. +29 −0 skins/blue/skin.css
  71. BIN skins/cyber/bar.jpg
  72. BIN skins/cyber/main.png
  73. BIN skins/cyber/playBtn.png
  74. BIN skins/cyber/sizerAndVol.png
  75. +30 −0 skins/cyber/skin.css
  76. BIN skins/green/main.png
  77. BIN skins/green/playBtn.png
  78. BIN skins/green/sizerAndVol.png
  79. +29 −0 skins/green/skin.css
  80. BIN skins/orange/main.png
  81. BIN skins/orange/playBtn.png
  82. BIN skins/orange/sizerAndVol.png
  83. +29 −0 skins/orange/skin.css
  84. BIN skins/pink/main.png
  85. BIN skins/pink/playBtn.png
  86. BIN skins/pink/sizerAndVol.png
  87. +29 −0 skins/pink/skin.css
  88. BIN skins/purple/main.png
  89. BIN skins/purple/playBtn.png
  90. BIN skins/purple/sizerAndVol.png
  91. +29 −0 skins/purple/skin.css
  92. BIN skins/tunes/bar.jpg
  93. BIN skins/tunes/main.png
  94. BIN skins/tunes/playBtn.png
  95. BIN skins/tunes/sizerAndVol.png
  96. +29 −0 skins/tunes/skin.css
  97. BIN swf/soundmanager2.swf
  98. BIN swf/soundmanager2_debug.swf
  99. BIN swf/soundmanager2_flash9.swf
  100. BIN swf/soundmanager2_flash9_debug.swf
@@ -0,0 +1,33 @@
+var requirejs = ({
+ shim: {
+ 'underscore': {exports: '_'},
+ 'jquery.ui': {deps: ['jquery'],exports: 'jQuery'}
+ },
+ paths: {
+ 'jquery': 'lib/jquery/jquery-1.8.0.min',
+ 'jquery.ui': 'lib/jquery/jquery-ui-1.8.23.custom.min',
+ 'underscore': 'lib/underscore/underscore',
+ 'knockout':'lib/knockout/knockout-2.1.0',
+ 'text': 'lib/require/text',
+ 'domready': 'lib/require/domready'
+ },
+ config:{
+ 'scm':{
+ playback:{
+ 'youtube':'(youtube.com|youtu.be)',
+ 'soundmanager':'.*'
+ },
+ playlist:{
+ 'youtube':'(youtube.com|youtu.be)',
+ 'rss':'.*'
+ }
+ },
+ 'playback/soundmanager':{
+ script:'js/lib/soundmanager/soundmanager2-nodebug-jsmin.js',
+ url:'swf/',
+ }
+ },
+ baseUrl: 'js/',
+ urlArgs:"bust=" + (new Date()).getTime()
+});
+

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,36 @@
+#player, #playlist{
+ position:relative; height:100%; width:100%; font-size:11px;
+ font-family:Verdana,Arial,sans-serif; cursor:default; line-height:1.2;
+}
+
+#player .item, #player .mainImage, #player .ui-slider-handle,
+#player #seekerSlider,#player #seeker
+{ height:25px; top:0; position:absolute; }
+#player .text, #player #seekerBase, #player #seekerBuffered, #player{ position:absolute; }
+
+#player a{ text-decoration:none; }
+#player a:hover{ text-decoration:underline; }
+
+#player #baseLeft{ z-index:1; }
+#player #baseRight{ z-index:1; right:0; background-position:right top; }
+#player #play{ z-index:3; }
+#player .item{ z-index:2; }
+#player .bound{ position:relative;height:100%; }
+#player .text{ z-index:2; font-size:11px; height:20px; top:5px; cursor:default; }
+#player .button,#player .ui-slider-handle{cursor:pointer; }
+
+#player #seekerSliderBase{ z-index:3; margin-left:-3.5px; top:8px; width:7px; height:8px; }
+#player #seekerBuffered{ z-index:1; width:70%; top:8px; height:8px; left:0; }
+#player #seekerBase{ z-index:2; width:100%; border:1px solid; top:8px; height:6px; left:-1px; }
+
+#player #tooltip{ width:115px; text-align:center; }
+
+#playlist{ border-bottom:1px solid; }
+#playlist .module{ background:white; border:1px solid; border-bottom:none; }
+#playlistContainer{ position:absolute;top:20px;bottom:0;left:0;right:0;z-index:1; }
+#playlist h3{ border-bottom:1px solid; font-weight:bold; padding: 3px 5px;}
+
+#playlist li{ cursor:pointer; }
+#playlist .items{ overflow-x:hidden; overflow-y:auto; height:100%;}
+#playlist .item{ cursor:pointer; padding: 3px 5px; width:2000px; }
+
@@ -0,0 +1,43 @@
+define(['knockout','jquery'],function(ko,$){
+ ko.bindingHandlers.caption = {
+ init: function(el, valueAccessor,allBindingsAccessor){
+ var options = allBindingsAccessor().captionOptions || {};
+ var value = ko.utils.unwrapObservable(valueAccessor());
+ $(el).data('captionTarget',options.target);
+ $(el).data('captionText',value);
+ $(el).data('originalText',$(options.target).text());
+ var caption = function(){
+ var target = $(el).data('captionTarget');
+ $(target).text($(el).data('captionText'));
+ }
+ var revert = function(){
+ var target = $(el).data('captionTarget');
+ $(target).text($(el).data('originalText'));
+ }
+ if(options.trigger=='hover'){
+ $(el)
+ .on('mouseover',caption)
+ .on('mouseleave',revert);
+ }else if(options.trigger=='slide'){
+ $(el)
+ .on('slidestart',function(){
+ caption();
+ $(el).on('slide',caption);
+ })
+ .on('slidestop',function(){
+ $(el).off('slide',caption);
+ revert();
+ });
+ }
+ ko.utils.domNodeDisposal.addDisposeCallback(el, function() {
+ $(el).off();
+ });
+ },
+ update:function(el, valueAccessor){
+ var value = ko.utils.unwrapObservable(valueAccessor());
+ $(el).data('captionText',value);
+ }
+ }
+ return ko;
+});
+
@@ -0,0 +1,20 @@
+define(['knockout','jquery'],function(ko,$){
+ var followLeft = function(el, valueAccessor,all){
+ var $target = $(ko.utils.unwrapObservable(valueAccessor()));
+ function update(){
+ $target.css('left',($(el).position().left+$(el).width()+15)+'px');
+ }
+ $(el).data('followUpdate',update);
+ var interval = setInterval(update,100);
+ ko.utils.domNodeDisposal.addDisposeCallback(el, function() {
+ clearInterval(interval);
+ });
+ }
+ ko.bindingHandlers.followLeft = {
+ init: followLeft,
+ update:function(el){
+ setTimeout($(el).data('followUpdate'),0);
+ }
+ }
+ return ko;
+});
@@ -0,0 +1,26 @@
+define(['knockout','jquery'],function(ko,$){
+ var innerBound = function(el, valueAccessor){
+ var options = ko.utils.unwrapObservable(valueAccessor());
+ var $bound = $(el).find(options.bound);
+ var $handle = $(el).find(options.handle);
+ var width = 0;
+ function update(){
+ if(width==$handle.width()) return;
+ width = $handle.width();
+ var halfWidth = width/2;
+ $bound.css('width',$(el).width()-$handle.width())
+ .css('marginLeft',halfWidth)
+ .css('marginRight',halfWidth);
+ $handle.css('marginLeft',-halfWidth);
+ }
+ var interval = setInterval(update,100);
+ ko.utils.domNodeDisposal.addDisposeCallback(el, function() {
+ clearInterval(interval);
+ });
+ update();
+ }
+ ko.bindingHandlers.innerBound = {
+ init:innerBound
+ }
+});
+
@@ -0,0 +1,33 @@
+define(['knockout','jquery','underscore'],function(ko,$){
+ ko.bindingHandlers.maskBtn = {
+ init:function(el,valueAccessor){
+ var options = ko.utils.unwrapObservable(valueAccessor());
+ _.defaults(options,{
+ css:null,
+ hasOffset:true,
+ align:'left'
+ });
+ //button setup
+ var bgChange = function(pos){
+ if(options.hasOffset && pos=='top')
+ $(this).removeClass(options.css);
+ else{
+ $(this).addClass(options.css);
+ var left = parseInt($(this).css("left"));
+ var right = parseInt($(this).css("right"));
+ var bgx = options.align=='left'? -left: right+$(this).width();
+ $(this).css("backgroundPosition", (options.hasOffset?bgx:0) + "px "+pos);
+ }
+ }
+ $(el)
+ .on("mousedown",_.bind(bgChange,el,'bottom'))
+ .on("mouseup",_.bind(bgChange,el,'top'))
+ .on("mouseleave",_.bind(bgChange,el,'top'));
+
+ ko.utils.domNodeDisposal.addDisposeCallback(el, function() {
+ $(el).off();
+ });
+ }
+ }
+ return ko;
+});
@@ -0,0 +1,44 @@
+define(['knockout','jquery','jquery.ui'],function(ko,$){
+ ko.bindingHandlers.slider = {
+ //wrapper for jquery ui slider
+ init: function(el, valueAccessor,allBindingsAccessor) {
+ var options = allBindingsAccessor().sliderOptions || {};
+ //initialize the control
+ $(el).slider(options);
+
+ //handle the value changing in the UI
+ var observable = valueAccessor();
+ var setObservable = function(){
+ var sliderValue = $(el).slider("value");
+ var step = options.step;
+ if(Math.round(sliderValue/step) != Math.round(observable()/step))
+ observable(sliderValue);
+ }
+ if(options.liveUpdate)
+ ko.utils.registerEventHandler(el, "slide", _.throttle(setObservable,50));
+ ko.utils.registerEventHandler(el, "slidechange", setObservable);
+
+ if(options.pauseable){
+ ko.utils.registerEventHandler(el, "slidestart", function(){
+ observable.pause();
+ });
+ ko.utils.registerEventHandler(el, "slidestop", function(){
+ setTimeout(function(){
+ observable.resume();
+ },0);
+ });
+ }
+
+ //handle disposal (if KO removes by the template binding)
+ ko.utils.domNodeDisposal.addDisposeCallback(el, function() {
+ $(el).slider("destroy");
+ });
+ },
+ //handle the model value changing
+ update: function(el, valueAccessor) {
+ var value = valueAccessor();
+ $(el).slider("value",ko.utils.unwrapObservable(value));
+ }
+ };
+ return ko;
+});

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 17ad2c0

Please sign in to comment.