From 617e0c53377f4b49d282254f1f613d5243cdddb0 Mon Sep 17 00:00:00 2001 From: joyqi Date: Sun, 20 Oct 2013 00:21:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E6=83=B3=E5=BA=94=E8=AF=A5=E6=98=AF?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E4=B8=AAalpha=E7=89=88=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E6=8F=90=E4=BA=A4=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/write-js.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/admin/write-js.php b/admin/write-js.php index b3eaa560..7c3224a0 100644 --- a/admin/write-js.php +++ b/admin/write-js.php @@ -85,21 +85,24 @@ $(document).ready(function() { } // 缩略名自适应宽度 - var slug = $('#slug'), sw = slug.width(); + var slug = $('#slug'); - if (slug.val().length > 0) { - slug.css('width', 'auto').attr('size', slug.val().length); - } - - slug.bind('input propertychange', function () { - var t = $(this), l = t.val().length; - - if (l > 0) { - t.css('width', 'auto').attr('size', l); - } else { - t.css('width', sw).removeAttr('size'); + if (slug.length > 0) { + var sw = slug.width(); + if (slug.val().length > 0) { + slug.css('width', 'auto').attr('size', slug.val().length); } - }).width(); + + slug.bind('input propertychange', function () { + var t = $(this), l = t.val().length; + + if (l > 0) { + t.css('width', 'auto').attr('size', l); + } else { + t.css('width', sw).removeAttr('size'); + } + }).width(); + } // 原始的插入图片和文件 Typecho.insertFileToEditor = function (url, isImage) {