1. Youtube viewer - settings
  2. */
  3. dialog youviewsettings {
  4. title "Youtube viewer - settings"
  5. size -1 -1 104 62
  6. option dbu
  7. check "enabled", 1, 10 13 33 10
  8. box "View youtube links in Youtube viewer", 2, 3 3 98 24
  9. box "Size", 3, 3 28 73 31
  10. edit "", 4, 5 38 32 10
  11. edit "", 5, 42 38 32 10
  12. text "X", 6, 38 40 4 8, center
  13. text "width", 7, 7 47 25 8
  14. text "height", 8, 44 47 25 8
  15. button "SAVE", 9, 77 31 23 27
  16. }
  17. alias youviewsettings {
  18. if (!$dialog(youviewsettings)) dialog -m youviewsettings youviewsettings
  19. }
  20. alias -l alert { .timer 1 0 noop $!input( $1- ,o,mIRC - Youtube viewer - settings) }
  21. alias -l yset writeini youtubeview.ini $1 $2 $3-
  22. alias -l yread return $readini(youtubeview.ini,$1,$2)
  23. on *:dialog:youviewsettings:*:*: {
  24. if ($devent == init) {
  25. var %w = $yread(settings,w), %h = $yread(settings,h), %i = $yread(settings,i)
  26. if (%w) did -a youviewsettings 4 %w
  27. else did -a youviewsettings 4 850
  28. if (%h) did -a youviewsettings 5 %h
  29. else did -a youviewsettings 5 700
  30. if (%i !== 0) did -c youviewsettings 1
  31. }
  32. elseif ($devent == sclick) {
  33. if ($did == 9) {
  34. var %w = $did(youviewsettings,4), %h = $did(youviewsettings,5), %i = $did(youviewsettings,1).state
  35. yset settings i %i
  36. if (%h) yset settings h %h
  37. else remini youtubeview.ini settings h
  38. if (%h) yset settings w %w
  39. else remini youtubeview.ini settings w
  40. alert Settings saved!
  41. }
  42. }
  43. }
  44. menu * {
  45. Youtubesettings:youviewsettings
  46. }
  47. /*
  48. Youtube viewer
  49. */
  50. alias makyourl {
  51. if (%y.be == 1) {
  52. var %url = $1-
  53. var %url = $right(%url,$calc($len(%url) - 1 - $pos(%url,v=,1)))
  54. var %pos = $pos(%url,&,1)
  55. if (%pos) var %url = $left(%url,$calc(%pos - 1))
  56. return http://www.youtube.com/v/ $+ %y.link
  57. }
  58. else {
  59. var %url = $1-
  60. var %url = $right(%url,$calc($len(%url) - 1 - $pos(%url,v=,1)))
  61. var %pos = $pos(%url,&,1)
  62. if (%pos) var %url = $left(%url,$calc(%pos - 1))
  63. return http://www.youtube.com/v/ $+ %url
  64. }
  65. }
  66. alias youview {
  67. var %w = $yread(settings,w), %h = $yread(settings,h)
  68. var %url = $makyourl($1-)
  69. write -c youview.html <html><body style="margin: 0px;" bgcolor="black" Scroll="No"><div style="position:absolute; top: -18px;"><object width=" $+ %w $+ " height=" $+ %h $+ "><param name="movie" value=" $+ %url $+ "></param><param name="wmode" value="transparent"></param><embed src=" $+ %url $+ " type="application/x-shockwave-flash" wmode="transparent" width=" $+ %w $+ " height=" $+ %h $+ "></embed></object></div></body></html>
  70. if (!$dialog(youview)) {
  71. dialog -m youview youview
  72. }
  73. xdid -n youview 1 $mircdir $+ youview.html
  74. }
  75. dialog youview {
  76. title "Youtube viewer"
  77. size 100 100 $yread(settings,w) $calc($yread(settings,h) - 18)
  78. }
  79. on ^1:HOTLINK:*youtube.com/watch?*:*:{
  80. if ($yread(settings,i) !== 0) && ($mouse.key & 1) {
  81. youview $1
  82. }
  83. }
  84. on ^1:HOTLINK:*youtu.be/*:*:{
  85. if ($yread(settings,i) !== 0) && ($mouse.key & 1) {
  86. set %y.be 1
  87. set %y.link $remove($1,$left($1,16))
  88. youview $1
  89. }
  90. }
  91. on *:dialog:youview:*:*: {
  92. if ($devent == init) {
  93. dcx Mark $dname youview_cb
  94. xdialog -c $dname 1 webctrl 0 0 $yread(settings,w) $calc($yread(settings,h) - 18) tabstop
  95. }
  96. }
  97. alias youview_cb return
Comments powered by Disqus