javascript

Fix for Add JavaScript to specific node

  1. /**
  2.  * Add JavaScript
  3.  */
  4. if (arg(0) == 'node' && arg(1) == $nid && !arg(2)){
  5.         drupal_add_js(base_path() . path_to_theme() .'/js/jquery.scrollTo-1.3.3-min.js', 'theme', 'header', FALSE, $cache);

Add JavaScript to specific node

  1. /**
  2.  * Add JavaScript
  3.  */
  4. if ($_GET['q'] == 'node/14'){
  5.         function drupal_add_custom_js($data = NULL, $type = 'theme', $scope = 'header', $defer = FALSE, $cache = TRUE) {

JavaScript Convert the Temperature Code

  1. <html>
  2. <head>
  3. <title>Convert the Temperature</title>
  4. <script type="text/javascript">
  5. //This Code was created by David A. and Matt I. on July 28, 2008
  6. //You may use this code freely

ie8.js mini module

  1. <?php
  2.  
  3. /**
  4. * Author: Nicolas Borda - http://nic.ipwa.net
  5. * Display help and module information
  6. * This module adds to your site the ie8 JavaScript library from Google Code
  7. *
  8. */

Fix for Swap out javascript (jQuery) files

  1. We talked a little about the "best" way to swap out javascript files and the way we've been doing it recently for sites that require 1.2 and higher, you can use this method.

Fix for Overriding Drupal.jsUpload.prototype.oncomplete

  1. var _oncomplete = Drupal.jsUpload.prototype.oncomplete;
  2. Drupal.jsUpload.prototype.oncomplete = function(data) {
  3.   // Your custom code here
  4.  
  5.   _oncomplete(data);
  6. }

Overriding Drupal.jsUpload.prototype.oncomplete

  1. var _oncomplete = Drupal.jsUpload.prototype.oncomplete;
  2. Drupal.jsUpload.prototype.oncomplete(data) {
  3.   // Your custom code here
  4.  
  5.   _oncomplete(data);
  6. }

JS that makes IE crash…

  1. cfg.context = function(configId) {
  2.   if (configId === undefined) {
  3.     return $('.hierarchical-select-config-form');
  4.   }
  5.   else {
  6.     return $('#hierarchical-select-config-form-'+ configId);

Fix for Javascript: Select multiple checkbox

  1. <script type="text/javascript">
  2. <!--
  3.  
  4. /*  status da seleção dos checkbox do formulário */
  5. var checked = false;
  6.  
  7. /**
  8.  * doCheck
  9.  *
  10.  
Rob Loach's picture

Fix for Form Input Example Plugin

  1. /*
  2. * jQuery Example Plugin 1.2.1
  3. * Populate form inputs with example text that disappears on focus.
  4. *
  5. * e.g.
  6. * $('input#name').example('Bob Smith');
  7.  
Syndicate content