Χρήστης:Shenme/common.js

Από Βικιθήκη

Σημείωση: Μετά την αποθήκευση πρέπει να καθαρίσετε την προσωρινή μνήμη του browser σας για να δείτε τις αλλαγές: Mozilla: πατήστε ReloadCtrl-R), IE / Opera: Ctrl-F5, Safari: Cmd-R, Konqueror Ctrl-R.

// trying out Wikimedia's jquery.ime

function myImeHints() {
  console.log('myImeHints(1): $.ime', $.ime)

  $.extend( $.ime.sources, {
    'el-betacode-loose': {
      name: 'Ancient Greek - Beta Code loose rules',
      source: './el-betacode-loose.js'
    },
    'el-betacode-strict': {
      name: 'Ancient Greek - Beta Code strict rules',
      source: './el-betacode-strict.js'
    },
  })

  $.extend( $.ime.languages, {
    el: {
      autonym: 'Ελληνικά',
      inputmethods: [ 'el-kbd', 'el-betacode-loose', 'el-betacode-strict' ],
    },
  })

  console.log('myImeHints(2): $.ime', $.ime)

  console.log('myImeHints():  previous $.ime.path', $.ime.path)
  $.ime.setPath('http://localhost:8000/')
  $.ime.path = 'http://localhost:8000/'
  console.log('myImeHints():   changed $.ime.path', $.ime.path)

  console.log('myImeHints(9): $.ime', $.ime)
}

// Try 'automatically' performing manual step of calling above routine
// once jquery.ime has been initialized by user actions
function myImeHintPokeEmInTheEye() {
	// Check whether IME has been initialized
	if ($  &&  $.ime) {
		myImeHints()
		// and let timer expire
	} else {
		// set timer to try again in a while
		setTimeout(myImeHintPokeEmInTheEye, 1000)
	}
}

if(1){
	$( document ).ready( function () {
		setTimeout(myImeHintPokeEmInTheEye, 1000)
	} );
}