比onload更快获取图片尺寸
文章更新:2011-05-31
lightbox类效果为了让图片居中显示而使用预加载,需要等待完全加载完毕才能显示,体验不佳(如filick相册的全屏效果)。javascript无法获取img文件头数据,真的是这样吗?本文通过一个巧妙的方法让javascript获取它。
文章更新:2011-05-31
lightbox类效果为了让图片居中显示而使用预加载,需要等待完全加载完毕才能显示,体验不佳(如filick相册的全屏效果)。javascript无法获取img文件头数据,真的是这样吗?本文通过一个巧妙的方法让javascript获取它。
table{width:100%;}
table td{word-break: keep-all;white-space:nowrap;}
本文转自 http://www.blogbus.com/softone-logs/105678346.html
作者:Eckel Chung blog地址:http://softone.blogbus.com/ 转载请保留
—————————————————————————
设置步骤:
1.勾选 Request Headers 中的 Hide if url contains 过滤项
2.贴入下方正则表达式
1 | REGEX:(?insx)/[^?/]*.(css|ico|jpg|png|gif|bmp|wav)(?.*)?$ |
REGEX: 表示启用正则表达式
(?insx) 设置正则解释的规则, 忽略大小写等.
新建usb存储脚本
1 | nano /etc/udev/rules.d/10-usbstorage.rules |
输入以下内容
1 2 3 4 5 6 7 8 9 10 11 12 13 | KERNEL!="sd*", GOTO="media_by_label_auto_mount_end" SUBSYSTEM!="block",GOTO="media_by_label_auto_mount_end" IMPORT{program}="/sbin/blkid -o udev -p %N" ENV{ID_FS_TYPE}=="", GOTO="media_by_label_auto_mount_end" ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}" ENV{ID_FS_LABEL}=="", ENV{dir_name}="Untitled-%k" ACTION=="add", ENV{mount_options}="relatime,sync" ACTION=="add", ENV{ID_FS_TYPE}=="vfat", ENV{mount_options}="iocharset=utf8,umask=000" ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", ENV{mount_options}="iocharset=utf8,umask=000" ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}" ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}" LABEL="media_by_label_auto_mount_end" |
现在可以像在 windows 中热插拨 usb 存储设备了.
发现设置会自动挂载到 /media 目录下. 可自行修改路径, 挂载到其他目录.
编辑登录用户的 ~/.bashrc 文件, 每个用户的 ~ 目录可能不同. 用 echo ~ 即可显示实际目录.
1 | nano ~/.bashrc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples # If not running interactively, don't do anything [ -z "$PS1" ] && return # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000 # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # If set, the pattern "**" used in a pathname expansion context will # match all files and zero or more directories and subdirectories. #shopt -s globstar # make less more friendly for non-text input files, see lesspipe(1) #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # set variable identifying the chroot you work in (used in the prompt below) if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm-color) color_prompt=yes;; esac # uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt force_color_prompt=yes if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # We have color support; assume it's compliant with Ecma-48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such # a case would tend to support setf rather than setaf.) color_prompt=yes else color_prompt= fi fi if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}[ |