Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » Google Chrome / Chromium / ChromePlus / SRWare Iron

Модерирует : gyra, Maz

Widok (25-12-2009 11:57): Лимит страниц. Продолжаем здесь.  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

LEX1

Silver Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

Код:
 
// Implementation of the Greasemonkey API, see:
// http://wiki.greasespot.net/Greasemonkey_Manual:APIs
const MIN_INT_32 = -0x80000000;
const MAX_INT_32 = 0x7FFFFFFF;
 
// Prefix for user script values that are stored in localStorage.
const STORAGE_NS = "__userscript__.";
 
function GM_getValue(name, defaultValue) {
  var value = localStorage.getItem(STORAGE_NS + name);
  return value ? value : defaultValue;
}
 
function GM_setValue(name, value) {
  // The values for GM_getValue() and GM_setValue() can only be boolean,
  // strings, or 32 bit integers.  See the setPrefs function in:
  // http://greasemonkey.devjavu.com/browser/trunk/src/chrome/chromeFiles/content/prefmanager.js
  var goodType = false;
  switch (typeof(value)) {
    case "string":
    case "boolean":
      goodType = true;
      break;
    case "number":
      // Note that "value % 1 == 0" checks that the number is not a float.
      if (value % 1 == 0 && value >= MIN_INT_32 && value <= MAX_INT_32) {
        goodType = true;
      }
      break;
  }
 
  if (!goodType) {
    throw new Error("Unsupported type for GM_setValue. Supported types " +
                    "are: string, bool, and 32 bit integers.");
  }
 
  localStorage.setItem(STORAGE_NS + name, value);
}
 
function GM_deleteValue(name) {
  localStorage.removeItem(STORAGE_NS + name);
}
 
function GM_listValues() {
  var values = [];
  for (var i = 0; i < localStorage.length; i++) {
    var key = localStorage.key(i);
    if (key.indexOf(STORAGE_NS) == 0) {
      key = key.substring(STORAGE_NS.length);
      values.push(key);
    }
  }
  return values;
}
 
function GM_getResourceURL(resourceName) {
  throw new Error("not implemented.");
}
 
function GM_getResourceText(resourceName) {
  throw new Error("not implemented.");
}
 
function GM_addStyle(css) {
  var head = document.getElementsByTagName("head")[0];
  if (!head) {
    return;
  }
  var style = document.createElement("style");
  style.type = "text/css";
  style.innerHTML = css;
  head.appendChild(style);
}
 
function GM_xmlhttpRequest(details) {
  throw new Error("not implemented.");
}
 
function GM_registerMenuCommand(commandName, commandFunc, accelKey,
                                accelModifiers, accessKey) {
  throw new Error("not implemented.");
}
 
function GM_openInTab(url) {
  window.open(url, "");
}
 
function GM_log(message) {
  window.console.log(message);
}  

Всего записей: 3793 | Зарегистр. 24-10-2005 | Отправлено: 01:14 21-02-2009 | Исправлено: LEX1, 01:29 21-02-2009
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » Google Chrome / Chromium / ChromePlus / SRWare Iron
Widok (25-12-2009 11:57): Лимит страниц. Продолжаем здесь.


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru