Mercurial > zeropaste
changeset 263:a9c45375a656
Nuke width adjuster from orbit.
author | edogawaconan <me@myconan.net> |
---|---|
date | Wed, 16 Oct 2013 01:55:23 +0900 |
parents | 45bd94c70896 |
children | fa4a1ba990ae |
files | app/assets/javascripts/boot.js app/assets/javascripts/zp.hash_magic.js app/assets/javascripts/zp.viewer_width.js app/assets/stylesheets/pastes.css app/views/pastes/show.html.erb |
diffstat | 5 files changed, 4 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- a/app/assets/javascripts/boot.js Tue Oct 15 22:42:24 2013 +0900 +++ b/app/assets/javascripts/boot.js Wed Oct 16 01:55:23 2013 +0900 @@ -1,13 +1,11 @@ //= require zp.init //= require zp.emul_radio //= require zp.formatter -//= require zp.viewer_width //= require zp.hash_magic //= require zp.new $(document).ready(function() { zp.emul_radio.init() zp.formatter.init() - zp.viewer_width.init() zp.hash_magic.init() zp.new.init() })
--- a/app/assets/javascripts/zp.hash_magic.js Tue Oct 15 22:42:24 2013 +0900 +++ b/app/assets/javascripts/zp.hash_magic.js Wed Oct 16 01:55:23 2013 +0900 @@ -1,31 +1,22 @@ //= require zp.formatter -//= require zp.viewer_width (function($) { window.zp.hash_magic = { load_hash: function() { - var hash_array = window.location.hash.slice(2).split(".") - format = hash_array[0] - width = hash_array[1] + var format = window.location.hash.slice(1) if (format !== undefined) { zp.formatter.links().filter("[href=#" + format + "]").click() } - if (width !== undefined) { - zp.viewer_width.resize(width) - } }, set_hash: function(e) { if (typeof e !== "undefined") { - if (zp.formatter.links().filter(e.target).length === 0 && - zp.viewer_width.links().filter(e.target).length === 0) { return } + if (zp.formatter.links().filter(e.target).length === 0) return else e.preventDefault() } var format = zp.formatter.current(), - width = zp.viewer_width.current, - hash = "#!" + hash = "#" hash += format - if (width !== "auto") { hash += "." + width } - if (hash === "#!pl") { hash = " " } + if (hash === "#pl") { hash = " " } history.replaceState(null, "", hash) }, init: function() {
--- a/app/assets/javascripts/zp.viewer_width.js Tue Oct 15 22:42:24 2013 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -(function($) { - window.zp.viewer_width = { - links: function() { return $("#paste-resize ul li a") }, - current: "auto", - resize: function(width) { - var - paste = $("#paste"), - title = $("#paste-resize .btn") - title_span = $("#width-text") - title_span.text(title.data("base").replace(":size:", width)) - this.current = width - if (width == "auto") { - paste.css("width", "") - } else { - paste.css("width", width) - } - zp.hash_magic.set_hash() - }, - do_switch: function(e) { - this.resize($(e.target).text()) - }, - init: function() { - this.links().click($.proxy(this.do_switch, this)) - } - } -})(jQuery)
--- a/app/assets/stylesheets/pastes.css Tue Oct 15 22:42:24 2013 +0900 +++ b/app/assets/stylesheets/pastes.css Wed Oct 16 01:55:23 2013 +0900 @@ -9,7 +9,3 @@ #pl > pre { word-break: normal; } - -.row { - margin-bottom: 20px; -}
--- a/app/views/pastes/show.html.erb Tue Oct 15 22:42:24 2013 +0900 +++ b/app/views/pastes/show.html.erb Wed Oct 16 01:55:23 2013 +0900 @@ -18,18 +18,6 @@ <%= link_to 'Highlight', '#hl', :data => { :toggle => 'tab' }, :class => 'btn btn-default' %> <%= link_to 'Markdown', '#md', :data => { :toggle => 'tab' }, :class => 'btn btn-default' %> </div> - <div class="btn-group" id="paste-resize"> - <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" data-base="Width: :size:" href="#"> - <span id="width-text">Width: auto</span> - <span class="caret"></span> - </a> - <ul class="dropdown-menu"> - <li><a href="#">auto</a></li> - <li><a href="#">560px</a></li> - <li><a href="#">760px</a></li> - <li><a href="#">960px</a></li> - </ul> - </div> </div> </div></div> <div class="row"><div id="paste" class="col-lg-12 tab-content">