Drupal7 loading gif

要重用 Drupal7 的 藍色㘣形 loading gif:

$('a').after('<div class="ajax-progress ajax-progress-throbber"><div class="throbber">&nbsp;</div></div>');

//... 移走
complete: function (jqXHR, textStatus) {
  $('.ajax-progress').remove();
}

JQuery toggle checkboxes

使用例子: 一個「全選」 checkbox 需要 toggle 它的子 checkbox,

jquery:

  var $checkbox = $(this).find(':checkbox');
  $checkbox.attr('checked', !$checkbox.attr('checked'));

Programmically add custom date filter to views

When programmically use views, two function is very important:

<?php
//get results only, i.e. return array of values
views_get_view_result($name,. $display_id);

//return themed html from views
views_embed_view($name,. $display_id);
?>

These two functions provide PHP developers more control over views.
By looking at the source code of them, you get the idea to $view object

So as views/date module do not yet provide a context filter to "larger than created date" (need review)
so I use some custom code to add custom filter to views:

<?php
// API: add_item($display_id, $type, $table, $field, $options = array(), $id = NULL)
// add custom filter programmically
$view->add_item($display_id, 'filter', 'node', 'created',
  array(
'value' => array('type' => 'date', 'value' => date('c', strtotime($strtotime_string))), 'operator' => '>='));
?>

在台灣換錢大法,隨想

這次去台灣有另一個發現
是有關在台灣換台幣的

台灣銀行是國定的外匯中心
星期一至五九時至四時半提供兌換台幣的服務
匯率也是正常的
但旅遊在外可不容易在這些時間到銀行換錢
畢竟觀光點的開放時間都是一至五,九至六

我星期五晚上到台灣桃園機場
身上只有一千多台幣
要付到巿中心的車有餘
但第二天是星期六銀行不開門啊
就在入境大樓外的兌換店換了錢
但擔心匯率差,只換了一點點
事後發現匯率也很貼近銀行的

第二天星期六我們發現了另一個星期六都可以換錢的地方
原本是想看看台北車站這個旅客中心有沒有找換店
但原來台灣的郵局是星期六都開放
而且是可以換錢的,又是半官方機構便換多了點錢

台灣的 7﹣11 或便利店絕對是值得台灣人驕傲的地方
有免費的 wifi 使用,有最多款的飲品,最多的即食面,最多的分店
我不在飯店時的 maps 都是 7-11 提供的
還有,7-11 是提供銀聯櫃員機的
我把著試試看的心態,使用恆生銀行的銀聯卡,兌換了一千港幣
也是我幾次在台換錢匯率最好的!
我事後看到匯率也嚇了一跳
那我以後都不用預先換台幣了
甚至不需要到銀行
只要到 7-11 就可以了,也不需要擔心匯率的問題
也不需要擔心身上有太多現金了

Disqus module's UTF8 characters in URL is missing

Ok, I give up my 30 days continuous blog,
but i will keep blogging as much as possible.

As there are disqus comments appeared,
I found that the UTF8 url send to disqus is actually incorrect, UTF8 characters is removed.
And as i cannot found a bug logged,
the temp. solution is remove UFT8 from generated path from pathauto
and report a bug. http://drupal.org/node/1809742

Pages

Google