code stringlengths 1 2.08M | language stringclasses 1 value |
|---|---|
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Danish
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['da'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, ikke tilgængelig</span>',
confirmCancel : 'Nogle af indstillingerne er blevet ændret. Er du sikker på at lukke dialogen?',
ok : 'OK',
cancel : 'Annuller',
confirmationTitle : 'Bekræftelse',
messageTitle : 'Information',
inputTitle : 'Spørgsmål',
undo : 'Fortryd',
redo : 'Annuller fortryd',
skip : 'Skip',
skipAll : 'Skip alle',
makeDecision : 'Hvad skal der foretages?',
rememberDecision: 'Husk denne indstilling'
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'en',
LangCode : 'da',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'dd-mm-yyyy HH:MM',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'Mapper',
FolderLoading : 'Indlæser...',
FolderNew : 'Skriv navnet på den nye mappe: ',
FolderRename : 'Skriv det nye navn på mappen: ',
FolderDelete : 'Er du sikker på, at du vil slette mappen "%1"?',
FolderRenaming : ' (Omdøber...)',
FolderDeleting : ' (Sletter...)',
// Files
FileRename : 'Skriv navnet på den nye fil: ',
FileRenameExt : 'Er du sikker på, at du vil ændre filtypen? Filen kan muligvis ikke bruges bagefter.',
FileRenaming : '(Omdøber...)',
FileDelete : 'Er du sikker på, at du vil slette filen "%1"?',
FilesLoading : 'Indlæser...',
FilesEmpty : 'Tom mappe',
FilesMoved : 'Filen %1 flyttet til %2:%3',
FilesCopied : 'Filen %1 kopieret til %2:%3',
// Basket
BasketFolder : 'Kurv',
BasketClear : 'Tøm kurv',
BasketRemove : 'Fjern fra kurv',
BasketOpenFolder : 'Åben overordnet mappe',
BasketTruncateConfirm : 'Er du sikker på at du vil tømme kurven?',
BasketRemoveConfirm : 'Er du sikker på at du vil slette filen "%1" fra kurven?',
BasketEmpty : 'Ingen filer i kurven, brug musen til at trække filer til kurven.',
BasketCopyFilesHere : 'Kopier Filer fra kurven',
BasketMoveFilesHere : 'Flyt Filer fra kurven',
BasketPasteErrorOther : 'Fil fejl: %e',
BasketPasteMoveSuccess : 'Følgende filer blev flyttet: %s',
BasketPasteCopySuccess : 'Følgende filer blev kopieret: %s',
// Toolbar Buttons (some used elsewhere)
Upload : 'Upload',
UploadTip : 'Upload ny fil',
Refresh : 'Opdatér',
Settings : 'Indstillinger',
Help : 'Hjælp',
HelpTip : 'Hjælp',
// Context Menus
Select : 'Vælg',
SelectThumbnail : 'Vælg thumbnail',
View : 'Vis',
Download : 'Download',
NewSubFolder : 'Ny undermappe',
Rename : 'Omdøb',
Delete : 'Slet',
CopyDragDrop : 'Kopier hertil',
MoveDragDrop : 'Flyt hertil',
// Dialogs
RenameDlgTitle : 'Omdøb',
NewNameDlgTitle : 'Nyt navn',
FileExistsDlgTitle : 'Filen eksisterer allerede',
SysErrorDlgTitle : 'System fejl',
FileOverwrite : 'Overskriv',
FileAutorename : 'Auto-omdøb',
// Generic
OkBtn : 'OK',
CancelBtn : 'Annullér',
CloseBtn : 'Luk',
// Upload Panel
UploadTitle : 'Upload ny fil',
UploadSelectLbl : 'Vælg den fil, som du vil uploade',
UploadProgressLbl : '(Uploader, vent venligst...)',
UploadBtn : 'Upload filen',
UploadBtnCancel : 'Annuller',
UploadNoFileMsg : 'Vælg en fil på din computer.',
UploadNoFolder : 'Venligst vælg en mappe før upload startes.',
UploadNoPerms : 'Upload er ikke tilladt.',
UploadUnknError : 'Fejl ved upload.',
UploadExtIncorrect : 'Denne filtype er ikke tilladt i denne mappe.',
// Flash Uploads
UploadLabel : 'Files to Upload', // MISSING
UploadTotalFiles : 'Total Files:', // MISSING
UploadTotalSize : 'Total Size:', // MISSING
UploadAddFiles : 'Add Files', // MISSING
UploadClearFiles : 'Clear Files', // MISSING
UploadCancel : 'Cancel Upload', // MISSING
UploadRemove : 'Remove', // MISSING
UploadRemoveTip : 'Remove !f', // MISSING
UploadUploaded : 'Uploaded !n%', // MISSING
UploadProcessing : 'Processing...', // MISSING
// Settings Panel
SetTitle : 'Indstillinger',
SetView : 'Vis:',
SetViewThumb : 'Thumbnails',
SetViewList : 'Liste',
SetDisplay : 'Thumbnails:',
SetDisplayName : 'Filnavn',
SetDisplayDate : 'Dato',
SetDisplaySize : 'Størrelse',
SetSort : 'Sortering:',
SetSortName : 'efter filnavn',
SetSortDate : 'efter dato',
SetSortSize : 'efter størrelse',
// Status Bar
FilesCountEmpty : '<tom mappe>',
FilesCountOne : '1 fil',
FilesCountMany : '%1 filer',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'Det var ikke muligt at fuldføre handlingen. (Fejl: %1)',
Errors :
{
10 : 'Ugyldig handling.',
11 : 'Ressourcetypen blev ikke angivet i anmodningen.',
12 : 'Ressourcetypen er ikke gyldig.',
102 : 'Ugyldig fil eller mappenavn.',
103 : 'Det var ikke muligt at fuldføre handlingen på grund af en begrænsning i rettigheder.',
104 : 'Det var ikke muligt at fuldføre handlingen på grund af en begrænsning i filsystem rettigheder.',
105 : 'Ugyldig filtype.',
109 : 'Ugyldig anmodning.',
110 : 'Ukendt fejl.',
115 : 'En fil eller mappe med det samme navn eksisterer allerede.',
116 : 'Mappen blev ikke fundet. Opdatér listen eller prøv igen.',
117 : 'Filen blev ikke fundet. Opdatér listen eller prøv igen.',
118 : 'Originalplacering og destination er ens.',
201 : 'En fil med det samme filnavn eksisterer allerede. Den uploadede fil er blevet omdøbt til "%1".',
202 : 'Ugyldig fil.',
203 : 'Ugyldig fil. Filstørrelsen er for stor.',
204 : 'Den uploadede fil er korrupt.',
205 : 'Der er ikke en midlertidig mappe til upload til rådighed på serveren.',
206 : 'Upload annulleret af sikkerhedsmæssige årsager. Filen indeholder HTML-lignende data.',
207 : 'Den uploadede fil er blevet omdøbt til "%1".',
300 : 'Flytning af fil(er) fejlede.',
301 : 'Kopiering af fil(er) fejlede.',
500 : 'Filbrowseren er deaktiveret af sikkerhedsmæssige årsager. Kontakt systemadministratoren eller kontrollér CKFinders konfigurationsfil.',
501 : 'Understøttelse af thumbnails er deaktiveret.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'Filnavnet må ikke være tomt.',
FileExists : 'Fil %erne eksisterer allerede.',
FolderEmpty : 'Mappenavnet må ikke være tomt.',
FileInvChar : 'Filnavnet må ikke indeholde et af følgende tegn: \n\\ / : * ? " < > |',
FolderInvChar : 'Mappenavnet må ikke indeholde et af følgende tegn: \n\\ / : * ? " < > |',
PopupBlockView : 'Det var ikke muligt at åbne filen i et nyt vindue. Kontrollér konfigurationen i din browser, og deaktivér eventuelle popup-blokkere for denne hjemmeside.',
XmlError : 'It was not possible to properly load the XML response from the web server.', // MISSING
XmlEmpty : 'It was not possible to load the XML response from the web server. The server returned an empty response.', // MISSING
XmlRawResponse : 'Raw response from the server: %s' // MISSING
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Rediger størrelse %s',
sizeTooBig : 'Kan ikke ændre billedets højde eller bredde til en værdi større end dets originale størrelse (%size).',
resizeSuccess : 'Størrelsen er nu ændret.',
thumbnailNew : 'Opret ny thumbnail',
thumbnailSmall : 'Lille (%s)',
thumbnailMedium : 'Mellem (%s)',
thumbnailLarge : 'Stor (%s)',
newSize : 'Rediger størrelse',
width : 'Bredde',
height : 'Højde',
invalidHeight : 'Ugyldig højde.',
invalidWidth : 'Ugyldig bredde.',
invalidName : 'Ugyldigt filenavn.',
newImage : 'Opret nyt billede.',
noExtensionChange : 'Filtypen kan ikke ændres.',
imageSmall : 'Originalfilen er for lille.',
contextMenuName : 'Rediger størrelse',
lockRatio : 'Lås størrelsesforhold',
resetSize : 'Nulstil størrelse'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Gem',
fileOpenError : 'Filen kan ikke åbnes.',
fileSaveSuccess : 'Filen er nu gemt.',
contextMenuName : 'Rediger',
loadingFile : 'Henter fil, vent venligst...'
},
Maximize :
{
maximize : 'Maximér',
minimize : 'Minimize' // MISSING
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Norwegian Bokmål
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['nb'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, utilgjenglig</span>',
confirmCancel : 'Noen av valgene har blitt endret. Er du sikker på at du vil lukke dialogen?',
ok : 'OK',
cancel : 'Avbryt',
confirmationTitle : 'Confirmation', // MISSING
messageTitle : 'Information', // MISSING
inputTitle : 'Question', // MISSING
undo : 'Angre',
redo : 'Gjør om',
skip : 'Skip', // MISSING
skipAll : 'Skip all', // MISSING
makeDecision : 'What action should be taken?', // MISSING
rememberDecision: 'Remember my decision' // MISSING
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'en',
LangCode : 'no',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'dd/mm/yyyy HH:MM',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'Mapper',
FolderLoading : 'Laster...',
FolderNew : 'Skriv inn det nye mappenavnet: ',
FolderRename : 'Skriv inn det nye mappenavnet: ',
FolderDelete : 'Er du sikker på at du vil slette mappen "%1"?',
FolderRenaming : ' (Endrer mappenavn...)',
FolderDeleting : ' (Sletter...)',
// Files
FileRename : 'Skriv inn det nye filnavnet: ',
FileRenameExt : 'Er du sikker på at du vil endre filtypen? Filen kan bli ubrukelig.',
FileRenaming : 'Endrer filnavn...',
FileDelete : 'Er du sikker på at du vil slette denne filen "%1"?',
FilesLoading : 'Laster...',
FilesEmpty : 'The folder is empty.', // MISSING
FilesMoved : 'File %1 moved to %2:%3.', // MISSING
FilesCopied : 'File %1 copied to %2:%3.', // MISSING
// Basket
BasketFolder : 'Basket', // MISSING
BasketClear : 'Clear Basket', // MISSING
BasketRemove : 'Remove from Basket', // MISSING
BasketOpenFolder : 'Open Parent Folder', // MISSING
BasketTruncateConfirm : 'Do you really want to remove all files from the basket?', // MISSING
BasketRemoveConfirm : 'Do you really want to remove the file "%1" from the basket?', // MISSING
BasketEmpty : 'No files in the basket, drag and drop some.', // MISSING
BasketCopyFilesHere : 'Copy Files from Basket', // MISSING
BasketMoveFilesHere : 'Move Files from Basket', // MISSING
BasketPasteErrorOther : 'File %s error: %e', // MISSING
BasketPasteMoveSuccess : 'The following files were moved: %s', // MISSING
BasketPasteCopySuccess : 'The following files were copied: %s', // MISSING
// Toolbar Buttons (some used elsewhere)
Upload : 'Last opp',
UploadTip : 'Last opp en ny fil',
Refresh : 'Oppdater',
Settings : 'Innstillinger',
Help : 'Hjelp',
HelpTip : 'Hjelp finnes kun på engelsk',
// Context Menus
Select : 'Velg',
SelectThumbnail : 'Velg Miniatyr',
View : 'Vis fullversjon',
Download : 'Last ned',
NewSubFolder : 'Ny Undermappe',
Rename : 'Endre navn',
Delete : 'Slett',
CopyDragDrop : 'Copy File Here', // MISSING
MoveDragDrop : 'Move File Here', // MISSING
// Dialogs
RenameDlgTitle : 'Rename', // MISSING
NewNameDlgTitle : 'New Name', // MISSING
FileExistsDlgTitle : 'File Already Exists', // MISSING
SysErrorDlgTitle : 'System Error', // MISSING
FileOverwrite : 'Overwrite', // MISSING
FileAutorename : 'Auto-rename', // MISSING
// Generic
OkBtn : 'OK',
CancelBtn : 'Avbryt',
CloseBtn : 'Lukk',
// Upload Panel
UploadTitle : 'Last opp ny fil',
UploadSelectLbl : 'Velg filen du vil laste opp',
UploadProgressLbl : '(Laster opp filen, vennligst vent...)',
UploadBtn : 'Last opp valgt fil',
UploadBtnCancel : 'Avbryt',
UploadNoFileMsg : 'Du må velge en fil fra din datamaskin.',
UploadNoFolder : 'Please select a folder before uploading.', // MISSING
UploadNoPerms : 'File upload not allowed.', // MISSING
UploadUnknError : 'Error sending the file.', // MISSING
UploadExtIncorrect : 'File extension not allowed in this folder.', // MISSING
// Flash Uploads
UploadLabel : 'Files to Upload', // MISSING
UploadTotalFiles : 'Total Files:', // MISSING
UploadTotalSize : 'Total Size:', // MISSING
UploadAddFiles : 'Add Files', // MISSING
UploadClearFiles : 'Clear Files', // MISSING
UploadCancel : 'Cancel Upload', // MISSING
UploadRemove : 'Remove', // MISSING
UploadRemoveTip : 'Remove !f', // MISSING
UploadUploaded : 'Uploaded !n%', // MISSING
UploadProcessing : 'Processing...', // MISSING
// Settings Panel
SetTitle : 'Innstillinger',
SetView : 'Filvisning:',
SetViewThumb : 'Miniatyrbilder',
SetViewList : 'Liste',
SetDisplay : 'Vis:',
SetDisplayName : 'Filnavn',
SetDisplayDate : 'Dato',
SetDisplaySize : 'Filstørrelse',
SetSort : 'Sorter etter:',
SetSortName : 'Filnavn',
SetSortDate : 'Dato',
SetSortSize : 'Størrelse',
// Status Bar
FilesCountEmpty : '<Tom Mappe>',
FilesCountOne : '1 fil',
FilesCountMany : '%1 filer',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'Det var ikke mulig å utføre forespørselen. (Feil %1)',
Errors :
{
10 : 'Ugyldig kommando.',
11 : 'Ressurstypen ble ikke spesifisert i forepørselen.',
12 : 'Ugyldig ressurstype.',
102 : 'Ugyldig fil- eller mappenavn.',
103 : 'Kunne ikke utføre forespørselen pga manglende autorisasjon.',
104 : 'Kunne ikke utføre forespørselen pga manglende tilgang til filsystemet.',
105 : 'Ugyldig filtype.',
109 : 'Ugyldig forespørsel.',
110 : 'Ukjent feil.',
115 : 'Det finnes allerede en fil eller mappe med dette navnet.',
116 : 'Kunne ikke finne mappen. Oppdater vinduet og prøv igjen.',
117 : 'Kunne ikke finne filen. Oppdater vinduet og prøv igjen.',
118 : 'Source and target paths are equal.', // MISSING
201 : 'Det fantes allerede en fil med dette navnet. Den opplastede filens navn har blitt endret til "%1".',
202 : 'Ugyldig fil.',
203 : 'Ugyldig fil. Filen er for stor.',
204 : 'Den opplastede filen er korrupt.',
205 : 'Det finnes ingen midlertidig mappe for filopplastinger.',
206 : 'Opplastingen ble avbrutt av sikkerhetshensyn. Filen inneholder HTML-aktig data.',
207 : 'Den opplastede filens navn har blitt endret til "%1".',
300 : 'Moving file(s) failed.', // MISSING
301 : 'Copying file(s) failed.', // MISSING
500 : 'Filvelgeren ikke tilgjengelig av sikkerhetshensyn. Kontakt systemansvarlig og be han sjekke CKFinder\'s konfigurasjonsfil.',
501 : 'Funksjon for minityrbilder er skrudd av.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'Filnavnet kan ikke være tomt.',
FileExists : 'File %s already exists.', // MISSING
FolderEmpty : 'Mappenavnet kan ikke være tomt.',
FileInvChar : 'Filnavnet kan ikke inneholde følgende tegn: \n\\ / : * ? " < > |',
FolderInvChar : 'Mappenavnet kan ikke inneholde følgende tegn: \n\\ / : * ? " < > |',
PopupBlockView : 'Du må skru av popup-blockeren for å se bildet i nytt vindu.',
XmlError : 'It was not possible to properly load the XML response from the web server.', // MISSING
XmlEmpty : 'It was not possible to load the XML response from the web server. The server returned an empty response.', // MISSING
XmlRawResponse : 'Raw response from the server: %s' // MISSING
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Resize %s', // MISSING
sizeTooBig : 'Cannot set image height or width to a value bigger than the original size (%size).', // MISSING
resizeSuccess : 'Image resized successfully.', // MISSING
thumbnailNew : 'Create a new thumbnail', // MISSING
thumbnailSmall : 'Small (%s)', // MISSING
thumbnailMedium : 'Medium (%s)', // MISSING
thumbnailLarge : 'Large (%s)', // MISSING
newSize : 'Set a new size', // MISSING
width : 'Bredde',
height : 'Høyde',
invalidHeight : 'Invalid height.', // MISSING
invalidWidth : 'Invalid width.', // MISSING
invalidName : 'Invalid file name.', // MISSING
newImage : 'Create a new image', // MISSING
noExtensionChange : 'File extension cannot be changed.', // MISSING
imageSmall : 'Source image is too small.', // MISSING
contextMenuName : 'Resize', // MISSING
lockRatio : 'Lås forhold',
resetSize : 'Tilbakestill størrelse'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Lagre',
fileOpenError : 'Unable to open file.', // MISSING
fileSaveSuccess : 'File saved successfully.', // MISSING
contextMenuName : 'Edit', // MISSING
loadingFile : 'Loading file, please wait...' // MISSING
},
Maximize :
{
maximize : 'Maksimer',
minimize : 'Minimer'
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Lithuanian
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['lt'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, nėra</span>',
confirmCancel : 'Kai kurie nustatymai buvo pakeisti. Ar tikrai norite uždaryti šį langą?',
ok : 'Gerai',
cancel : 'Atšaukti',
confirmationTitle : 'Patvirtinimas',
messageTitle : 'Informacija',
inputTitle : 'Klausimas',
undo : 'Veiksmas atgal',
redo : 'Veiksmas pirmyn',
skip : 'Praleisti',
skipAll : 'Praleisti viską',
makeDecision : 'Ką pasirinksite?',
rememberDecision: 'Atsiminti mano pasirinkimą'
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'lt',
LangCode : 'lt',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'yyyy.mm.dd H:MM',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'Segtuvai',
FolderLoading : 'Prašau palaukite...',
FolderNew : 'Prašau įrašykite naujo segtuvo pavadinimą: ',
FolderRename : 'Prašau įrašykite naujo segtuvo pavadinimą: ',
FolderDelete : 'Ar tikrai norite ištrinti "%1" segtuvą?',
FolderRenaming : ' (Pervadinama...)',
FolderDeleting : ' (Trinama...)',
// Files
FileRename : 'Prašau įrašykite naujo failo pavadinimą: ',
FileRenameExt : 'Ar tikrai norite pakeisti šio failo plėtinį? Failas gali būti nebepanaudojamas',
FileRenaming : 'Pervadinama...',
FileDelete : 'Ar tikrai norite ištrinti failą "%1"?',
FilesLoading : 'Prašau palaukite...',
FilesEmpty : 'Tuščias segtuvas',
FilesMoved : 'Failas %1 perkeltas į %2:%3',
FilesCopied : 'Failas %1 nukopijuotas į %2:%3',
// Basket
BasketFolder : 'Krepšelis',
BasketClear : 'Ištuštinti krepšelį',
BasketRemove : 'Ištrinti krepšelį',
BasketOpenFolder : 'Atidaryti failo segtuvą',
BasketTruncateConfirm : 'Ar tikrai norite ištrinti visus failus iš krepšelio?',
BasketRemoveConfirm : 'Ar tikrai norite ištrinti failą "%1" iš krepšelio?',
BasketEmpty : 'Krepšelyje failų nėra, nuvilkite ir įmeskite juos į krepšelį.',
BasketCopyFilesHere : 'Kopijuoti failus iš krepšelio',
BasketMoveFilesHere : 'Perkelti failus iš krepšelio',
BasketPasteErrorOther : 'Failo %s klaida: %e',
BasketPasteMoveSuccess : 'Atitinkami failai buvo perkelti: %s',
BasketPasteCopySuccess : 'Atitinkami failai buvo nukopijuoti: %s',
// Toolbar Buttons (some used elsewhere)
Upload : 'Įkelti',
UploadTip : 'Įkelti naują failą',
Refresh : 'Atnaujinti',
Settings : 'Nustatymai',
Help : 'Pagalba',
HelpTip : 'Patarimai',
// Context Menus
Select : 'Pasirinkti',
SelectThumbnail : 'Pasirinkti miniatiūrą',
View : 'Peržiūrėti',
Download : 'Atsisiųsti',
NewSubFolder : 'Naujas segtuvas',
Rename : 'Pervadinti',
Delete : 'Ištrinti',
CopyDragDrop : 'Nukopijuoti failą čia',
MoveDragDrop : 'Perkelti failą čia',
// Dialogs
RenameDlgTitle : 'Pervadinti',
NewNameDlgTitle : 'Naujas pavadinimas',
FileExistsDlgTitle : 'Toks failas jau egzistuoja',
SysErrorDlgTitle : 'Sistemos klaida',
FileOverwrite : 'Užrašyti ant viršaus',
FileAutorename : 'Automatiškai pervadinti',
// Generic
OkBtn : 'Gerai',
CancelBtn : 'Atšaukti',
CloseBtn : 'Uždaryti',
// Upload Panel
UploadTitle : 'Įkelti naują failą',
UploadSelectLbl : 'Pasirinkite failą įkėlimui',
UploadProgressLbl : '(Vykdomas įkėlimas, prašau palaukite...)',
UploadBtn : 'Įkelti pasirinktą failą',
UploadBtnCancel : 'Atšaukti',
UploadNoFileMsg : 'Pasirinkite failą iš savo kompiuterio',
UploadNoFolder : 'Pasirinkite segtuvą prieš įkeliant.',
UploadNoPerms : 'Failų įkėlimas uždraustas.',
UploadUnknError : 'Įvyko klaida siunčiant failą.',
UploadExtIncorrect : 'Šiame segtuve toks failų plėtinys yra uždraustas.',
// Flash Uploads
UploadLabel : 'Įkeliami failai',
UploadTotalFiles : 'Iš viso failų:',
UploadTotalSize : 'Visa apimtis:',
UploadAddFiles : 'Pridėti failus',
UploadClearFiles : 'Išvalyti failus',
UploadCancel : 'Atšaukti nusiuntimą',
UploadRemove : 'Pašalinti',
UploadRemoveTip : 'Pašalinti !f',
UploadUploaded : 'Įkeltas !n%',
UploadProcessing : 'Apdorojama...',
// Settings Panel
SetTitle : 'Nustatymai',
SetView : 'Peržiūrėti:',
SetViewThumb : 'Miniatiūros',
SetViewList : 'Sąrašas',
SetDisplay : 'Rodymas:',
SetDisplayName : 'Failo pavadinimas',
SetDisplayDate : 'Data',
SetDisplaySize : 'Failo dydis',
SetSort : 'Rūšiavimas:',
SetSortName : 'pagal failo pavadinimą',
SetSortDate : 'pagal datą',
SetSortSize : 'pagal apimtį',
// Status Bar
FilesCountEmpty : '<Tuščias segtuvas>',
FilesCountOne : '1 failas',
FilesCountMany : '%1 failai',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'Užklausos įvykdyti nepavyko. (Klaida %1)',
Errors :
{
10 : 'Neteisinga komanda.',
11 : 'Resurso rūšis nenurodyta užklausoje.',
12 : 'Neteisinga resurso rūšis.',
102 : 'Netinkamas failas arba segtuvo pavadinimas.',
103 : 'Nepavyko įvykdyti užklausos dėl autorizavimo apribojimų.',
104 : 'Nepavyko įvykdyti užklausos dėl failų sistemos leidimų apribojimų.',
105 : 'Netinkamas failo plėtinys.',
109 : 'Netinkama užklausa.',
110 : 'Nežinoma klaida.',
115 : 'Failas arba segtuvas su tuo pačiu pavadinimu jau yra.',
116 : 'Segtuvas nerastas. Pabandykite atnaujinti.',
117 : 'Failas nerastas. Pabandykite atnaujinti failų sąrašą.',
118 : 'Šaltinio ir nurodomos vietos nuorodos yra vienodos.',
201 : 'Failas su tuo pačiu pavadinimu jau tra. Įkeltas failas buvo pervadintas į "%1"',
202 : 'Netinkamas failas',
203 : 'Netinkamas failas. Failo apimtis yra per didelė.',
204 : 'Įkeltas failas yra pažeistas.',
205 : 'Nėra laikinojo segtuvo skirto failams įkelti.',
206 : 'Įkėlimas bus nutrauktas dėl saugumo sumetimų. Šiame faile yra HTML duomenys.',
207 : 'Įkeltas failas buvo pervadintas į "%1"',
300 : 'Failų perkėlimas nepavyko.',
301 : 'Failų kopijavimas nepavyko.',
500 : 'Failų naršyklė yra išjungta dėl saugumo nustaymų. Prašau susisiekti su sistemų administratoriumi ir patikrinkite CKFinder konfigūracinį failą.',
501 : 'Miniatiūrų palaikymas išjungtas.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'Failo pavadinimas negali būti tuščias',
FileExists : 'Failas %s jau egzistuoja',
FolderEmpty : 'Segtuvo pavadinimas negali būti tuščias',
FileInvChar : 'Failo pavadinimas negali turėti bent vieno iš šių simbolių: \n\\ / : * ? " < > |',
FolderInvChar : 'Segtuvo pavadinimas negali turėti bent vieno iš šių simbolių: \n\\ / : * ? " < > |',
PopupBlockView : 'Nepavyko atidaryti failo naujame lange. Prašau pakeiskite savo naršyklės nustatymus, kad būtų leidžiami iškylantys langai šiame tinklapyje.',
XmlError : 'Nepavyko įkrauti XML atsako iš web serverio.',
XmlEmpty : 'Nepavyko įkrauti XML atsako iš web serverio. Serveris gražino tuščią užklausą.',
XmlRawResponse : 'Vientisas atsakas iš serverio: %s'
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Keisti matmenis %s',
sizeTooBig : 'Negalima nustatyti aukščio ir pločio į didesnius nei originalaus paveiksliuko (%size).',
resizeSuccess : 'Paveiksliuko matmenys pakeisti.',
thumbnailNew : 'Sukurti naują miniatiūrą',
thumbnailSmall : 'Mažas (%s)',
thumbnailMedium : 'Vidutinis (%s)',
thumbnailLarge : 'Didelis (%s)',
newSize : 'Nustatyti naujus matmenis',
width : 'Plotis',
height : 'Aukštis',
invalidHeight : 'Neteisingas aukštis.',
invalidWidth : 'Neteisingas plotis.',
invalidName : 'Neteisingas pavadinimas.',
newImage : 'Sukurti naują paveiksliuką',
noExtensionChange : 'Failo plėtinys negali būti pakeistas.',
imageSmall : 'Šaltinio paveiksliukas yra per mažas',
contextMenuName : 'Pakeisti matmenis',
lockRatio : 'Išlaikyti matmenų santykį',
resetSize : 'Nustatyti dydį iš naujo'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Išsaugoti',
fileOpenError : 'Nepavyko atidaryti failo.',
fileSaveSuccess : 'Failas sėkmingai išsaugotas.',
contextMenuName : 'Redaguoti',
loadingFile : 'Įkraunamas failas, prašau palaukite...'
},
Maximize :
{
maximize : 'Padidinti',
minimize : 'Sumažinti'
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Chinese (Taiwan)
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['zh-tw'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, unavailable</span>', // MISSING
confirmCancel : 'Some of the options were changed. Are you sure you want to close the dialog window?', // MISSING
ok : 'OK', // MISSING
cancel : 'Cancel', // MISSING
confirmationTitle : 'Confirmation', // MISSING
messageTitle : 'Information', // MISSING
inputTitle : 'Question', // MISSING
undo : 'Undo', // MISSING
redo : 'Redo', // MISSING
skip : 'Skip', // MISSING
skipAll : 'Skip all', // MISSING
makeDecision : 'What action should be taken?', // MISSING
rememberDecision: 'Remember my decision' // MISSING
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'zh-tw',
LangCode : 'zh-tw',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'mm/dd/yyyy HH:MM',
DateAmPm : ['上午', '下午'],
// Folders
FoldersTitle : '目錄',
FolderLoading : '載入中...',
FolderNew : '請輸入新目錄名稱: ',
FolderRename : '請輸入新目錄名稱: ',
FolderDelete : '確定刪除 "%1" 這個目錄嗎?',
FolderRenaming : ' (修改目錄...)',
FolderDeleting : ' (刪除目錄...)',
// Files
FileRename : '請輸入新檔案名稱: ',
FileRenameExt : '確定變更這個檔案的副檔名嗎? 變更後 , 此檔案可能會無法使用 !',
FileRenaming : '修改檔案名稱...',
FileDelete : '確定要刪除這個檔案 "%1"?',
FilesLoading : '載入中...',
FilesEmpty : 'The folder is empty.', // MISSING
FilesMoved : 'File %1 moved to %2:%3.', // MISSING
FilesCopied : 'File %1 copied to %2:%3.', // MISSING
// Basket
BasketFolder : 'Basket', // MISSING
BasketClear : 'Clear Basket', // MISSING
BasketRemove : 'Remove from Basket', // MISSING
BasketOpenFolder : 'Open Parent Folder', // MISSING
BasketTruncateConfirm : 'Do you really want to remove all files from the basket?', // MISSING
BasketRemoveConfirm : 'Do you really want to remove the file "%1" from the basket?', // MISSING
BasketEmpty : 'No files in the basket, drag and drop some.', // MISSING
BasketCopyFilesHere : 'Copy Files from Basket', // MISSING
BasketMoveFilesHere : 'Move Files from Basket', // MISSING
BasketPasteErrorOther : 'File %s error: %e', // MISSING
BasketPasteMoveSuccess : 'The following files were moved: %s', // MISSING
BasketPasteCopySuccess : 'The following files were copied: %s', // MISSING
// Toolbar Buttons (some used elsewhere)
Upload : '上傳檔案',
UploadTip : '上傳一個新檔案',
Refresh : '重新整理',
Settings : '偏好設定',
Help : '說明',
HelpTip : '說明',
// Context Menus
Select : '選擇',
SelectThumbnail : 'Select Thumbnail', // MISSING
View : '瀏覽',
Download : '下載',
NewSubFolder : '建立新子目錄',
Rename : '重新命名',
Delete : '刪除',
CopyDragDrop : 'Copy File Here', // MISSING
MoveDragDrop : 'Move File Here', // MISSING
// Dialogs
RenameDlgTitle : 'Rename', // MISSING
NewNameDlgTitle : 'New Name', // MISSING
FileExistsDlgTitle : 'File Already Exists', // MISSING
SysErrorDlgTitle : 'System Error', // MISSING
FileOverwrite : 'Overwrite', // MISSING
FileAutorename : 'Auto-rename', // MISSING
// Generic
OkBtn : '確定',
CancelBtn : '取消',
CloseBtn : '關閉',
// Upload Panel
UploadTitle : '上傳新檔案',
UploadSelectLbl : '請選擇要上傳的檔案',
UploadProgressLbl : '(檔案上傳中 , 請稍候...)',
UploadBtn : '將檔案上傳到伺服器',
UploadBtnCancel : '取消',
UploadNoFileMsg : '請從你的電腦選擇一個檔案.',
UploadNoFolder : 'Please select a folder before uploading.', // MISSING
UploadNoPerms : 'File upload not allowed.', // MISSING
UploadUnknError : 'Error sending the file.', // MISSING
UploadExtIncorrect : 'File extension not allowed in this folder.', // MISSING
// Flash Uploads
UploadLabel : 'Files to Upload', // MISSING
UploadTotalFiles : 'Total Files:', // MISSING
UploadTotalSize : 'Total Size:', // MISSING
UploadAddFiles : 'Add Files', // MISSING
UploadClearFiles : 'Clear Files', // MISSING
UploadCancel : 'Cancel Upload', // MISSING
UploadRemove : 'Remove', // MISSING
UploadRemoveTip : 'Remove !f', // MISSING
UploadUploaded : 'Uploaded !n%', // MISSING
UploadProcessing : 'Processing...', // MISSING
// Settings Panel
SetTitle : '設定',
SetView : '瀏覽方式:',
SetViewThumb : '縮圖預覽',
SetViewList : '清單列表',
SetDisplay : '顯示欄位:',
SetDisplayName : '檔案名稱',
SetDisplayDate : '檔案日期',
SetDisplaySize : '檔案大小',
SetSort : '排序方式:',
SetSortName : '依 檔案名稱',
SetSortDate : '依 檔案日期',
SetSortSize : '依 檔案大小',
// Status Bar
FilesCountEmpty : '<此目錄沒有任何檔案>',
FilesCountOne : '1 個檔案',
FilesCountMany : '%1 個檔案',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : '無法連接到伺服器 ! (錯誤代碼 %1)',
Errors :
{
10 : '不合法的指令.',
11 : '連接過程中 , 未指定資源形態 !',
12 : '連接過程中出現不合法的資源形態 !',
102 : '不合法的檔案或目錄名稱 !',
103 : '無法連接:可能是使用者權限設定錯誤 !',
104 : '無法連接:可能是伺服器檔案權限設定錯誤 !',
105 : '無法上傳:不合法的副檔名 !',
109 : '不合法的請求 !',
110 : '不明錯誤 !',
115 : '檔案或目錄名稱重複 !',
116 : '找不到目錄 ! 請先重新整理 , 然後再試一次 !',
117 : '找不到檔案 ! 請先重新整理 , 然後再試一次 !',
118 : 'Source and target paths are equal.', // MISSING
201 : '伺服器上已有相同的檔案名稱 ! 您上傳的檔案名稱將會自動更改為 "%1".',
202 : '不合法的檔案 !',
203 : '不合法的檔案 ! 檔案大小超過預設值 !',
204 : '您上傳的檔案已經損毀 !',
205 : '伺服器上沒有預設的暫存目錄 !',
206 : '檔案上傳程序因為安全因素已被系統自動取消 ! 可能是上傳的檔案內容包含 HTML 碼 !',
207 : '您上傳的檔案名稱將會自動更改為 "%1".',
300 : 'Moving file(s) failed.', // MISSING
301 : 'Copying file(s) failed.', // MISSING
500 : '因為安全因素 , 檔案瀏覽器已被停用 ! 請聯絡您的系統管理者並檢查 CKFinder 的設定檔 config.php !',
501 : '縮圖預覽功能已被停用 !'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : '檔案名稱不能空白 !',
FileExists : 'File %s already exists.', // MISSING
FolderEmpty : '目錄名稱不能空白 !',
FileInvChar : '檔案名稱不能包含以下字元: \n\\ / : * ? " < > |',
FolderInvChar : '目錄名稱不能包含以下字元: \n\\ / : * ? " < > |',
PopupBlockView : '無法在新視窗開啟檔案 ! 請檢查瀏覽器的設定並且針對這個網站 關閉 <封鎖彈跳視窗> 這個功能 !',
XmlError : 'It was not possible to properly load the XML response from the web server.', // MISSING
XmlEmpty : 'It was not possible to load the XML response from the web server. The server returned an empty response.', // MISSING
XmlRawResponse : 'Raw response from the server: %s' // MISSING
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Resize %s', // MISSING
sizeTooBig : 'Cannot set image height or width to a value bigger than the original size (%size).', // MISSING
resizeSuccess : 'Image resized successfully.', // MISSING
thumbnailNew : 'Create a new thumbnail', // MISSING
thumbnailSmall : 'Small (%s)', // MISSING
thumbnailMedium : 'Medium (%s)', // MISSING
thumbnailLarge : 'Large (%s)', // MISSING
newSize : 'Set a new size', // MISSING
width : 'Width', // MISSING
height : 'Height', // MISSING
invalidHeight : 'Invalid height.', // MISSING
invalidWidth : 'Invalid width.', // MISSING
invalidName : 'Invalid file name.', // MISSING
newImage : 'Create a new image', // MISSING
noExtensionChange : 'File extension cannot be changed.', // MISSING
imageSmall : 'Source image is too small.', // MISSING
contextMenuName : 'Resize', // MISSING
lockRatio : 'Lock ratio', // MISSING
resetSize : 'Reset size' // MISSING
},
// Fileeditor plugin
Fileeditor :
{
save : 'Save', // MISSING
fileOpenError : 'Unable to open file.', // MISSING
fileSaveSuccess : 'File saved successfully.', // MISSING
contextMenuName : 'Edit', // MISSING
loadingFile : 'Loading file, please wait...' // MISSING
},
Maximize :
{
maximize : 'Maximize', // MISSING
minimize : 'Minimize' // MISSING
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Greek
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['el'] =
{
appTitle : 'CKFinder', // MISSING
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, unavailable</span>', // MISSING
confirmCancel : 'Some of the options were changed. Are you sure you want to close the dialog window?', // MISSING
ok : 'OK',
cancel : 'Ακύρωση',
confirmationTitle : 'Confirmation', // MISSING
messageTitle : 'Information', // MISSING
inputTitle : 'Question', // MISSING
undo : 'Αναίρεση',
redo : 'Επαναφορά',
skip : 'Skip', // MISSING
skipAll : 'Skip all', // MISSING
makeDecision : 'What action should be taken?', // MISSING
rememberDecision: 'Remember my decision' // MISSING
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'en',
LangCode : 'el',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'dd/mm/yyyy HH:MM',
DateAmPm : ['ΜΜ', 'ΠΜ'],
// Folders
FoldersTitle : 'Φάκελοι',
FolderLoading : 'Φόρτωση...',
FolderNew : 'Παρακαλούμε πληκτρολογήστε την ονομασία του νέου φακέλου: ',
FolderRename : 'Παρακαλούμε πληκτρολογήστε την νέα ονομασία του φακέλου: ',
FolderDelete : 'Είστε σίγουροι ότι θέλετε να διαγράψετε το φάκελο "%1";',
FolderRenaming : ' (Μετονομασία...)',
FolderDeleting : ' (Διαγραφή...)',
// Files
FileRename : 'Παρακαλούμε πληκτρολογήστε την νέα ονομασία του αρχείου: ',
FileRenameExt : 'Είστε σίγουροι ότι θέλετε να αλλάξετε την επέκταση του αρχείου; Μετά από αυτή την ενέργεια το αρχείο μπορεί να μην μπορεί να χρησιμοποιηθεί',
FileRenaming : 'Μετονομασία...',
FileDelete : 'Είστε σίγουροι ότι θέλετε να διαγράψετε το αρχείο "%1"?',
FilesLoading : 'Φόρτωση...',
FilesEmpty : 'The folder is empty.', // MISSING
FilesMoved : 'File %1 moved to %2:%3.', // MISSING
FilesCopied : 'File %1 copied to %2:%3.', // MISSING
// Basket
BasketFolder : 'Basket', // MISSING
BasketClear : 'Clear Basket', // MISSING
BasketRemove : 'Remove from Basket', // MISSING
BasketOpenFolder : 'Open Parent Folder', // MISSING
BasketTruncateConfirm : 'Do you really want to remove all files from the basket?', // MISSING
BasketRemoveConfirm : 'Do you really want to remove the file "%1" from the basket?', // MISSING
BasketEmpty : 'No files in the basket, drag and drop some.', // MISSING
BasketCopyFilesHere : 'Copy Files from Basket', // MISSING
BasketMoveFilesHere : 'Move Files from Basket', // MISSING
BasketPasteErrorOther : 'File %s error: %e', // MISSING
BasketPasteMoveSuccess : 'The following files were moved: %s', // MISSING
BasketPasteCopySuccess : 'The following files were copied: %s', // MISSING
// Toolbar Buttons (some used elsewhere)
Upload : 'Μεταφόρτωση',
UploadTip : 'Μεταφόρτωση Νέου Αρχείου',
Refresh : 'Ανανέωση',
Settings : 'Ρυθμίσεις',
Help : 'Βοήθεια',
HelpTip : 'Βοήθεια',
// Context Menus
Select : 'Επιλογή',
SelectThumbnail : 'Επιλογή Μικρογραφίας',
View : 'Προβολή',
Download : 'Λήψη Αρχείου',
NewSubFolder : 'Νέος Υποφάκελος',
Rename : 'Μετονομασία',
Delete : 'Διαγραφή',
CopyDragDrop : 'Copy File Here', // MISSING
MoveDragDrop : 'Move File Here', // MISSING
// Dialogs
RenameDlgTitle : 'Rename', // MISSING
NewNameDlgTitle : 'New Name', // MISSING
FileExistsDlgTitle : 'File Already Exists', // MISSING
SysErrorDlgTitle : 'System Error', // MISSING
FileOverwrite : 'Overwrite', // MISSING
FileAutorename : 'Auto-rename', // MISSING
// Generic
OkBtn : 'OK',
CancelBtn : 'Ακύρωση',
CloseBtn : 'Κλείσιμο',
// Upload Panel
UploadTitle : 'Μεταφόρτωση Νέου Αρχείου',
UploadSelectLbl : 'επιλέξτε το αρχείο που θέλετε να μεταφερθεί κάνοντας κλίκ στο κουμπί',
UploadProgressLbl : '(Η μεταφόρτωση εκτελείται, παρακαλούμε περιμένετε...)',
UploadBtn : 'Μεταφόρτωση Επιλεγμένου Αρχείου',
UploadBtnCancel : 'Ακύρωση',
UploadNoFileMsg : 'Παρακαλούμε επιλέξτε ένα αρχείο από τον υπολογιστή σας.',
UploadNoFolder : 'Please select a folder before uploading.', // MISSING
UploadNoPerms : 'File upload not allowed.', // MISSING
UploadUnknError : 'Error sending the file.', // MISSING
UploadExtIncorrect : 'File extension not allowed in this folder.', // MISSING
// Flash Uploads
UploadLabel : 'Files to Upload', // MISSING
UploadTotalFiles : 'Total Files:', // MISSING
UploadTotalSize : 'Total Size:', // MISSING
UploadAddFiles : 'Add Files', // MISSING
UploadClearFiles : 'Clear Files', // MISSING
UploadCancel : 'Cancel Upload', // MISSING
UploadRemove : 'Remove', // MISSING
UploadRemoveTip : 'Remove !f', // MISSING
UploadUploaded : 'Uploaded !n%', // MISSING
UploadProcessing : 'Processing...', // MISSING
// Settings Panel
SetTitle : 'Ρυθμίσεις',
SetView : 'Προβολή:',
SetViewThumb : 'Μικρογραφίες',
SetViewList : 'Λίστα',
SetDisplay : 'Εμφάνιση:',
SetDisplayName : 'Όνομα Αρχείου',
SetDisplayDate : 'Ημερομηνία',
SetDisplaySize : 'Μέγεθος Αρχείου',
SetSort : 'Ταξινόμηση:',
SetSortName : 'βάσει Όνοματος Αρχείου',
SetSortDate : 'βάσει Ημερομήνιας',
SetSortSize : 'βάσει Μεγέθους',
// Status Bar
FilesCountEmpty : '<Κενός Φάκελος>',
FilesCountOne : '1 αρχείο',
FilesCountMany : '%1 αρχεία',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'Η ενέργεια δεν ήταν δυνατόν να εκτελεστεί. (Σφάλμα %1)',
Errors :
{
10 : 'Λανθασμένη Εντολή.',
11 : 'Το resource type δεν ήταν δυνατόν να προσδιορίστεί.',
12 : 'Το resource type δεν είναι έγκυρο.',
102 : 'Το όνομα αρχείου ή φακέλου δεν είναι έγκυρο.',
103 : 'Δεν ήταν δυνατή η εκτέλεση της ενέργειας λόγω έλλειψης δικαιωμάτων ασφαλείας.',
104 : 'Δεν ήταν δυνατή η εκτέλεση της ενέργειας λόγω περιορισμών του συστήματος αρχείων.',
105 : 'Λανθασμένη Επέκταση Αρχείου.',
109 : 'Λανθασμένη Ενέργεια.',
110 : 'Άγνωστο Λάθος.',
115 : 'Το αρχείο ή φάκελος υπάρχει ήδη.',
116 : 'Ο φάκελος δεν βρέθηκε. Παρακαλούμε ανανεώστε τη σελίδα και προσπαθήστε ξανά.',
117 : 'Το αρχείο δεν βρέθηκε. Παρακαλούμε ανανεώστε τη σελίδα και προσπαθήστε ξανά.',
118 : 'Source and target paths are equal.', // MISSING
201 : 'Ένα αρχείο με την ίδια ονομασία υπάρχει ήδη. Το μεταφορτωμένο αρχείο μετονομάστηκε σε "%1".',
202 : 'Λανθασμένο Αρχείο.',
203 : 'Λανθασμένο Αρχείο. Το μέγεθος του αρχείου είναι πολύ μεγάλο.',
204 : 'Το μεταφορτωμένο αρχείο είναι χαλασμένο.',
205 : 'Δεν υπάρχει προσωρινός φάκελος για να χρησιμοποιηθεί για τις μεταφορτώσεις των αρχείων.',
206 : 'Η μεταφόρτωση ακυρώθηκε για λόγους ασφαλείας. Το αρχείο περιέχει δεδομένα μορφής HTML.',
207 : 'Το μεταφορτωμένο αρχείο μετονομάστηκε σε "%1".',
300 : 'Moving file(s) failed.', // MISSING
301 : 'Copying file(s) failed.', // MISSING
500 : 'Ο πλοηγός αρχείων έχει απενεργοποιηθεί για λόγους ασφαλείας. Παρακαλούμε επικοινωνήστε με τον διαχειριστή της ιστοσελίδας και ελέγξτε το αρχείο ρυθμίσεων του πλοηγού (CKFinder).',
501 : 'Η υποστήριξη των μικρογραφιών έχει απενεργοποιηθεί.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'Η ονομασία του αρχείου δεν μπορεί να είναι κενή.',
FileExists : 'File %s already exists.', // MISSING
FolderEmpty : 'Η ονομασία του φακέλου δεν μπορεί να είναι κενή.',
FileInvChar : 'Η ονομασία του αρχείου δεν μπορεί να περιέχει τους ακόλουθους χαρακτήρες: \n\\ / : * ? " < > |',
FolderInvChar : 'Η ονομασία του φακέλου δεν μπορεί να περιέχει τους ακόλουθους χαρακτήρες: \n\\ / : * ? " < > |',
PopupBlockView : 'Δεν ήταν εφικτό να ανοίξει το αρχείο σε νέο παράθυρο. Παρακαλώ, ελέγξτε τις ρυθμίσεις τους πλοηγού σας και απενεργοποιήστε όλους τους popup blockers για αυτή την ιστοσελίδα.',
XmlError : 'It was not possible to properly load the XML response from the web server.', // MISSING
XmlEmpty : 'It was not possible to load the XML response from the web server. The server returned an empty response.', // MISSING
XmlRawResponse : 'Raw response from the server: %s' // MISSING
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Resize %s', // MISSING
sizeTooBig : 'Cannot set image height or width to a value bigger than the original size (%size).', // MISSING
resizeSuccess : 'Image resized successfully.', // MISSING
thumbnailNew : 'Create a new thumbnail', // MISSING
thumbnailSmall : 'Small (%s)', // MISSING
thumbnailMedium : 'Medium (%s)', // MISSING
thumbnailLarge : 'Large (%s)', // MISSING
newSize : 'Set a new size', // MISSING
width : 'Πλάτος',
height : 'Ύψος',
invalidHeight : 'Invalid height.', // MISSING
invalidWidth : 'Invalid width.', // MISSING
invalidName : 'Invalid file name.', // MISSING
newImage : 'Create a new image', // MISSING
noExtensionChange : 'File extension cannot be changed.', // MISSING
imageSmall : 'Source image is too small.', // MISSING
contextMenuName : 'Resize', // MISSING
lockRatio : 'Κλείδωμα Αναλογίας',
resetSize : 'Επαναφορά Αρχικού Μεγέθους'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Αποθήκευση',
fileOpenError : 'Unable to open file.', // MISSING
fileSaveSuccess : 'File saved successfully.', // MISSING
contextMenuName : 'Edit', // MISSING
loadingFile : 'Loading file, please wait...' // MISSING
},
Maximize :
{
maximize : 'Maximize', // MISSING
minimize : 'Minimize' // MISSING
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Spanish
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['es'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, no disponible</span>',
confirmCancel : 'Algunas opciones se han cambiado\r\n¿Está seguro de querer cerrar el diálogo?',
ok : 'Aceptar',
cancel : 'Cancelar',
confirmationTitle : 'Confirmación',
messageTitle : 'Información',
inputTitle : 'Pregunta',
undo : 'Deshacer',
redo : 'Rehacer',
skip : 'Omitir',
skipAll : 'Omitir todos',
makeDecision : '¿Qué acción debe realizarse?',
rememberDecision: 'Recordar mi decisión'
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'es',
LangCode : 'es',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'dd/mm/yyyy H:MM',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'Carpetas',
FolderLoading : 'Cargando...',
FolderNew : 'Por favor, escriba el nombre para la nueva carpeta: ',
FolderRename : 'Por favor, escriba el nuevo nombre para la carpeta: ',
FolderDelete : '¿Está seguro de que quiere borrar la carpeta "%1"?',
FolderRenaming : ' (Renombrando...)',
FolderDeleting : ' (Borrando...)',
// Files
FileRename : 'Por favor, escriba el nuevo nombre del fichero: ',
FileRenameExt : '¿Está seguro de querer cambiar la extensión del fichero? El fichero puede dejar de ser usable.',
FileRenaming : 'Renombrando...',
FileDelete : '¿Está seguro de que quiere borrar el fichero "%1"?',
FilesLoading : 'Cargando...',
FilesEmpty : 'Carpeta vacía',
FilesMoved : 'Fichero %1 movido a %2:%3.',
FilesCopied : 'Fichero %1 copiado a %2:%3.',
// Basket
BasketFolder : 'Cesta',
BasketClear : 'Vaciar cesta',
BasketRemove : 'Quitar de la cesta',
BasketOpenFolder : 'Abrir carpeta padre',
BasketTruncateConfirm : '¿Está seguro de querer quitar todos los ficheros de la cesta?',
BasketRemoveConfirm : '¿Está seguro de querer quitar el fichero "%1" de la cesta?',
BasketEmpty : 'No hay ficheros en la cesta, arrastra y suelta algunos.',
BasketCopyFilesHere : 'Copiar ficheros de la cesta',
BasketMoveFilesHere : 'Mover ficheros de la cesta',
BasketPasteErrorOther : 'Fichero %s error: %e',
BasketPasteMoveSuccess : 'Los siguientes ficheros han sido movidos: %s',
BasketPasteCopySuccess : 'Los siguientes ficheros han sido copiados: %s',
// Toolbar Buttons (some used elsewhere)
Upload : 'Añadir',
UploadTip : 'Añadir nuevo fichero',
Refresh : 'Actualizar',
Settings : 'Configuración',
Help : 'Ayuda',
HelpTip : 'Ayuda',
// Context Menus
Select : 'Seleccionar',
SelectThumbnail : 'Seleccionar el icono',
View : 'Ver',
Download : 'Descargar',
NewSubFolder : 'Nueva Subcarpeta',
Rename : 'Renombrar',
Delete : 'Borrar',
CopyDragDrop : 'Copiar fichero aquí',
MoveDragDrop : 'Mover fichero aquí',
// Dialogs
RenameDlgTitle : 'Renombrar',
NewNameDlgTitle : 'Nuevo nombre',
FileExistsDlgTitle : 'Fichero existente',
SysErrorDlgTitle : 'Error de sistema',
FileOverwrite : 'Sobreescribir',
FileAutorename : 'Auto-renombrar',
// Generic
OkBtn : 'Aceptar',
CancelBtn : 'Cancelar',
CloseBtn : 'Cerrar',
// Upload Panel
UploadTitle : 'Añadir nuevo fichero',
UploadSelectLbl : 'Elija el fichero a subir',
UploadProgressLbl : '(Subida en progreso, por favor espere...)',
UploadBtn : 'Subir el fichero elegido',
UploadBtnCancel : 'Cancelar',
UploadNoFileMsg : 'Por favor, elija un fichero de su ordenador.',
UploadNoFolder : 'Por favor, escoja la carpeta antes de iniciar la subida.',
UploadNoPerms : 'No puede subir ficheros.',
UploadUnknError : 'Error enviando el fichero.',
UploadExtIncorrect : 'La extensión del fichero no está permitida en esta carpeta.',
// Flash Uploads
UploadLabel : 'Ficheros a subir',
UploadTotalFiles : 'Total de ficheros:',
UploadTotalSize : 'Tamaño total:',
UploadAddFiles : 'Añadir ficheros',
UploadClearFiles : 'Borrar ficheros',
UploadCancel : 'Cancelar subida',
UploadRemove : 'Quitar',
UploadRemoveTip : 'Quitar !f',
UploadUploaded : 'Enviado !n%',
UploadProcessing : 'Procesando...',
// Settings Panel
SetTitle : 'Configuración',
SetView : 'Vista:',
SetViewThumb : 'Iconos',
SetViewList : 'Lista',
SetDisplay : 'Mostrar:',
SetDisplayName : 'Nombre de fichero',
SetDisplayDate : 'Fecha',
SetDisplaySize : 'Peso del fichero',
SetSort : 'Ordenar:',
SetSortName : 'por Nombre',
SetSortDate : 'por Fecha',
SetSortSize : 'por Peso',
// Status Bar
FilesCountEmpty : '<Carpeta vacía>',
FilesCountOne : '1 fichero',
FilesCountMany : '%1 ficheros',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'No ha sido posible completar la solicitud. (Error %1)',
Errors :
{
10 : 'Comando incorrecto.',
11 : 'El tipo de recurso no ha sido especificado en la solicitud.',
12 : 'El tipo de recurso solicitado no es válido.',
102 : 'Nombre de fichero o carpeta no válido.',
103 : 'No se ha podido completar la solicitud debido a las restricciones de autorización.',
104 : 'No ha sido posible completar la solicitud debido a restricciones en el sistema de ficheros.',
105 : 'La extensión del archivo no es válida.',
109 : 'Petición inválida.',
110 : 'Error desconocido.',
115 : 'Ya existe un fichero o carpeta con ese nombre.',
116 : 'No se ha encontrado la carpeta. Por favor, actualice y pruebe de nuevo.',
117 : 'No se ha encontrado el fichero. Por favor, actualice la lista de ficheros y pruebe de nuevo.',
118 : 'Las rutas origen y destino son iguales.',
201 : 'Ya existía un fichero con ese nombre. El fichero subido ha sido renombrado como "%1".',
202 : 'Fichero inválido.',
203 : 'Fichero inválido. El peso es demasiado grande.',
204 : 'El fichero subido está corrupto.',
205 : 'La carpeta temporal no está disponible en el servidor para las subidas.',
206 : 'La subida se ha cancelado por razones de seguridad. El fichero contenía código HTML.',
207 : 'El fichero subido ha sido renombrado como "%1".',
300 : 'Ha fallado el mover el(los) fichero(s).',
301 : 'Ha fallado el copiar el(los) fichero(s).',
500 : 'El navegador de archivos está deshabilitado por razones de seguridad. Por favor, contacte con el administrador de su sistema y compruebe el fichero de configuración de CKFinder.',
501 : 'El soporte para iconos está deshabilitado.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'El nombre del fichero no puede estar vacío.',
FileExists : 'El fichero %s ya existe.',
FolderEmpty : 'El nombre de la carpeta no puede estar vacío.',
FileInvChar : 'El nombre del fichero no puede contener ninguno de los caracteres siguientes: \n\\ / : * ? " < > |',
FolderInvChar : 'El nombre de la carpeta no puede contener ninguno de los caracteres siguientes: \n\\ / : * ? " < > |',
PopupBlockView : 'No ha sido posible abrir el fichero en una nueva ventana. Por favor, configure su navegador y desactive todos los bloqueadores de ventanas para esta página.',
XmlError : 'No ha sido posible cargar correctamente la respuesta XML del servidor.',
XmlEmpty : 'No ha sido posible cargar correctamente la respuesta XML del servidor. El servidor envió una cadena vacía.',
XmlRawResponse : 'Respuesta del servidor: %s'
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Redimensionar %s',
sizeTooBig : 'No se puede poner la altura o anchura de la imagen mayor que las dimensiones originales (%size).',
resizeSuccess : 'Imagen redimensionada correctamente.',
thumbnailNew : 'Crear nueva minuatura',
thumbnailSmall : 'Pequeña (%s)',
thumbnailMedium : 'Mediana (%s)',
thumbnailLarge : 'Grande (%s)',
newSize : 'Establecer nuevo tamaño',
width : 'Ancho',
height : 'Alto',
invalidHeight : 'Altura inválida.',
invalidWidth : 'Anchura inválida.',
invalidName : 'Nombre no válido.',
newImage : 'Crear nueva imagen',
noExtensionChange : 'La extensión no se puede cambiar.',
imageSmall : 'La imagen original es demasiado pequeña.',
contextMenuName : 'Redimensionar',
lockRatio : 'Proporcional',
resetSize : 'Tamaño Original'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Guardar',
fileOpenError : 'No se puede abrir el fichero.',
fileSaveSuccess : 'Fichero guardado correctamente.',
contextMenuName : 'Editar',
loadingFile : 'Cargando fichero, por favor espere...'
},
Maximize :
{
maximize : 'Maximizar',
minimize : 'Minimizar'
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Finnish
* language. Translated into Finnish 2010-12-15 by Petteri Salmela,
* updated.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['fi'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, ei käytettävissä</span>',
confirmCancel : 'Valintoja on muutettu. Suljetaanko ikkuna kuitenkin?',
ok : 'OK',
cancel : 'Peru',
confirmationTitle : 'Varmistus',
messageTitle : 'Ilmoitus',
inputTitle : 'Kysymys',
undo : 'Peru',
redo : 'Tee uudelleen',
skip : 'Ohita',
skipAll : 'Ohita kaikki',
makeDecision : 'Mikä toiminto suoritetaan?',
rememberDecision: 'Muista valintani'
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'fi',
LangCode : 'fi',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'yyyy-mm-dd HH:MM',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'Kansiot',
FolderLoading : 'Lataan...',
FolderNew : 'Kirjoita uuden kansion nimi: ',
FolderRename : 'Kirjoita uusi nimi kansiolle ',
FolderDelete : 'Haluatko varmasti poistaa kansion "%1"?',
FolderRenaming : ' (Uudelleennimeää...)',
FolderDeleting : ' (Poistaa...)',
// Files
FileRename : 'Kirjoita uusi tiedostonimi: ',
FileRenameExt : 'Haluatko varmasti muuttaa tiedostotarkennetta? Tiedosto voi muuttua käyttökelvottomaksi.',
FileRenaming : 'Uudelleennimeää...',
FileDelete : 'Haluatko varmasti poistaa tiedoston "%1"?',
FilesLoading : 'Lataa...',
FilesEmpty : 'Tyhjä kansio.',
FilesMoved : 'Tiedosto %1 siirretty nimelle %2:%3.',
FilesCopied : 'Tiedosto %1 kopioitu nimelle %2:%3.',
// Basket
BasketFolder : 'Kori',
BasketClear : 'Tyhjennä kori',
BasketRemove : 'Poista korista',
BasketOpenFolder : 'Avaa ylemmän tason kansio',
BasketTruncateConfirm : 'Haluatko todella poistaa kaikki tiedostot korista?',
BasketRemoveConfirm : 'Haluatko todella poistaa tiedoston "%1" korista?',
BasketEmpty : 'Korissa ei ole tiedostoja. Lisää raahaamalla.',
BasketCopyFilesHere : 'Kopioi tiedostot korista.',
BasketMoveFilesHere : 'Siirrä tiedostot korista.',
BasketPasteErrorOther : 'Tiedoston %s virhe: %e.',
BasketPasteMoveSuccess : 'Seuraavat tiedostot siirrettiin: %s',
BasketPasteCopySuccess : 'Seuraavat tiedostot kopioitiin: %s',
// Toolbar Buttons (some used elsewhere)
Upload : 'Lataa palvelimelle',
UploadTip : 'Lataa uusi tiedosto palvelimelle',
Refresh : 'Päivitä',
Settings : 'Asetukset',
Help : 'Apua',
HelpTip : 'Apua',
// Context Menus
Select : 'Valitse',
SelectThumbnail : 'Valitse esikatselukuva',
View : 'Näytä',
Download : 'Lataa palvelimelta',
NewSubFolder : 'Uusi alikansio',
Rename : 'Uudelleennimeä ',
Delete : 'Poista',
CopyDragDrop : 'Kopioi tiedosto tähän',
MoveDragDrop : 'Siirrä tiedosto tähän',
// Dialogs
RenameDlgTitle : 'Nimeä uudelleen',
NewNameDlgTitle : 'Uusi nimi',
FileExistsDlgTitle : 'Tiedostonimi on jo olemassa!',
SysErrorDlgTitle : 'Järjestelmävirhe',
FileOverwrite : 'Ylikirjoita',
FileAutorename : 'Nimeä uudelleen automaattisesti',
// Generic
OkBtn : 'OK',
CancelBtn : 'Peru',
CloseBtn : 'Sulje',
// Upload Panel
UploadTitle : 'Lataa uusi tiedosto palvelimelle',
UploadSelectLbl : 'Valitse ladattava tiedosto',
UploadProgressLbl : '(Lataaminen palvelimelle käynnissä...)',
UploadBtn : 'Lataa valittu tiedosto palvelimelle',
UploadBtnCancel : 'Peru',
UploadNoFileMsg : 'Valitse tiedosto tietokoneeltasi.',
UploadNoFolder : 'Valitse kansio ennen palvelimelle lataamista.',
UploadNoPerms : 'Tiedoston lataaminen palvelimelle evätty.',
UploadUnknError : 'Tiedoston siirrossa tapahtui virhe.',
UploadExtIncorrect : 'Tiedostotarkenne ei ole sallittu valitussa kansiossa.',
// Flash Uploads
UploadLabel : 'Ladattavat tiedostot',
UploadTotalFiles : 'Tiedostoja yhteensä:',
UploadTotalSize : 'Yhteenlaskettu tiedostokoko:',
UploadAddFiles : 'Lisää tiedostoja',
UploadClearFiles : 'Poista tiedostot',
UploadCancel : 'Peru lataus',
UploadRemove : 'Poista',
UploadRemoveTip : 'Poista !f',
UploadUploaded : 'Ladattu !n%',
UploadProcessing : 'Käsittelee...',
// Settings Panel
SetTitle : 'Asetukset',
SetView : 'Näkymä:',
SetViewThumb : 'Esikatselukuvat',
SetViewList : 'Luettelo',
SetDisplay : 'Näytä:',
SetDisplayName : 'Tiedostonimi',
SetDisplayDate : 'Päivämäärä',
SetDisplaySize : 'Tiedostokoko',
SetSort : 'Lajittele:',
SetSortName : 'aakkosjärjestykseen',
SetSortDate : 'päivämäärän mukaan',
SetSortSize : 'tiedostokoon mukaan',
// Status Bar
FilesCountEmpty : '<Tyhjä kansio>',
FilesCountOne : '1 tiedosto',
FilesCountMany : '%1 tiedostoa',
// Size and Speed
Kb : '%1 kt',
KbPerSecond : '%1 kt/s',
// Connector Error Messages.
ErrorUnknown : 'Pyyntöä ei voitu suorittaa. (Virhe %1)',
Errors :
{
10 : 'Virheellinen komento.',
11 : 'Pyynnön resurssityyppi on määrittelemättä.',
12 : 'Pyynnön resurssityyppi on virheellinen.',
102 : 'Virheellinen tiedosto- tai kansionimi.',
103 : 'Oikeutesi eivät riitä pyynnön suorittamiseen.',
104 : 'Tiedosto-oikeudet eivät riitä pyynnön suorittamiseen.',
105 : 'Virheellinen tiedostotarkenne.',
109 : 'Virheellinen pyyntö.',
110 : 'Tuntematon virhe.',
115 : 'Samanniminen tiedosto tai kansio on jo olemassa.',
116 : 'Kansiota ei löydy. Yritä uudelleen kansiopäivityksen jälkeen.',
117 : 'Tiedostoa ei löydy. Yritä uudelleen kansiopäivityksen jälkeen.',
118 : 'Lähde- ja kohdekansio on sama!',
201 : 'Samanniminen tiedosto on jo olemassa. Palvelimelle ladattu tiedosto on nimetty: "%1".',
202 : 'Virheellinen tiedosto.',
203 : 'Virheellinen tiedosto. Tiedostokoko on liian suuri.',
204 : 'Palvelimelle ladattu tiedosto on vioittunut.',
205 : 'Väliaikaishakemistoa ei ole määritetty palvelimelle lataamista varten.',
206 : 'Palvelimelle lataaminen on peruttu turvallisuussyistä. Tiedosto sisältää HTML-tyylistä dataa.',
207 : 'Palvelimelle ladattu tiedosto on nimetty: "%1".',
300 : 'Tiedostosiirto epäonnistui.',
301 : 'Tiedostokopiointi epäonnistui.',
500 : 'Tiedostoselain on kytketty käytöstä turvallisuussyistä. Pyydä pääkäyttäjää tarkastamaan CKFinderin asetustiedosto.',
501 : 'Esikatselukuvien tuki on kytketty toiminnasta.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'Tiedosto on nimettävä!',
FileExists : 'Tiedosto %s on jo olemassa.',
FolderEmpty : 'Kansio on nimettävä!',
FileInvChar : 'Tiedostonimi ei voi sisältää seuraavia merkkejä: \n\\ / : * ? " < > |',
FolderInvChar : 'Kansionimi ei voi sisältää seuraavia merkkejä: \n\\ / : * ? " < > |',
PopupBlockView : 'Tiedostoa ei voitu avata uuteen ikkunaan. Salli selaimesi asetuksissa ponnahdusikkunat tälle sivulle.',
XmlError : 'It was not possible to properly load the XML response from the web server.', // MISSING
XmlEmpty : 'It was not possible to load the XML response from the web server. The server returned an empty response.', // MISSING
XmlRawResponse : 'Raw response from the server: %s' // MISSING
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Muuta kokoa %s',
sizeTooBig : 'Kuvan mittoja ei voi asettaa alkuperäistä suuremmiksi(%size).',
resizeSuccess : 'Kuvan koon muuttaminen onnistui.',
thumbnailNew : 'Luo uusi esikatselukuva.',
thumbnailSmall : 'Pieni (%s)',
thumbnailMedium : 'Keskikokoinen (%s)',
thumbnailLarge : 'Suuri (%s)',
newSize : 'Aseta uusi koko',
width : 'Leveys',
height : 'Korkeus',
invalidHeight : 'Viallinen korkeus.',
invalidWidth : 'Viallinen leveys.',
invalidName : 'Viallinen tiedostonimi.',
newImage : 'Luo uusi kuva',
noExtensionChange : 'Tiedostomäärettä ei voi vaihtaa.',
imageSmall : 'Lähdekuva on liian pieni.',
contextMenuName : 'Muuta kokoa',
lockRatio : 'Lukitse suhteet',
resetSize : 'Alkuperäinen koko'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Tallenna',
fileOpenError : 'Tiedostoa ei voi avata.',
fileSaveSuccess : 'Tiedoston tallennus onnistui.',
contextMenuName : 'Muokkaa',
loadingFile : 'Tiedostoa ladataan ...'
},
Maximize :
{
maximize : 'Suurenna',
minimize : 'Pienennä'
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Norwegian
* Nynorsk language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['no'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, utilgjenglig</span>',
confirmCancel : 'Noen av valgene har blitt endret. Er du sikker på at du vil lukke dialogen?',
ok : 'OK',
cancel : 'Avbryt',
confirmationTitle : 'Confirmation', // MISSING
messageTitle : 'Information', // MISSING
inputTitle : 'Question', // MISSING
undo : 'Angre',
redo : 'Gjør om',
skip : 'Skip', // MISSING
skipAll : 'Skip all', // MISSING
makeDecision : 'What action should be taken?', // MISSING
rememberDecision: 'Remember my decision' // MISSING
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'en',
LangCode : 'no',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'dd/mm/yyyy HH:MM',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'Mapper',
FolderLoading : 'Laster...',
FolderNew : 'Skriv inn det nye mappenavnet: ',
FolderRename : 'Skriv inn det nye mappenavnet: ',
FolderDelete : 'Er du sikker på at du vil slette mappen "%1"?',
FolderRenaming : ' (Endrer mappenavn...)',
FolderDeleting : ' (Sletter...)',
// Files
FileRename : 'Skriv inn det nye filnavnet: ',
FileRenameExt : 'Er du sikker på at du vil endre filtypen? Filen kan bli ubrukelig.',
FileRenaming : 'Endrer filnavn...',
FileDelete : 'Er du sikker på at du vil slette denne filen "%1"?',
FilesLoading : 'Laster...',
FilesEmpty : 'The folder is empty.', // MISSING
FilesMoved : 'File %1 moved to %2:%3.', // MISSING
FilesCopied : 'File %1 copied to %2:%3.', // MISSING
// Basket
BasketFolder : 'Basket', // MISSING
BasketClear : 'Clear Basket', // MISSING
BasketRemove : 'Remove from Basket', // MISSING
BasketOpenFolder : 'Open Parent Folder', // MISSING
BasketTruncateConfirm : 'Do you really want to remove all files from the basket?', // MISSING
BasketRemoveConfirm : 'Do you really want to remove the file "%1" from the basket?', // MISSING
BasketEmpty : 'No files in the basket, drag and drop some.', // MISSING
BasketCopyFilesHere : 'Copy Files from Basket', // MISSING
BasketMoveFilesHere : 'Move Files from Basket', // MISSING
BasketPasteErrorOther : 'File %s error: %e', // MISSING
BasketPasteMoveSuccess : 'The following files were moved: %s', // MISSING
BasketPasteCopySuccess : 'The following files were copied: %s', // MISSING
// Toolbar Buttons (some used elsewhere)
Upload : 'Last opp',
UploadTip : 'Last opp en ny fil',
Refresh : 'Oppdater',
Settings : 'Innstillinger',
Help : 'Hjelp',
HelpTip : 'Hjelp finnes kun på engelsk',
// Context Menus
Select : 'Velg',
SelectThumbnail : 'Velg Miniatyr',
View : 'Vis fullversjon',
Download : 'Last ned',
NewSubFolder : 'Ny Undermappe',
Rename : 'Endre navn',
Delete : 'Slett',
CopyDragDrop : 'Copy File Here', // MISSING
MoveDragDrop : 'Move File Here', // MISSING
// Dialogs
RenameDlgTitle : 'Rename', // MISSING
NewNameDlgTitle : 'New Name', // MISSING
FileExistsDlgTitle : 'File Already Exists', // MISSING
SysErrorDlgTitle : 'System Error', // MISSING
FileOverwrite : 'Overwrite', // MISSING
FileAutorename : 'Auto-rename', // MISSING
// Generic
OkBtn : 'OK',
CancelBtn : 'Avbryt',
CloseBtn : 'Lukk',
// Upload Panel
UploadTitle : 'Last opp ny fil',
UploadSelectLbl : 'Velg filen du vil laste opp',
UploadProgressLbl : '(Laster opp filen, vennligst vent...)',
UploadBtn : 'Last opp valgt fil',
UploadBtnCancel : 'Avbryt',
UploadNoFileMsg : 'Du må velge en fil fra din datamaskin',
UploadNoFolder : 'Please select a folder before uploading.', // MISSING
UploadNoPerms : 'File upload not allowed.', // MISSING
UploadUnknError : 'Error sending the file.', // MISSING
UploadExtIncorrect : 'File extension not allowed in this folder.', // MISSING
// Flash Uploads
UploadLabel : 'Files to Upload', // MISSING
UploadTotalFiles : 'Total Files:', // MISSING
UploadTotalSize : 'Total Size:', // MISSING
UploadAddFiles : 'Add Files', // MISSING
UploadClearFiles : 'Clear Files', // MISSING
UploadCancel : 'Cancel Upload', // MISSING
UploadRemove : 'Remove', // MISSING
UploadRemoveTip : 'Remove !f', // MISSING
UploadUploaded : 'Uploaded !n%', // MISSING
UploadProcessing : 'Processing...', // MISSING
// Settings Panel
SetTitle : 'Innstillinger',
SetView : 'Filvisning:',
SetViewThumb : 'Miniatyrbilder',
SetViewList : 'Liste',
SetDisplay : 'Vis:',
SetDisplayName : 'Filnavn',
SetDisplayDate : 'Dato',
SetDisplaySize : 'Filstørrelse',
SetSort : 'Sorter etter:',
SetSortName : 'Filnavn',
SetSortDate : 'Dato',
SetSortSize : 'Størrelse',
// Status Bar
FilesCountEmpty : '<Tom Mappe>',
FilesCountOne : '1 fil',
FilesCountMany : '%1 filer',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'Det var ikke mulig å utføre forespørselen. (Feil %1)',
Errors :
{
10 : 'Ugyldig kommando.',
11 : 'Ressurstypen ble ikke spesifisert i forepørselen.',
12 : 'Ugyldig ressurstype.',
102 : 'Ugyldig fil- eller mappenavn.',
103 : 'Kunne ikke utføre forespørselen pga manglende autorisasjon.',
104 : 'Kunne ikke utføre forespørselen pga manglende tilgang til filsystemet.',
105 : 'Ugyldig filtype.',
109 : 'Ugyldig forespørsel.',
110 : 'Ukjent feil.',
115 : 'Det finnes allerede en fil eller mappe med dette navnet.',
116 : 'Kunne ikke finne mappen. Oppdater vinduet og prøv igjen.',
117 : 'Kunne ikke finne filen. Oppdater vinduet og prøv igjen.',
118 : 'Source and target paths are equal.', // MISSING
201 : 'Det fantes allerede en fil med dette navnet. Den opplastede filens navn har blitt endret til "%1".',
202 : 'Ugyldig fil.',
203 : 'Ugyldig fil. Filen er for stor.',
204 : 'Den opplastede filen er korrupt.',
205 : 'Det finnes ingen midlertidig mappe for filopplastinger.',
206 : 'Opplastingen ble avbrutt av sikkerhetshensyn. Filen inneholder HTML-aktig data.',
207 : 'Den opplastede filens navn har blitt endret til "%1".',
300 : 'Moving file(s) failed.', // MISSING
301 : 'Copying file(s) failed.', // MISSING
500 : 'Filvelgeren ikke tilgjengelig av sikkerhetshensyn. Kontakt systemansvarlig og be han sjekke CKFinder\'s konfigurasjonsfil.',
501 : 'Funksjon for minityrbilder er skrudd av.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'Filnavnet kan ikke være tomt.',
FileExists : 'File %s already exists.', // MISSING
FolderEmpty : 'Mappenavnet kan ikke være tomt.',
FileInvChar : 'Filnavnet kan ikke inneholde følgende tegn: \n\\ / : * ? " < > |',
FolderInvChar : 'Mappenavnet kan ikke inneholde følgende tegn: \n\\ / : * ? " < > |',
PopupBlockView : 'Du må skru av popup-blockeren for å se bildet i nytt vindu.',
XmlError : 'It was not possible to properly load the XML response from the web server.', // MISSING
XmlEmpty : 'It was not possible to load the XML response from the web server. The server returned an empty response.', // MISSING
XmlRawResponse : 'Raw response from the server: %s' // MISSING
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Resize %s', // MISSING
sizeTooBig : 'Cannot set image height or width to a value bigger than the original size (%size).', // MISSING
resizeSuccess : 'Image resized successfully.', // MISSING
thumbnailNew : 'Create a new thumbnail', // MISSING
thumbnailSmall : 'Small (%s)', // MISSING
thumbnailMedium : 'Medium (%s)', // MISSING
thumbnailLarge : 'Large (%s)', // MISSING
newSize : 'Set a new size', // MISSING
width : 'Bredde',
height : 'Høyde',
invalidHeight : 'Invalid height.', // MISSING
invalidWidth : 'Invalid width.', // MISSING
invalidName : 'Invalid file name.', // MISSING
newImage : 'Create a new image', // MISSING
noExtensionChange : 'File extension cannot be changed.', // MISSING
imageSmall : 'Source image is too small.', // MISSING
contextMenuName : 'Resize', // MISSING
lockRatio : 'Lås forhold',
resetSize : 'Tilbakestill størrelse'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Lagre',
fileOpenError : 'Unable to open file.', // MISSING
fileSaveSuccess : 'File saved successfully.', // MISSING
contextMenuName : 'Edit', // MISSING
loadingFile : 'Loading file, please wait...' // MISSING
},
Maximize :
{
maximize : 'Maksimer',
minimize : 'Minimer'
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Persian
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['fa'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, غیر قابل دسترس</span>',
confirmCancel : 'برخی از گزینهها تغییر یافتهاند. آیا مطمئن هستید که قصد بستن این پنجره را دارید؟',
ok : 'قبول',
cancel : 'لغو',
confirmationTitle : 'تأییدیه',
messageTitle : 'اطلاعات',
inputTitle : 'پرسش',
undo : 'واچیدن',
redo : 'دوباره چیدن',
skip : 'عبور',
skipAll : 'عبور از همه',
makeDecision : 'چه تصمیمی خواهید گرفت؟',
rememberDecision: 'یادآوری تصمیم من'
},
// Language direction, 'ltr' or 'rtl'.
dir : 'rtl',
HelpLang : 'en',
LangCode : 'fa',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'yyyy/mm/dd h:MM aa',
DateAmPm : ['ق.ظ', 'ب.ظ'],
// Folders
FoldersTitle : 'پوشهها',
FolderLoading : 'بارگیری...',
FolderNew : 'لطفا نام پوشه جدید را درج کنید: ',
FolderRename : 'لطفا نام پوشه جدید را درج کنید: ',
FolderDelete : 'آیا اطمینان دارید که قصد حذف کردن پوشه "%1" را دارید؟',
FolderRenaming : ' (در حال تغییر نام...)',
FolderDeleting : ' (در حال حذف...)',
// Files
FileRename : 'لطفا نام جدید فایل را درج کنید: ',
FileRenameExt : 'آیا اطمینان دارید که قصد تغییر نام پسوند این فایل را دارید؟ ممکن است فایل غیر قابل استفاده شود',
FileRenaming : 'در حال تغییر نام...',
FileDelete : 'آیا اطمینان دارید که قصد حذف نمودن فایل "%1" را دارید؟',
FilesLoading : 'بارگیری...',
FilesEmpty : 'این پوشه خالی است',
FilesMoved : 'فایل %1 به مسیر %2:%3 منتقل شد.',
FilesCopied : 'فایل %1 در مسیر %2:%3 کپی شد.',
// Basket
BasketFolder : 'سبد',
BasketClear : 'پاک کردن سبد',
BasketRemove : 'حذف از سبد',
BasketOpenFolder : 'باز نمودن پوشه والد',
BasketTruncateConfirm : 'آیا واقعا قصد جابجا کردن همه فایلها از سبد را دارید؟',
BasketRemoveConfirm : 'آیا واقعا قصد جابجایی فایل "%1" از سبد را دارید؟',
BasketEmpty : 'هیچ فایلی در سبد نیست، یکی را بکشید و رها کنید.',
BasketCopyFilesHere : 'کپی فایلها از سبد',
BasketMoveFilesHere : 'جابجایی فایلها از سبد',
BasketPasteErrorOther : 'خطای فایل %s: %e',
BasketPasteMoveSuccess : 'فایلهای مقابل جابجا شدند: %s',
BasketPasteCopySuccess : 'این فایلها کپی شدند: %s',
// Toolbar Buttons (some used elsewhere)
Upload : 'آپلود',
UploadTip : 'آپلود فایل جدید',
Refresh : 'بروزرسانی',
Settings : 'تنظیمات',
Help : 'راهنما',
HelpTip : 'راهنما',
// Context Menus
Select : 'انتخاب',
SelectThumbnail : 'انتخاب انگشتی',
View : 'نمایش',
Download : 'دانلود',
NewSubFolder : 'زیرپوشه جدید',
Rename : 'تغییر نام',
Delete : 'حذف',
CopyDragDrop : 'کپی فایل به اینجا',
MoveDragDrop : 'انتقال فایل به اینجا',
// Dialogs
RenameDlgTitle : 'تغییر نام',
NewNameDlgTitle : 'نام جدید',
FileExistsDlgTitle : 'فایل از قبل وجود دارد',
SysErrorDlgTitle : 'خطای سیستم',
FileOverwrite : 'رونویسی',
FileAutorename : 'تغییر نام خودکار',
// Generic
OkBtn : 'قبول',
CancelBtn : 'لغو',
CloseBtn : 'بستن',
// Upload Panel
UploadTitle : 'آپلود فایل جدید',
UploadSelectLbl : 'انتخاب فابل برای آپلود',
UploadProgressLbl : '(آپلود در حال انجام است، لطفا صبر کنید...)',
UploadBtn : 'آپلود فایل انتخاب شده',
UploadBtnCancel : 'لغو',
UploadNoFileMsg : 'لطفا یک فایل از رایانه خود انتخاب کنید',
UploadNoFolder : 'لطفا پیش از آپلود کردن یک پوشه انتخاب کنید.',
UploadNoPerms : 'آپلود فایل مجاز نیست.',
UploadUnknError : 'در حال ارسال خطای فایل.',
UploadExtIncorrect : 'پسوند فایل برای این پوشه مجاز نیست.',
// Flash Uploads
UploadLabel : 'فایل برای آپلود',
UploadTotalFiles : 'مجموع فایلها:',
UploadTotalSize : 'مجموع حجم:',
UploadAddFiles : 'افزودن فایلها',
UploadClearFiles : 'پاک کردن فایلها',
UploadCancel : 'لغو آپلود',
UploadRemove : 'جابجا نمودن',
UploadRemoveTip : '!f جابجایی',
UploadUploaded : '!n% آپلود شد',
UploadProcessing : 'در حال پردازش...',
// Settings Panel
SetTitle : 'تنظیمات',
SetView : 'نمایش:',
SetViewThumb : 'انگشتیها',
SetViewList : 'فهرست',
SetDisplay : 'نمایش:',
SetDisplayName : 'نام فایل',
SetDisplayDate : 'تاریخ',
SetDisplaySize : 'اندازه فایل',
SetSort : 'مرتبسازی:',
SetSortName : 'با نام فایل',
SetSortDate : 'با تاریخ',
SetSortSize : 'با اندازه',
// Status Bar
FilesCountEmpty : '<پوشه خالی>',
FilesCountOne : '1 فایل',
FilesCountMany : '%1 فایل',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'امکان تکمیل درخواست وجود ندارد. (خطا %1)',
Errors :
{
10 : 'دستور نامعتبر.',
11 : 'نوع منبع در درخواست تعریف نشده است.',
12 : 'نوع منبع درخواست شده معتبر نیست.',
102 : 'نام فایل یا پوشه نامعتبر است.',
103 : 'امکان اجرای درخواست تا زمانیکه محدودیت مجوز وجود دارد، مقدور نیست.',
104 : 'امکان اجرای درخواست تا زمانیکه محدودیت مجوز سیستمی فایل وجود دارد،\u200bمقدور نیست.',
105 : 'پسوند فایل نامعتبر.',
109 : 'درخواست نامعتبر.',
110 : 'خطای ناشناخته.',
115 : 'یک فایل یا پوشه با همین نام از قبل وجود دارد.',
116 : 'پوشه یافت نشد. لطفا بروزرسانی کرده و مجددا تلاش کنید.',
117 : 'فایل یافت نشد. لطفا فهرست فایلها را بروزرسانی کرده و مجددا تلاش کنید.',
118 : 'منبع و مقصد مسیر یکی است.',
201 : 'یک فایل با همان نام از قبل موجود است. فایل آپلود شده به "%1" تغییر نام یافت.',
202 : 'فایل نامعتبر',
203 : 'فایل نامعتبر. اندازه فایل بیش از حد بزرگ است.',
204 : 'فایل آپلود شده خراب است.',
205 : 'هیچ پوشه موقتی برای آپلود فایل در سرور موجود نیست.',
206 : 'آپلود به دلایل امنیتی متوقف شد. فایل محتوی اطلاعات HTML است.',
207 : 'فایل آپلود شده به "%1" تغییر نام یافت.',
300 : 'جابجایی فایل(ها) ناموفق ماند.',
301 : 'کپی کردن فایل(ها) ناموفق ماند.',
500 : 'مرورگر فایل به دلایل امنیتی غیر فعال است. لطفا با مدیر سامانه تماس بگیرید تا تنظیمات این بخش را بررسی نماید.',
501 : 'پشتیبانی انگشتیها غیر فعال است.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'نام فایل نمیتواند خالی باشد',
FileExists : 'فایل %s از قبل وجود دارد',
FolderEmpty : 'نام پوشه نمیتواند خالی باشد',
FileInvChar : 'نام فایل نمیتواند دارای نویسههای مقابل باشد: \n\\ / : * ? " < > |',
FolderInvChar : 'نام پوشه نمیتواند دارای نویسههای مقابل باشد: \n\\ / : * ? " < > |',
PopupBlockView : 'امکان بازگشایی فایل در پنجره جدید نیست. لطفا به بخش تنظیمات مرورگر خود مراجعه کنید و امکان بازگشایی پنجرههای بازشور را برای این سایت فعال کنید.',
XmlError : 'امکان بارگیری صحیح پاسخ XML از سرور مقدور نیست.',
XmlEmpty : 'امکان بارگیری صحیح پاسخ XML از سرور مقدور نیست. سرور پاسخ خالی بر میگرداند.',
XmlRawResponse : 'پاسخ اولیه از سرور: %s'
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'تغییر اندازه %s',
sizeTooBig : 'امکان تغییر مقادیر ابعاد طول و عرض تصویر به مقداری بیش از ابعاد اصلی ممکن نیست (%size).',
resizeSuccess : 'تصویر با موفقیت تغییر اندازه یافت.',
thumbnailNew : 'ایجاد انگشتی جدید',
thumbnailSmall : 'کوچک (%s)',
thumbnailMedium : 'متوسط (%s)',
thumbnailLarge : 'بزرگ (%s)',
newSize : 'تنظیم اندازه جدید',
width : 'پهنا',
height : 'ارتفاع',
invalidHeight : 'ارتفاع نامعتبر.',
invalidWidth : 'پهنا نامعتبر.',
invalidName : 'نام فایل نامعتبر.',
newImage : 'ایجاد تصویر جدید',
noExtensionChange : 'نام پسوند فایل نمیتواند تغییر کند.',
imageSmall : 'تصویر اصلی خیلی کوچک است',
contextMenuName : 'تغییر اندازه',
lockRatio : 'قفل کردن تناسب.',
resetSize : 'بازنشانی اندازه.'
},
// Fileeditor plugin
Fileeditor :
{
save : 'ذخیره',
fileOpenError : 'قادر به گشودن فایل نیست.',
fileSaveSuccess : 'فایل با موفقیت ذخیره شد.',
contextMenuName : 'ویرایش',
loadingFile : 'در حال بارگیری فایل، لطفا صبر کنید...'
},
Maximize :
{
maximize : 'حداکثر نمودن',
minimize : 'حداقل نمودن'
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Estonian
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['et'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, pole saadaval</span>',
confirmCancel : 'Mõned valikud on muudetud. Kas oled kindel, et tahad dialoogiakna sulgeda?',
ok : 'Olgu',
cancel : 'Loobu',
confirmationTitle : 'Kinnitus',
messageTitle : 'Andmed',
inputTitle : 'Küsimus',
undo : 'Võta tagasi',
redo : 'Tee uuesti',
skip : 'Jäta vahele',
skipAll : 'Jäta kõik vahele',
makeDecision : 'Mida tuleks teha?',
rememberDecision: 'Jäta valik meelde'
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'en',
LangCode : 'et',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'yyyy-mm-dd H:MM',
DateAmPm : ['EL', 'PL'],
// Folders
FoldersTitle : 'Kaustad',
FolderLoading : 'Laadimine...',
FolderNew : 'Palun sisesta uue kataloogi nimi: ',
FolderRename : 'Palun sisesta uue kataloogi nimi: ',
FolderDelete : 'Kas tahad kindlasti kausta "%1" kustutada?',
FolderRenaming : ' (ümbernimetamine...)',
FolderDeleting : ' (kustutamine...)',
// Files
FileRename : 'Palun sisesta faili uus nimi: ',
FileRenameExt : 'Kas oled kindel, et tahad faili laiendit muuta? Fail võib muutuda kasutamatuks.',
FileRenaming : 'Ümbernimetamine...',
FileDelete : 'Kas oled kindel, et tahad kustutada faili "%1"?',
FilesLoading : 'Laadimine...',
FilesEmpty : 'See kaust on tühi.',
FilesMoved : 'Fail %1 liigutati kohta %2:%3.',
FilesCopied : 'Fail %1 kopeeriti kohta %2:%3.',
// Basket
BasketFolder : 'Korv',
BasketClear : 'Tühjenda korv',
BasketRemove : 'Eemalda korvist',
BasketOpenFolder : 'Ava ülemine kaust',
BasketTruncateConfirm : 'Kas tahad tõesti eemaldada korvist kõik failid?',
BasketRemoveConfirm : 'Kas tahad tõesti eemaldada korvist faili "%1"?',
BasketEmpty : 'Korvis ei ole ühtegi faili, lohista mõni siia.',
BasketCopyFilesHere : 'Failide kopeerimine korvist',
BasketMoveFilesHere : 'Failide liigutamine korvist',
BasketPasteErrorOther : 'Faili %s viga: %e',
BasketPasteMoveSuccess : 'Järgnevad failid liigutati: %s',
BasketPasteCopySuccess : 'Järgnevad failid kopeeriti: %s',
// Toolbar Buttons (some used elsewhere)
Upload : 'Laadi üles',
UploadTip : 'Laadi üles uus fail',
Refresh : 'Värskenda',
Settings : 'Sätted',
Help : 'Abi',
HelpTip : 'Abi',
// Context Menus
Select : 'Vali',
SelectThumbnail : 'Vali pisipilt',
View : 'Kuva',
Download : 'Laadi alla',
NewSubFolder : 'Uus alamkaust',
Rename : 'Nimeta ümber',
Delete : 'Kustuta',
CopyDragDrop : 'Kopeeri fail siia',
MoveDragDrop : 'Liiguta fail siia',
// Dialogs
RenameDlgTitle : 'Ümbernimetamine',
NewNameDlgTitle : 'Uue nime andmine',
FileExistsDlgTitle : 'Fail on juba olemas',
SysErrorDlgTitle : 'Süsteemi viga',
FileOverwrite : 'Kirjuta üle',
FileAutorename : 'Nimeta automaatselt ümber',
// Generic
OkBtn : 'Olgu',
CancelBtn : 'Loobu',
CloseBtn : 'Sulge',
// Upload Panel
UploadTitle : 'Uue faili üleslaadimine',
UploadSelectLbl : 'Vali üleslaadimiseks fail',
UploadProgressLbl : '(Üleslaadimine, palun oota...)',
UploadBtn : 'Laadi valitud fail üles',
UploadBtnCancel : 'Loobu',
UploadNoFileMsg : 'Palun vali fail oma arvutist.',
UploadNoFolder : 'Palun vali enne üleslaadimist kataloog.',
UploadNoPerms : 'Failide üleslaadimine pole lubatud.',
UploadUnknError : 'Viga faili saatmisel.',
UploadExtIncorrect : 'Selline faili laiend pole selles kaustas lubatud.',
// Flash Uploads
UploadLabel : 'Üleslaaditavad failid',
UploadTotalFiles : 'Faile kokku:',
UploadTotalSize : 'Kogusuurus:',
UploadAddFiles : 'Lisa faile',
UploadClearFiles : 'Eemalda failid',
UploadCancel : 'Katkesta üleslaadimine',
UploadRemove : 'Eemalda',
UploadRemoveTip : 'Eemalda !f',
UploadUploaded : '!n% üles laaditud',
UploadProcessing : 'Töötlemine...',
// Settings Panel
SetTitle : 'Sätted',
SetView : 'Vaade:',
SetViewThumb : 'Pisipildid',
SetViewList : 'Loend',
SetDisplay : 'Kuva:',
SetDisplayName : 'Faili nimi',
SetDisplayDate : 'Kuupäev',
SetDisplaySize : 'Faili suurus',
SetSort : 'Sortimine:',
SetSortName : 'faili nime järgi',
SetSortDate : 'kuupäeva järgi',
SetSortSize : 'suuruse järgi',
// Status Bar
FilesCountEmpty : '<tühi kaust>',
FilesCountOne : '1 fail',
FilesCountMany : '%1 faili',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'Päringu täitmine ei olnud võimalik. (Viga %1)',
Errors :
{
10 : 'Vigane käsk.',
11 : 'Allika liik ei olnud päringus määratud.',
12 : 'Päritud liik ei ole sobiv.',
102 : 'Sobimatu faili või kausta nimi.',
103 : 'Piiratud õiguste tõttu ei olnud võimalik päringut lõpetada.',
104 : 'Failisüsteemi piiratud õiguste tõttu ei olnud võimalik päringut lõpetada.',
105 : 'Sobimatu faililaiend.',
109 : 'Vigane päring.',
110 : 'Tundmatu viga.',
115 : 'Sellenimeline fail või kaust on juba olemas.',
116 : 'Kausta ei leitud. Palun värskenda lehte ja proovi uuesti.',
117 : 'Faili ei leitud. Palun värskenda lehte ja proovi uuesti.',
118 : 'Lähte- ja sihtasukoht on sama.',
201 : 'Samanimeline fail on juba olemas. Üles laaditud faili nimeks pandi "%1".',
202 : 'Vigane fail.',
203 : 'Vigane fail. Fail on liiga suur.',
204 : 'Üleslaaditud fail on rikutud.',
205 : 'Serverisse üleslaadimiseks pole ühtegi ajutiste failide kataloogi.',
206 : 'Üleslaadimine katkestati turvakaalutlustel. Fail sisaldab HTMLi sarnaseid andmeid.',
207 : 'Üleslaaditud faili nimeks pandi "%1".',
300 : 'Faili(de) liigutamine nurjus.',
301 : 'Faili(de) kopeerimine nurjus.',
500 : 'Failide sirvija on turvakaalutlustel keelatud. Palun võta ühendust oma süsteemi administraatoriga ja kontrolli CKFinderi seadistusfaili.',
501 : 'Pisipiltide tugi on keelatud.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'Faili nimi ei tohi olla tühi.',
FileExists : 'Fail nimega %s on juba olemas.',
FolderEmpty : 'Kausta nimi ei tohi olla tühi.',
FileInvChar : 'Faili nimi ei tohi sisaldada ühtegi järgnevatest märkidest: \n\\ / : * ? " < > |',
FolderInvChar : 'Faili nimi ei tohi sisaldada ühtegi järgnevatest märkidest: \n\\ / : * ? " < > |',
PopupBlockView : 'Faili avamine uues aknas polnud võimalik. Palun seadista oma brauserit ning keela kõik hüpikakende blokeerijad selle saidi jaoks.',
XmlError : 'XML vastust veebiserverist polnud võimalik korrektselt laadida.',
XmlEmpty : 'XML vastust veebiserverist polnud võimalik korrektselt laadida. Serveri vastus oli tühi.',
XmlRawResponse : 'Serveri vastus toorkujul: %s'
},
// Imageresize plugin
Imageresize :
{
dialogTitle : '%s suuruse muutmine',
sizeTooBig : 'Pildi kõrgust ega laiust ei saa määrata suuremaks pildi esialgsest vastavast mõõtmest (%size).',
resizeSuccess : 'Pildi suuruse muutmine õnnestus.',
thumbnailNew : 'Tee uus pisipilt',
thumbnailSmall : 'Väike (%s)',
thumbnailMedium : 'Keskmine (%s)',
thumbnailLarge : 'Suur (%s)',
newSize : 'Määra uus suurus',
width : 'Laius',
height : 'Kõrgus',
invalidHeight : 'Sobimatu kõrgus.',
invalidWidth : 'Sobimatu laius.',
invalidName : 'Sobimatu faili nimi.',
newImage : 'Loo uus pilt',
noExtensionChange : 'Faili laiendit pole võimalik muuta.',
imageSmall : 'Lähtepilt on liiga väike.',
contextMenuName : 'Muuda suurust',
lockRatio : 'Lukusta külgede suhe',
resetSize : 'Lähtesta suurus'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Salvesta',
fileOpenError : 'Faili avamine pole võimalik.',
fileSaveSuccess : 'Faili salvestamine õnnestus.',
contextMenuName : 'Muuda',
loadingFile : 'Faili laadimine, palun oota...'
},
Maximize :
{
maximize : 'Maksimeeri',
minimize : 'Minimeeri'
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Latvian
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['lv'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, unavailable</span>', // MISSING
confirmCancel : 'Some of the options were changed. Are you sure you want to close the dialog window?', // MISSING
ok : 'Darīts!',
cancel : 'Atcelt',
confirmationTitle : 'Confirmation', // MISSING
messageTitle : 'Information', // MISSING
inputTitle : 'Question', // MISSING
undo : 'Atcelt',
redo : 'Atkārtot',
skip : 'Skip', // MISSING
skipAll : 'Skip all', // MISSING
makeDecision : 'What action should be taken?', // MISSING
rememberDecision: 'Remember my decision' // MISSING
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'en',
LangCode : 'lv',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'dd/mm/yyyy H:MM',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'Mapes',
FolderLoading : 'Ielādē...',
FolderNew : 'Lūdzu ierakstiet mapes nosaukumu: ',
FolderRename : 'Lūdzu ierakstiet jauno mapes nosaukumu: ',
FolderDelete : 'Vai tiešām vēlaties neatgriezeniski dzēst mapi "%1"?',
FolderRenaming : ' (Pārsauc...)',
FolderDeleting : ' (Dzēš...)',
// Files
FileRename : 'Lūdzu ierakstiet jauno faila nosaukumu: ',
FileRenameExt : 'Vai tiešām vēlaties mainīt faila paplašinājumu? Fails var palikt nelietojams.',
FileRenaming : 'Pārsauc...',
FileDelete : 'Vai tiešām vēlaties neatgriezeniski dzēst failu "%1"?',
FilesLoading : 'Ielādē...',
FilesEmpty : 'The folder is empty.', // MISSING
FilesMoved : 'File %1 moved to %2:%3.', // MISSING
FilesCopied : 'File %1 copied to %2:%3.', // MISSING
// Basket
BasketFolder : 'Basket', // MISSING
BasketClear : 'Clear Basket', // MISSING
BasketRemove : 'Remove from Basket', // MISSING
BasketOpenFolder : 'Open Parent Folder', // MISSING
BasketTruncateConfirm : 'Do you really want to remove all files from the basket?', // MISSING
BasketRemoveConfirm : 'Do you really want to remove the file "%1" from the basket?', // MISSING
BasketEmpty : 'No files in the basket, drag and drop some.', // MISSING
BasketCopyFilesHere : 'Copy Files from Basket', // MISSING
BasketMoveFilesHere : 'Move Files from Basket', // MISSING
BasketPasteErrorOther : 'File %s error: %e', // MISSING
BasketPasteMoveSuccess : 'The following files were moved: %s', // MISSING
BasketPasteCopySuccess : 'The following files were copied: %s', // MISSING
// Toolbar Buttons (some used elsewhere)
Upload : 'Augšupielādēt',
UploadTip : 'Augšupielādēt jaunu failu',
Refresh : 'Pārlādēt',
Settings : 'Uzstādījumi',
Help : 'Palīdzība',
HelpTip : 'Palīdzība',
// Context Menus
Select : 'Izvēlēties',
SelectThumbnail : 'Izvēlēties sīkbildi',
View : 'Skatīt',
Download : 'Lejupielādēt',
NewSubFolder : 'Jauna apakšmape',
Rename : 'Pārsaukt',
Delete : 'Dzēst',
CopyDragDrop : 'Copy File Here', // MISSING
MoveDragDrop : 'Move File Here', // MISSING
// Dialogs
RenameDlgTitle : 'Rename', // MISSING
NewNameDlgTitle : 'New Name', // MISSING
FileExistsDlgTitle : 'File Already Exists', // MISSING
SysErrorDlgTitle : 'System Error', // MISSING
FileOverwrite : 'Overwrite', // MISSING
FileAutorename : 'Auto-rename', // MISSING
// Generic
OkBtn : 'Labi',
CancelBtn : 'Atcelt',
CloseBtn : 'Aizvērt',
// Upload Panel
UploadTitle : 'Jauna faila augšupielādēšana',
UploadSelectLbl : 'Izvēlaties failu, ko augšupielādēt',
UploadProgressLbl : '(Augšupielādē, lūdzu uzgaidiet...)',
UploadBtn : 'Augšupielādēt izvēlēto failu',
UploadBtnCancel : 'Atcelt',
UploadNoFileMsg : 'Lūdzu izvēlaties failu no sava datora.',
UploadNoFolder : 'Please select a folder before uploading.', // MISSING
UploadNoPerms : 'File upload not allowed.', // MISSING
UploadUnknError : 'Error sending the file.', // MISSING
UploadExtIncorrect : 'File extension not allowed in this folder.', // MISSING
// Flash Uploads
UploadLabel : 'Files to Upload', // MISSING
UploadTotalFiles : 'Total Files:', // MISSING
UploadTotalSize : 'Total Size:', // MISSING
UploadAddFiles : 'Add Files', // MISSING
UploadClearFiles : 'Clear Files', // MISSING
UploadCancel : 'Cancel Upload', // MISSING
UploadRemove : 'Remove', // MISSING
UploadRemoveTip : 'Remove !f', // MISSING
UploadUploaded : 'Uploaded !n%', // MISSING
UploadProcessing : 'Processing...', // MISSING
// Settings Panel
SetTitle : 'Uzstādījumi',
SetView : 'Attēlot:',
SetViewThumb : 'Sīkbildes',
SetViewList : 'Failu Sarakstu',
SetDisplay : 'Rādīt:',
SetDisplayName : 'Faila Nosaukumu',
SetDisplayDate : 'Datumu',
SetDisplaySize : 'Faila Izmēru',
SetSort : 'Kārtot:',
SetSortName : 'pēc Faila Nosaukuma',
SetSortDate : 'pēc Datuma',
SetSortSize : 'pēc Izmēra',
// Status Bar
FilesCountEmpty : '<Tukša mape>',
FilesCountOne : '1 fails',
FilesCountMany : '%1 faili',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'Nebija iespējams pabeigt pieprasījumu. (Kļūda %1)',
Errors :
{
10 : 'Nederīga komanda.',
11 : 'Resursa veids netika norādīts pieprasījumā.',
12 : 'Pieprasītais resursa veids nav derīgs.',
102 : 'Nederīgs faila vai mapes nosaukums.',
103 : 'Nav iespējams pabeigt pieprasījumu, autorizācijas aizliegumu dēļ.',
104 : 'Nav iespējams pabeigt pieprasījumu, failu sistēmas atļauju ierobežojumu dēļ.',
105 : 'Neatļauts faila paplašinājums.',
109 : 'Nederīgs pieprasījums.',
110 : 'Nezināma kļūda.',
115 : 'Fails vai mape ar šādu nosaukumu jau pastāv.',
116 : 'Mape nav atrasta. Lūdzu pārlādējiet šo logu un mēģiniet vēlreiz.',
117 : 'Fails nav atrasts. Lūdzu pārlādējiet failu sarakstu un mēģiniet vēlreiz.',
118 : 'Source and target paths are equal.', // MISSING
201 : 'Fails ar šādu nosaukumu jau eksistē. Augšupielādētais fails tika pārsaukts par "%1".',
202 : 'Nederīgs fails.',
203 : 'Nederīgs fails. Faila izmērs pārsniedz pieļaujamo.',
204 : 'Augšupielādētais fails ir bojāts.',
205 : 'Neviena pagaidu mape nav pieejama priekš augšupielādēšanas uz servera.',
206 : 'Augšupielāde atcelta drošības apsvērumu dēļ. Fails satur HTML veida datus.',
207 : 'Augšupielādētais fails tika pārsaukts par "%1".',
300 : 'Moving file(s) failed.', // MISSING
301 : 'Copying file(s) failed.', // MISSING
500 : 'Failu pārlūks ir atslēgts drošības apsvērumu dēļ. Lūdzu sazinieties ar šīs sistēmas tehnisko administratoru vai pārbaudiet CKFinder konfigurācijas failu.',
501 : 'Sīkbilžu atbalsts ir atslēgts.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'Faila nosaukumā nevar būt tukšums.',
FileExists : 'File %s already exists.', // MISSING
FolderEmpty : 'Mapes nosaukumā nevar būt tukšums.',
FileInvChar : 'Faila nosaukums nedrīkst saturēt nevienu no sekojošajām zīmēm: \n\\ / : * ? " < > |',
FolderInvChar : 'Mapes nosaukums nedrīkst saturēt nevienu no sekojošajām zīmēm: \n\\ / : * ? " < > |',
PopupBlockView : 'Nav iespējams failu atvērt jaunā logā. Lūdzu veiciet izmaiņas uzstādījumos savai interneta pārlūkprogrammai un izslēdziet visus uznirstošo logu bloķētājus šai adresei.',
XmlError : 'It was not possible to properly load the XML response from the web server.', // MISSING
XmlEmpty : 'It was not possible to load the XML response from the web server. The server returned an empty response.', // MISSING
XmlRawResponse : 'Raw response from the server: %s' // MISSING
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Resize %s', // MISSING
sizeTooBig : 'Cannot set image height or width to a value bigger than the original size (%size).', // MISSING
resizeSuccess : 'Image resized successfully.', // MISSING
thumbnailNew : 'Create a new thumbnail', // MISSING
thumbnailSmall : 'Small (%s)', // MISSING
thumbnailMedium : 'Medium (%s)', // MISSING
thumbnailLarge : 'Large (%s)', // MISSING
newSize : 'Set a new size', // MISSING
width : 'Platums',
height : 'Augstums',
invalidHeight : 'Invalid height.', // MISSING
invalidWidth : 'Invalid width.', // MISSING
invalidName : 'Invalid file name.', // MISSING
newImage : 'Create a new image', // MISSING
noExtensionChange : 'File extension cannot be changed.', // MISSING
imageSmall : 'Source image is too small.', // MISSING
contextMenuName : 'Resize', // MISSING
lockRatio : 'Nemainīga Augstuma/Platuma attiecība',
resetSize : 'Atjaunot sākotnējo izmēru'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Saglabāt',
fileOpenError : 'Unable to open file.', // MISSING
fileSaveSuccess : 'File saved successfully.', // MISSING
contextMenuName : 'Edit', // MISSING
loadingFile : 'Loading file, please wait...' // MISSING
},
Maximize :
{
maximize : 'Maximize', // MISSING
minimize : 'Minimize' // MISSING
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object, for the English
* language. This is the base file for all translations.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['he'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, לא זמין</span>',
confirmCancel : 'חלק מהאפשרויות שונו. האם לסגור את החלון?',
ok : 'אישור',
cancel : 'ביטול',
confirmationTitle : 'אישור',
messageTitle : 'הודעה',
inputTitle : 'שאלה',
undo : 'לבטל',
redo : 'לעשות שוב',
skip : 'דלג',
skipAll : 'דלג הכל',
makeDecision : 'איזו פעולה לבצע?',
rememberDecision: 'זכור החלטתי'
},
// Language direction, 'ltr' or 'rtl'.
dir : 'rtl',
HelpLang : 'en',
LangCode : 'he',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'm/d/yyyy h:MM aa',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'תיקיות',
FolderLoading : 'טוען...',
FolderNew : 'יש להקליד שם חדש לתיקיה: ',
FolderRename : 'יש להקליד שם חדש לתיקיה: ',
FolderDelete : 'האם למחוק את התיקיה "%1" ?',
FolderRenaming : ' (משנה שם...)',
FolderDeleting : ' (מוחק...)',
// Files
FileRename : 'יש להקליד שם חדש לקובץ: ',
FileRenameExt : 'האם לשנות את הסיומת של הקובץ?',
FileRenaming : 'משנה שם...',
FileDelete : 'האם למחוק את הקובץ "%1"?',
FilesLoading : 'טוען...',
FilesEmpty : 'תיקיה ריקה',
FilesMoved : 'קובץ %1 הוזז ל- %2:%3',
FilesCopied : 'קובץ %1 הועתק ל- %2:%3',
// Basket
BasketFolder : 'סל קבצים',
BasketClear : 'ניקוי סל הקבצים',
BasketRemove : 'מחיקה מסל הקבצים',
BasketOpenFolder : 'פתיחת תיקיית אב',
BasketTruncateConfirm : 'האם למחוק את כל הקבצים מסל הקבצים?',
BasketRemoveConfirm : 'האם למחוק את הקובץ "%1" מסל הקבצים?',
BasketEmpty : 'אין קבצים בסל הקבצים, יש לגרור לכאן קובץ.',
BasketCopyFilesHere : 'העתקת קבצים מסל הקבצים',
BasketMoveFilesHere : 'הזזת קבצים מסל הקבצים',
BasketPasteErrorOther : 'שגיאה %e בקובץ %s',
BasketPasteMoveSuccess : 'הקבצים הבאים הוזזו: %s',
BasketPasteCopySuccess : 'הקבצים הבאים הועתקו: %s',
// Toolbar Buttons (some used elsewhere)
Upload : 'העלאה',
UploadTip : 'העלאת קובץ חדש',
Refresh : 'ריענון',
Settings : 'הגדרות',
Help : 'עזרה',
HelpTip : 'עזרה',
// Context Menus
Select : 'בחירה',
SelectThumbnail : 'בחירת תמונה מוקטנת',
View : 'צפיה',
Download : 'הורדה',
NewSubFolder : 'תת-תיקיה חדשה',
Rename : 'שינוי שם',
Delete : 'מחיקה',
CopyDragDrop : 'העתקת קבצים לכאן',
MoveDragDrop : 'הזזת קבצים לכאן',
// Dialogs
RenameDlgTitle : 'שינוי שם',
NewNameDlgTitle : 'שם חדש',
FileExistsDlgTitle : 'קובץ זה כבר קיים',
SysErrorDlgTitle : 'שגיאת מערכת',
FileOverwrite : 'החלפה',
FileAutorename : 'שינוי שם אוטומטי',
// Generic
OkBtn : 'אישור',
CancelBtn : 'ביטול',
CloseBtn : 'סגור',
// Upload Panel
UploadTitle : 'העלאת קובץ חדש',
UploadSelectLbl : 'בחירת קובץ להעלאה',
UploadProgressLbl : '(העלאה מתבצעת, נא להמתין...)',
UploadBtn : 'העלאת קובץ',
UploadBtnCancel : 'ביטול',
UploadNoFileMsg : 'יש לבחור קובץ מהמחשב',
UploadNoFolder : 'יש לבחור תיקיה לפני ההעלאה.',
UploadNoPerms : 'העלאת קובץ אסורה.',
UploadUnknError : 'שגיאה בשליחת הקובץ.',
UploadExtIncorrect : 'סוג קובץ זה לא מאושר בתיקיה זאת.',
// Flash Uploads
UploadLabel : 'להעלאה קבצים',
UploadTotalFiles : ':קבצים כמות',
UploadTotalSize : ':סופי גודל',
UploadAddFiles : 'קבצים הוספת',
UploadClearFiles : 'קבצים ניקוי',
UploadCancel : 'העלאה ביטול',
UploadRemove : 'מחיקה',
UploadRemoveTip : '!f הקובץ מחיקת',
UploadUploaded : 'הועלו !n%',
UploadProcessing : 'מעבד...',
// Settings Panel
SetTitle : 'הגדרות',
SetView : 'צפיה:',
SetViewThumb : 'תמונות מוקטנות',
SetViewList : 'רשימה',
SetDisplay : 'תצוגה:',
SetDisplayName : 'שם קובץ',
SetDisplayDate : 'תאריך',
SetDisplaySize : 'גודל קובץ',
SetSort : 'מיון:',
SetSortName : 'לפי שם',
SetSortDate : 'לפי תאריך',
SetSortSize : 'לפי גודל',
// Status Bar
FilesCountEmpty : '<תיקיה ריקה>',
FilesCountOne : 'קובץ 1',
FilesCountMany : '%1 קבצים',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'לא היה ניתן להשלים את הבקשה. (שגיאה %1)',
Errors :
{
10 : 'הוראה לא תקינה.',
11 : 'סוג המשאב לא צויין בבקשה.',
12 : 'סוג המשאב המצויין לא תקין.',
102 : 'שם קובץ או תיקיה לא תקין.',
103 : 'לא היה ניתן להשלים את הבקשב בשל הרשאות מוגבלות.',
104 : 'לא היה ניתן להשלים את הבקשב בשל הרשאות מערכת קבצים מוגבלות.',
105 : 'סיומת קובץ לא תקינה.',
109 : 'בקשה לא תקינה.',
110 : 'שגיאה לא ידועה.',
115 : 'קובץ או תיקיה באותו שם כבר קיימ/ת.',
116 : 'התיקיה לא נמצאה. נא לרענן ולנסות שוב.',
117 : 'הקובץ לא נמצא. נא לרענן ולנסות שוב.',
118 : 'כתובות המקור והיעד זהות.',
201 : 'קובץ עם אותו השם כבר קיים. שם הקובץ שהועלה שונה ל "%1"',
202 : 'קובץ לא תקין',
203 : 'קובץ לא תקין. גודל הקובץ גדול מדי.',
204 : 'הקובץ המועלה לא תקין',
205 : 'תיקיה זמנית להעלאה לא קיימת בשרת.',
206 : 'העלאה בוטלה מסיבות אבטחה. הקובץ מכיל תוכן שדומה ל-HTML.',
207 : 'שם הקובץ שהועלה שונה ל "%1"',
300 : 'העברת הקבצים נכשלה.',
301 : 'העתקת הקבצים נכשלה.',
500 : 'דפדפן הקבצים מנוטרל מסיבות אבטחה. יש לפנות למנהל המערכת ולבדוק את קובץ התצורה של CKFinder.',
501 : 'התמיכה בתמונות מוקטנות מבוטלת.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'שם הקובץ לא יכול להיות ריק',
FileExists : 'הקובץ %s כבר קיים',
FolderEmpty : 'שם התיקיה לא יכול להיות ריק',
FileInvChar : 'שם הקובץ לא יכול לכלול תווים הבאים: \n\\ / : * ? " < > |',
FolderInvChar : 'שם התיקיה לא יכול לכלול תווים הבאים: \n\\ / : * ? " < > |',
PopupBlockView : 'לא היה ניתן לפתוח קובץ בחלון חדש. נא לבדוק את הגדרות הדפדפן ולבטל את חוסמי החלונות הקובצים.',
XmlError : 'לא היה ניתן לטעון מהשרת כהלכה את קובץ ה-XML.',
XmlEmpty : 'לא היה ניתן לטעון מהשרת את קובץ ה-XML. השרת החזיר תגובה ריקה.',
XmlRawResponse : 'תגובה גולמית מהשרת: %s'
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'שינוי גודל התמונה %s',
sizeTooBig : 'גובה ורוחב התמונה לא יכולים להיות גדולים מהגודל המקורי שלה (%size).',
resizeSuccess : 'גודל התמונה שונה שהצלחה.',
thumbnailNew : 'יצירת תמונה מוקטנת (Thumbnail)',
thumbnailSmall : 'קטנה (%s)',
thumbnailMedium : 'בינונית (%s)',
thumbnailLarge : 'גדולה (%s)',
newSize : 'קביעת גודל חדש',
width : 'רוחב',
height : 'גובה',
invalidHeight : 'גובה לא חוקי.',
invalidWidth : 'רוחב לא חוקי.',
invalidName : 'שם הקובץ לא חוקי.',
newImage : 'יצירת תמונה חדשה',
noExtensionChange : 'לא ניתן לשנות את סוג הקובץ.',
imageSmall : 'התמונה המקורית קטנה מדי',
contextMenuName : 'שינוי גודל',
lockRatio : 'נעילת היחס',
resetSize : 'איפוס הגודל'
},
// Fileeditor plugin
Fileeditor :
{
save : 'שמירה',
fileOpenError : 'לא היה ניתן לפתוח את הקובץ.',
fileSaveSuccess : 'הקובץ נשמר בהצלחה.',
contextMenuName : 'עריכה',
loadingFile : 'טוען קובץ, נא להמתין...'
},
Maximize :
{
maximize : 'הגדלה למקסימום',
minimize : 'הקטנה למינימום'
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Slovenian
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['sl'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, nedostopen</span>',
confirmCancel : 'Nekatere opcije so bile spremenjene. Ali res želite zapreti pogovorno okno?',
ok : 'Potrdi',
cancel : 'Prekliči',
confirmationTitle : 'Potrditev',
messageTitle : 'Informacija',
inputTitle : 'Vprašanje',
undo : 'Razveljavi',
redo : 'Obnovi',
skip : 'Preskoči',
skipAll : 'Preskoči vse',
makeDecision : 'Katera aktivnost naj se izvede?',
rememberDecision: 'Zapomni si mojo izbiro'
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'en',
LangCode : 'sl',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'd.m.yyyy H:MM',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'Mape',
FolderLoading : 'Nalagam...',
FolderNew : 'Vnesite ime za novo mapo: ',
FolderRename : 'Vnesite ime nove mape: ',
FolderDelete : 'Ali ste prepričani, da želite zbrisati mapo "%1"?',
FolderRenaming : ' (Preimenujem...)',
FolderDeleting : ' (Brišem...)',
// Files
FileRename : 'Vnesite novo ime datoteke: ',
FileRenameExt : 'Ali ste prepričani, da želite spremeniti končnico datoteke? Možno je, da potem datoteka ne bo uporabna.',
FileRenaming : 'Preimenujem...',
FileDelete : 'Ali ste prepričani, da želite izbrisati datoteko "%1"?',
FilesLoading : 'Nalagam...',
FilesEmpty : 'Prazna mapa',
FilesMoved : 'Datoteka %1 je bila premaknjena v %2:%3.',
FilesCopied : 'Datoteka %1 je bila kopirana v %2:%3.',
// Basket
BasketFolder : 'Koš',
BasketClear : 'Izprazni koš',
BasketRemove : 'Odstrani iz koša',
BasketOpenFolder : 'Odpri izvorno mapo',
BasketTruncateConfirm : 'Ali res želite odstraniti vse datoteke iz koša?',
BasketRemoveConfirm : 'Ali res želite odstraniti datoteko "%1" iz koša?',
BasketEmpty : 'V košu ni datotek. Lahko jih povlečete in spustite.',
BasketCopyFilesHere : 'Kopiraj datoteke iz koša',
BasketMoveFilesHere : 'Premakni datoteke iz koša',
BasketPasteErrorOther : 'Napaka z datoteko %s: %e',
BasketPasteMoveSuccess : 'Seznam premaknjenih datotek: %s',
BasketPasteCopySuccess : 'Seznam kopiranih datotek: %s',
// Toolbar Buttons (some used elsewhere)
Upload : 'Naloži na strežnik',
UploadTip : 'Naloži novo datoteko na strežnik',
Refresh : 'Osveži',
Settings : 'Nastavitve',
Help : 'Pomoč',
HelpTip : 'Pomoč',
// Context Menus
Select : 'Izberi',
SelectThumbnail : 'Izberi malo sličico (predogled)',
View : 'Predogled',
Download : 'Prenesi na svoj računalnik',
NewSubFolder : 'Nova podmapa',
Rename : 'Preimenuj',
Delete : 'Zbriši',
CopyDragDrop : 'Kopiraj datoteko',
MoveDragDrop : 'Premakni datoteko',
// Dialogs
RenameDlgTitle : 'Preimenuj',
NewNameDlgTitle : 'Novo ime',
FileExistsDlgTitle : 'Datoteka že obstaja',
SysErrorDlgTitle : 'Sistemska napaka',
FileOverwrite : 'Prepiši',
FileAutorename : 'Avtomatsko preimenuj',
// Generic
OkBtn : 'Potrdi',
CancelBtn : 'Prekliči',
CloseBtn : 'Zapri',
// Upload Panel
UploadTitle : 'Naloži novo datoteko na strežnik',
UploadSelectLbl : 'Izberi datoteko za prenos na strežnik',
UploadProgressLbl : '(Prenos na strežnik poteka, prosimo počakajte...)',
UploadBtn : 'Prenesi izbrano datoteko na strežnik',
UploadBtnCancel : 'Prekliči',
UploadNoFileMsg : 'Prosimo izberite datoteko iz svojega računalnika za prenos na strežnik.',
UploadNoFolder : 'Izberite mapo v katero se bo naložilo datoteko!',
UploadNoPerms : 'Nalaganje datotek ni dovoljeno.',
UploadUnknError : 'Napaka pri pošiljanju datoteke.',
UploadExtIncorrect : 'V tej mapi ta vrsta datoteke ni dovoljena.',
// Flash Uploads
UploadLabel : 'Files to Upload', // MISSING
UploadTotalFiles : 'Total Files:', // MISSING
UploadTotalSize : 'Total Size:', // MISSING
UploadAddFiles : 'Add Files', // MISSING
UploadClearFiles : 'Clear Files', // MISSING
UploadCancel : 'Cancel Upload', // MISSING
UploadRemove : 'Remove', // MISSING
UploadRemoveTip : 'Remove !f', // MISSING
UploadUploaded : 'Uploaded !n%', // MISSING
UploadProcessing : 'Processing...', // MISSING
// Settings Panel
SetTitle : 'Nastavitve',
SetView : 'Pogled:',
SetViewThumb : 'majhne sličice',
SetViewList : 'seznam',
SetDisplay : 'Prikaz:',
SetDisplayName : 'ime datoteke',
SetDisplayDate : 'datum',
SetDisplaySize : 'velikost datoteke',
SetSort : 'Razvrščanje:',
SetSortName : 'po imenu datoteke',
SetSortDate : 'po datumu',
SetSortSize : 'po velikosti',
// Status Bar
FilesCountEmpty : '<Prazna mapa>',
FilesCountOne : '1 datoteka',
FilesCountMany : '%1 datotek(e)',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/sek',
// Connector Error Messages.
ErrorUnknown : 'Prišlo je do napake. (Napaka %1)',
Errors :
{
10 : 'Napačen ukaz.',
11 : 'V poizvedbi ni bil jasen tip (resource type).',
12 : 'Tip datoteke ni primeren.',
102 : 'Napačno ime mape ali datoteke.',
103 : 'Vašega ukaza se ne da izvesti zaradi težav z avtorizacijo.',
104 : 'Vašega ukaza se ne da izvesti zaradi težav z nastavitvami pravic v datotečnem sistemu.',
105 : 'Napačna končnica datoteke.',
109 : 'Napačna zahteva.',
110 : 'Neznana napaka.',
115 : 'Datoteka ali mapa s tem imenom že obstaja.',
116 : 'Mapa ni najdena. Prosimo osvežite okno in poskusite znova.',
117 : 'Datoteka ni najdena. Prosimo osvežite seznam datotek in poskusite znova.',
118 : 'Začetna in končna pot je ista.',
201 : 'Datoteka z istim imenom že obstaja. Naložena datoteka je bila preimenovana v "%1".',
202 : 'Neprimerna datoteka.',
203 : 'Datoteka je prevelika in zasede preveč prostora.',
204 : 'Naložena datoteka je okvarjena.',
205 : 'Na strežniku ni na voljo začasna mapa za prenos datotek.',
206 : 'Nalaganje je bilo prekinjeno zaradi varnostnih razlogov. Datoteka vsebuje podatke, ki spominjajo na HTML kodo.',
207 : 'Naložena datoteka je bila preimenovana v "%1".',
300 : 'Premikanje datotek(e) ni uspelo.',
301 : 'Kopiranje datotek(e) ni uspelo.',
500 : 'Brskalnik je onemogočen zaradi varnostnih razlogov. Prosimo kontaktirajte upravljalca spletnih strani.',
501 : 'Ni podpore za majhne sličice (predogled).'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'Ime datoteke ne more biti prazno.',
FileExists : 'Datoteka %s že obstaja.',
FolderEmpty : 'Mapa ne more biti prazna.',
FileInvChar : 'Ime datoteke ne sme vsebovati naslednjih znakov: \n\\ / : * ? " < > |',
FolderInvChar : 'Ime mape ne sme vsebovati naslednjih znakov: \n\\ / : * ? " < > |',
PopupBlockView : 'Datoteke ni možno odpreti v novem oknu. Prosimo nastavite svoj brskalnik tako, da bo dopuščal odpiranje oken (popups) oz. izklopite filtre za blokado odpiranja oken.',
XmlError : 'It was not possible to properly load the XML response from the web server.', // MISSING
XmlEmpty : 'It was not possible to load the XML response from the web server. The server returned an empty response.', // MISSING
XmlRawResponse : 'Raw response from the server: %s' // MISSING
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Spremeni velikost slike %s',
sizeTooBig : 'Širina ali višina slike ne moreta biti večji kot je originalna velikost (%size).',
resizeSuccess : 'Velikost slike je bila uspešno spremenjena.',
thumbnailNew : 'Kreiraj novo majhno sličico',
thumbnailSmall : 'majhna (%s)',
thumbnailMedium : 'srednja (%s)',
thumbnailLarge : 'velika (%s)',
newSize : 'Določite novo velikost',
width : 'Širina',
height : 'Višina',
invalidHeight : 'Nepravilna višina.',
invalidWidth : 'Nepravilna širina.',
invalidName : 'Nepravilno ime datoteke.',
newImage : 'Kreiraj novo sliko',
noExtensionChange : 'Končnica datoteke se ne more spremeniti.',
imageSmall : 'Izvorna slika je premajhna.',
contextMenuName : 'Spremeni velikost',
lockRatio : 'Zakleni razmerje',
resetSize : 'Ponastavi velikost'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Shrani',
fileOpenError : 'Datoteke ni mogoče odpreti.',
fileSaveSuccess : 'Datoteka je bila shranjena.',
contextMenuName : 'Uredi',
loadingFile : 'Nalaganje datoteke, prosimo počakajte ...'
},
Maximize :
{
maximize : 'Maksimiraj',
minimize : 'Minimiraj'
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Czech
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['cs'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, nedostupné</span>',
confirmCancel : 'Některá z nastavení byla změněna. Skutečně chete zavřít dialogové okno?',
ok : 'OK',
cancel : 'Zrušit',
confirmationTitle : 'Confirmation', // MISSING
messageTitle : 'Information', // MISSING
inputTitle : 'Question', // MISSING
undo : 'Zpět',
redo : 'Znovu',
skip : 'Skip', // MISSING
skipAll : 'Skip all', // MISSING
makeDecision : 'What action should be taken?', // MISSING
rememberDecision: 'Remember my decision' // MISSING
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'en',
LangCode : 'cs',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'm/d/yyyy h:MM aa',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'Složky',
FolderLoading : 'Načítání...',
FolderNew : 'Zadejte jméno nové složky: ',
FolderRename : 'Zadejte nové jméno složky: ',
FolderDelete : 'Opravdu chcete smazat složku "%1"?',
FolderRenaming : ' (Přejmenovávám...)',
FolderDeleting : ' (Mažu...)',
// Files
FileRename : 'Zadejte jméno novéhho souboru: ',
FileRenameExt : 'Opravdu chcete změnit příponu souboru, může se stát nečitelným.',
FileRenaming : 'Přejmenovávám...',
FileDelete : 'Opravdu chcete smazat soubor "%1"?',
FilesLoading : 'Načítání...',
FilesEmpty : 'Prázdná složka.',
FilesMoved : 'File %1 moved to %2:%3.', // MISSING
FilesCopied : 'File %1 copied to %2:%3.', // MISSING
// Basket
BasketFolder : 'Basket', // MISSING
BasketClear : 'Clear Basket', // MISSING
BasketRemove : 'Remove from Basket', // MISSING
BasketOpenFolder : 'Open Parent Folder', // MISSING
BasketTruncateConfirm : 'Do you really want to remove all files from the basket?', // MISSING
BasketRemoveConfirm : 'Do you really want to remove the file "%1" from the basket?', // MISSING
BasketEmpty : 'No files in the basket, drag and drop some.', // MISSING
BasketCopyFilesHere : 'Copy Files from Basket', // MISSING
BasketMoveFilesHere : 'Move Files from Basket', // MISSING
BasketPasteErrorOther : 'File %s error: %e', // MISSING
BasketPasteMoveSuccess : 'The following files were moved: %s', // MISSING
BasketPasteCopySuccess : 'The following files were copied: %s', // MISSING
// Toolbar Buttons (some used elsewhere)
Upload : 'Nahrát',
UploadTip : 'Nahrát nový soubor',
Refresh : 'Načíst znova',
Settings : 'Nastavení',
Help : 'Pomoc',
HelpTip : 'Pomoc',
// Context Menus
Select : 'Vybrat',
SelectThumbnail : 'Vybrat náhled',
View : 'Zobrazit',
Download : 'Uložit jako',
NewSubFolder : 'Nová podsložka',
Rename : 'Přejmenovat',
Delete : 'Smazat',
CopyDragDrop : 'Copy File Here', // MISSING
MoveDragDrop : 'Move File Here', // MISSING
// Dialogs
RenameDlgTitle : 'Rename', // MISSING
NewNameDlgTitle : 'New Name', // MISSING
FileExistsDlgTitle : 'File Already Exists', // MISSING
SysErrorDlgTitle : 'System Error', // MISSING
FileOverwrite : 'Overwrite', // MISSING
FileAutorename : 'Auto-rename', // MISSING
// Generic
OkBtn : 'OK',
CancelBtn : 'Zrušit',
CloseBtn : 'Zavřít',
// Upload Panel
UploadTitle : 'Nahrát nový soubor',
UploadSelectLbl : 'Zvolit soubor k nahrání',
UploadProgressLbl : '(Nahrávám, čekejte...)',
UploadBtn : 'Nahrát zvolený soubor',
UploadBtnCancel : 'Zrušit',
UploadNoFileMsg : 'Vyberte prosím soubor.',
UploadNoFolder : 'Please select a folder before uploading.', // MISSING
UploadNoPerms : 'File upload not allowed.', // MISSING
UploadUnknError : 'Error sending the file.', // MISSING
UploadExtIncorrect : 'File extension not allowed in this folder.', // MISSING
// Flash Uploads
UploadLabel : 'Files to Upload', // MISSING
UploadTotalFiles : 'Total Files:', // MISSING
UploadTotalSize : 'Total Size:', // MISSING
UploadAddFiles : 'Add Files', // MISSING
UploadClearFiles : 'Clear Files', // MISSING
UploadCancel : 'Cancel Upload', // MISSING
UploadRemove : 'Remove', // MISSING
UploadRemoveTip : 'Remove !f', // MISSING
UploadUploaded : 'Uploaded !n%', // MISSING
UploadProcessing : 'Processing...', // MISSING
// Settings Panel
SetTitle : 'Nastavení',
SetView : 'Zobrazení:',
SetViewThumb : 'Náhledy',
SetViewList : 'Seznam',
SetDisplay : 'Informace:',
SetDisplayName : 'Název',
SetDisplayDate : 'Datum',
SetDisplaySize : 'Velikost',
SetSort : 'Seřazení:',
SetSortName : 'Podle jména',
SetSortDate : 'Podle data',
SetSortSize : 'Podle velikosti',
// Status Bar
FilesCountEmpty : '<Prázdná složka>',
FilesCountOne : '1 soubor',
FilesCountMany : '%1 soubor',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'Nebylo možno dokončit příkaz. (Error %1)',
Errors :
{
10 : 'Neplatný příkaz.',
11 : 'Požadovaný typ prostředku nebyl specifikován v dotazu.',
12 : 'Požadovaný typ prostředku není validní.',
102 : 'Šatné jméno souboru, nebo složky.',
103 : 'Nebylo možné dokončit příkaz kvůli autorizačním omezením.',
104 : 'Nebylo možné dokončit příkaz kvůli omezeným přístupovým právům k souborům.',
105 : 'Špatná přípona souboru.',
109 : 'Neplatný příkaz.',
110 : 'Neznámá chyba.',
115 : 'Již existuje soubor nebo složka se stejným jménem.',
116 : 'Složka nenalezena, prosím obnovte stránku.',
117 : 'Soubor nenalezen, prosím obnovte stránku.',
118 : 'Source and target paths are equal.', // MISSING
201 : 'Již existoval soubor se stejným jménem, nahraný soubor byl přejmenován na "%1".',
202 : 'Špatný soubor.',
203 : 'Špatný soubor. Příliš velký.',
204 : 'Nahraný soubor je poškozen.',
205 : 'Na serveru není dostupná dočasná složka.',
206 : 'Nahrávání zrušeno z bezpečnostních důvodů. Soubor obsahuje data podobná HTML.',
207 : 'Nahraný soubor byl přejmenován na "%1".',
300 : 'Moving file(s) failed.', // MISSING
301 : 'Copying file(s) failed.', // MISSING
500 : 'Nahrávání zrušeno z bezpečnostních důvodů. Zdělte to prosím administrátorovi a zkontrolujte nastavení CKFinderu.',
501 : 'Podpora náhledů je vypnuta.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'Název souboru nemůže být prázdný.',
FileExists : 'File %s already exists.', // MISSING
FolderEmpty : 'Název složky nemůže být prázdný.',
FileInvChar : 'Název souboru nesmí obsahovat následující znaky: \n\\ / : * ? " < > |',
FolderInvChar : 'Název složky nesmí obsahovat následující znaky: \n\\ / : * ? " < > |',
PopupBlockView : 'Nebylo možné otevřít soubor do nového okna. Prosím nastavte si prohlížeč aby neblokoval vyskakovací okna.',
XmlError : 'It was not possible to properly load the XML response from the web server.', // MISSING
XmlEmpty : 'It was not possible to load the XML response from the web server. The server returned an empty response.', // MISSING
XmlRawResponse : 'Raw response from the server: %s' // MISSING
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Resize %s', // MISSING
sizeTooBig : 'Cannot set image height or width to a value bigger than the original size (%size).', // MISSING
resizeSuccess : 'Image resized successfully.', // MISSING
thumbnailNew : 'Create a new thumbnail', // MISSING
thumbnailSmall : 'Small (%s)', // MISSING
thumbnailMedium : 'Medium (%s)', // MISSING
thumbnailLarge : 'Large (%s)', // MISSING
newSize : 'Set a new size', // MISSING
width : 'Šířka',
height : 'Výška',
invalidHeight : 'Invalid height.', // MISSING
invalidWidth : 'Invalid width.', // MISSING
invalidName : 'Invalid file name.', // MISSING
newImage : 'Create a new image', // MISSING
noExtensionChange : 'File extension cannot be changed.', // MISSING
imageSmall : 'Source image is too small.', // MISSING
contextMenuName : 'Resize', // MISSING
lockRatio : 'Zámek',
resetSize : 'Původní velikost'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Uložit',
fileOpenError : 'Unable to open file.', // MISSING
fileSaveSuccess : 'File saved successfully.', // MISSING
contextMenuName : 'Edit', // MISSING
loadingFile : 'Loading file, please wait...' // MISSING
},
Maximize :
{
maximize : 'Maximalizovat',
minimize : 'Minimalizovat'
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Latin American Spanish
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['es-mx'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, no disponible</span>',
confirmCancel : 'Algunas opciones se han cambiado\r\n¿Está seguro de querer cerrar el diálogo?',
ok : 'Aceptar',
cancel : 'Cancelar',
confirmationTitle : 'Confirmación',
messageTitle : 'Información',
inputTitle : 'Pregunta',
undo : 'Deshacer',
redo : 'Rehacer',
skip : 'Omitir',
skipAll : 'Omitir todos',
makeDecision : '¿Qué acción debe realizarse?',
rememberDecision: 'Recordar mi decisión'
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'es-mx',
LangCode : 'es-mx',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'dd/mm/yyyy H:MM',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'Carpetas',
FolderLoading : 'Cargando...',
FolderNew : 'Por favor, escriba el nombre para la nueva carpeta: ',
FolderRename : 'Por favor, escriba el nuevo nombre para la carpeta: ',
FolderDelete : '¿Está seguro de que quiere borrar la carpeta "%1"?',
FolderRenaming : ' (Renombrando...)',
FolderDeleting : ' (Borrando...)',
// Files
FileRename : 'Por favor, escriba el nuevo nombre del archivo: ',
FileRenameExt : '¿Está seguro de querer cambiar la extensión del archivo? El archivo puede dejar de ser usable.',
FileRenaming : 'Renombrando...',
FileDelete : '¿Está seguro de que quiere borrar el archivo "%1".?',
FilesLoading : 'Cargando...',
FilesEmpty : 'Carpeta vacía',
FilesMoved : 'Archivo %1 movido a %2:%3.',
FilesCopied : 'Archivo %1 copiado a %2:%3.',
// Basket
BasketFolder : 'Cesta',
BasketClear : 'Vaciar cesta',
BasketRemove : 'Quitar de la cesta',
BasketOpenFolder : 'Abrir carpeta padre',
BasketTruncateConfirm : '¿Está seguro de querer quitar todos los archivos de la cesta?',
BasketRemoveConfirm : '¿Está seguro de querer quitar el archivo "%1" de la cesta?',
BasketEmpty : 'No hay archivos en la cesta, arrastra y suelta algunos.',
BasketCopyFilesHere : 'Copiar archivos de la cesta',
BasketMoveFilesHere : 'Mover archivos de la cesta',
BasketPasteErrorOther : 'Fichero %s error: %e.',
BasketPasteMoveSuccess : 'Los siguientes ficheros han sido movidos: %s',
BasketPasteCopySuccess : 'Los siguientes ficheros han sido copiados: %s',
// Toolbar Buttons (some used elsewhere)
Upload : 'Añadir',
UploadTip : 'Añadir nuevo archivo',
Refresh : 'Actualizar',
Settings : 'Configuración',
Help : 'Ayuda',
HelpTip : 'Ayuda',
// Context Menus
Select : 'Seleccionar',
SelectThumbnail : 'Seleccionar el icono',
View : 'Ver',
Download : 'Descargar',
NewSubFolder : 'Nueva Subcarpeta',
Rename : 'Renombrar',
Delete : 'Borrar',
CopyDragDrop : 'Copiar archivo aquí',
MoveDragDrop : 'Mover archivo aquí',
// Dialogs
RenameDlgTitle : 'Renombrar',
NewNameDlgTitle : 'Nuevo nombre',
FileExistsDlgTitle : 'Archivo existente',
SysErrorDlgTitle : 'Error de sistema',
FileOverwrite : 'Sobreescribir',
FileAutorename : 'Auto-renombrar',
// Generic
OkBtn : 'Aceptar',
CancelBtn : 'Cancelar',
CloseBtn : 'Cerrar',
// Upload Panel
UploadTitle : 'Añadir nuevo archivo',
UploadSelectLbl : 'Elija el archivo a subir',
UploadProgressLbl : '(Subida en progreso, por favor espere...)',
UploadBtn : 'Subir el archivo elegido',
UploadBtnCancel : 'Cancelar',
UploadNoFileMsg : 'Por favor, elija un archivo de su computadora.',
UploadNoFolder : 'Por favor, escoja la carpeta antes de iniciar la subida.',
UploadNoPerms : 'No puede subir archivos.',
UploadUnknError : 'Error enviando el archivo.',
UploadExtIncorrect : 'La extensión del archivo no está permitida en esta carpeta.',
// Flash Uploads
UploadLabel : 'Archivos a subir',
UploadTotalFiles : 'Total de archivos:',
UploadTotalSize : 'Tamaño total:',
UploadAddFiles : 'Añadir archivos',
UploadClearFiles : 'Borrar archivos',
UploadCancel : 'Cancelar subida',
UploadRemove : 'Quitar',
UploadRemoveTip : 'Quitar !f',
UploadUploaded : 'Enviado !n%',
UploadProcessing : 'Procesando...',
// Settings Panel
SetTitle : 'Configuración',
SetView : 'Vista:',
SetViewThumb : 'Iconos',
SetViewList : 'Lista',
SetDisplay : 'Mostrar:',
SetDisplayName : 'Nombre de archivo',
SetDisplayDate : 'Fecha',
SetDisplaySize : 'Tamaño del archivo',
SetSort : 'Ordenar:',
SetSortName : 'por Nombre',
SetSortDate : 'por Fecha',
SetSortSize : 'por Tamaño',
// Status Bar
FilesCountEmpty : '<Carpeta vacía>',
FilesCountOne : '1 archivo',
FilesCountMany : '%1 archivos',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'No ha sido posible completar la solicitud. (Error %1)',
Errors :
{
10 : 'Comando incorrecto.',
11 : 'El tipo de recurso no ha sido especificado en la solicitud.',
12 : 'El tipo de recurso solicitado no es válido.',
102 : 'Nombre de archivo o carpeta no válido.',
103 : 'No se ha podido completar la solicitud debido a las restricciones de autorización.',
104 : 'No ha sido posible completar la solicitud debido a restricciones en el sistema de archivos.',
105 : 'La extensión del archivo no es válida.',
109 : 'Petición inválida.',
110 : 'Error desconocido.',
115 : 'Ya existe un archivo o carpeta con ese nombre.',
116 : 'No se ha encontrado la carpeta. Por favor, actualice y pruebe de nuevo.',
117 : 'No se ha encontrado el archivo. Por favor, actualice la lista de archivos y pruebe de nuevo.',
118 : 'Las rutas origen y destino son iguales.',
201 : 'Ya existía un archivo con ese nombre. El archivo subido ha sido renombrado como "%1".',
202 : 'Archivo inválido.',
203 : 'Archivo inválido. El tamaño es demasiado grande.',
204 : 'El archivo subido está corrupto.',
205 : 'La carpeta temporal no está disponible en el servidor para las subidas.',
206 : 'La subida se ha cancelado por razones de seguridad. El archivo contenía código HTML.',
207 : 'El archivo subido ha sido renombrado como "%1".',
300 : 'Ha fallado el mover el(los) archivo(s).',
301 : 'Ha fallado el copiar el(los) archivo(s).',
500 : 'El navegador de archivos está deshabilitado por razones de seguridad. Por favor, contacte con el administrador de su sistema y compruebe el archivo de configuración de CKFinder.',
501 : 'El soporte para iconos está deshabilitado.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'El nombre del archivo no puede estar vacío.',
FileExists : 'El archivo %s ya existe.',
FolderEmpty : 'El nombre de la carpeta no puede estar vacío.',
FileInvChar : 'El nombre del archivo no puede contener ninguno de los caracteres siguientes: \n\\ / : * ? " < > |',
FolderInvChar : 'El nombre de la carpeta no puede contener ninguno de los caracteres siguientes: \n\\ / : * ? " < > |',
PopupBlockView : 'No ha sido posible abrir el archivo en una nueva ventana. Por favor, configure su navegador y desactive todos los bloqueadores de ventanas para esta página.',
XmlError : 'No ha sido posible cargar correctamente la respuesta XML del servidor.',
XmlEmpty : 'No ha sido posible cargar correctamente la respuesta XML del servidor. El servidor envió una cadena vacía.',
XmlRawResponse : 'Respuesta del servidor: %s'
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Redimensionar %s',
sizeTooBig : 'No se puede poner la altura o anchura de la imagen mayor que las dimensiones originales (%size).',
resizeSuccess : 'Imagen redimensionada correctamente.',
thumbnailNew : 'Crear nueva minuatura',
thumbnailSmall : 'Pequeña (%s)',
thumbnailMedium : 'Mediana (%s)',
thumbnailLarge : 'Grande (%s)',
newSize : 'Establecer nuevo tamaño',
width : 'Ancho',
height : 'Alto',
invalidHeight : 'Altura inválida.',
invalidWidth : 'Anchura inválida.',
invalidName : 'Nombre no válido.',
newImage : 'Crear nueva imagen',
noExtensionChange : 'La extensión no se puede cambiar.',
imageSmall : 'La imagen original es demasiado pequeña.',
contextMenuName : 'Redimensionar',
lockRatio : 'Proporcional',
resetSize : 'Tamaño Original'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Guardar',
fileOpenError : 'No se puede abrir el archivo.',
fileSaveSuccess : 'Archivo guardado correctamente.',
contextMenuName : 'Editar',
loadingFile : 'Cargando archivo, por favor espere...'
},
Maximize :
{
maximize : 'Maximizar',
minimize : 'Minimizar'
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Brazilian Portuguese
* language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['pt-br'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, indisponível</span>',
confirmCancel : 'Algumas opções foram modificadas. Deseja fechar a janela realmente?',
ok : 'OK',
cancel : 'Cancelar',
confirmationTitle : 'Confirmação',
messageTitle : 'Informação',
inputTitle : 'Pergunta',
undo : 'Desfazer',
redo : 'Refazer',
skip : 'Ignorar',
skipAll : 'Ignorar todos',
makeDecision : 'Que ação deve ser tomada?',
rememberDecision: 'Lembra minha decisão'
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'en',
LangCode : 'pt-br',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'dd/mm/yyyy HH:MM',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'Pastas',
FolderLoading : 'Carregando...',
FolderNew : 'Favor informar o nome da nova pasta: ',
FolderRename : 'Favor informar o nome da nova pasta: ',
FolderDelete : 'Você tem certeza que deseja apagar a pasta "%1"?',
FolderRenaming : ' (Renomeando...)',
FolderDeleting : ' (Apagando...)',
// Files
FileRename : 'Favor informar o nome do novo arquivo: ',
FileRenameExt : 'Você tem certeza que deseja alterar a extensão do arquivo? O arquivo pode ser danificado.',
FileRenaming : 'Renomeando...',
FileDelete : 'Você tem certeza que deseja apagar o arquivo "%1"?',
FilesLoading : 'Carregando...',
FilesEmpty : 'Pasta vazia',
FilesMoved : 'Arquivo %1 movido para %2:%3.',
FilesCopied : 'Arquivo %1 copiado em %2:%3.',
// Basket
BasketFolder : 'Cesta',
BasketClear : 'Limpa Cesta',
BasketRemove : 'Remove da cesta',
BasketOpenFolder : 'Abre a pasta original',
BasketTruncateConfirm : 'Remover todos os arquivas da cesta?',
BasketRemoveConfirm : 'Remover o arquivo "%1" da cesta?',
BasketEmpty : 'Nenhum arquivo na cesta, arraste alguns antes.',
BasketCopyFilesHere : 'Copia Arquivos da Cesta',
BasketMoveFilesHere : 'Move os Arquivos da Cesta',
BasketPasteErrorOther : 'Arquivo %s erro: %e',
BasketPasteMoveSuccess : 'Os seguintes arquivos foram movidos: %s',
BasketPasteCopySuccess : 'Os sequintes arquivos foram copiados: %s',
// Toolbar Buttons (some used elsewhere)
Upload : 'Enviar arquivo',
UploadTip : 'Enviar novo arquivo',
Refresh : 'Atualizar',
Settings : 'Configurações',
Help : 'Ajuda',
HelpTip : 'Ajuda',
// Context Menus
Select : 'Selecionar',
SelectThumbnail : 'Selecionar miniatura',
View : 'Visualizar',
Download : 'Download',
NewSubFolder : 'Nova sub-pasta',
Rename : 'Renomear',
Delete : 'Apagar',
CopyDragDrop : 'Copia arquivo aqui',
MoveDragDrop : 'Move arquivo aqui',
// Dialogs
RenameDlgTitle : 'Renomeia',
NewNameDlgTitle : 'Novo nome',
FileExistsDlgTitle : 'O arquivo já existe',
SysErrorDlgTitle : 'Erro de Sistema',
FileOverwrite : 'Sobrescrever',
FileAutorename : 'Renomeia automaticamente',
// Generic
OkBtn : 'OK',
CancelBtn : 'Cancelar',
CloseBtn : 'Fechar',
// Upload Panel
UploadTitle : 'Enviar novo arquivo',
UploadSelectLbl : 'Selecione o arquivo para enviar',
UploadProgressLbl : '(Enviado arquivo, favor aguardar...)',
UploadBtn : 'Enviar arquivo selecionado',
UploadBtnCancel : 'Cancelar',
UploadNoFileMsg : 'Favor selecionar o arquivo no seu computador.',
UploadNoFolder : 'Favor selecionar a pasta antes the enviar o arquivo.',
UploadNoPerms : 'Não é permitido o envio de arquivos.',
UploadUnknError : 'Erro no envio do arquivo.',
UploadExtIncorrect : 'A extensão deste arquivo não é permitida nesat pasta.',
// Flash Uploads
UploadLabel : 'Arquivos para Enviar',
UploadTotalFiles : 'Arquivos:',
UploadTotalSize : 'Tamanho:',
UploadAddFiles : 'Adicionar Arquivos',
UploadClearFiles : 'Remover Arquivos',
UploadCancel : 'Cancelar Envio',
UploadRemove : 'Remover',
UploadRemoveTip : 'Remover !f',
UploadUploaded : '!n% enviado',
UploadProcessing : 'Processando...',
// Settings Panel
SetTitle : 'Configurações',
SetView : 'Visualizar:',
SetViewThumb : 'Miniaturas',
SetViewList : 'Lista',
SetDisplay : 'Exibir:',
SetDisplayName : 'Arquivo',
SetDisplayDate : 'Data',
SetDisplaySize : 'Tamanho',
SetSort : 'Ordenar:',
SetSortName : 'por Nome do arquivo',
SetSortDate : 'por Data',
SetSortSize : 'por Tamanho',
// Status Bar
FilesCountEmpty : '<Pasta vazia>',
FilesCountOne : '1 arquivo',
FilesCountMany : '%1 arquivos',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'Não foi possível completer o seu pedido. (Erro %1)',
Errors :
{
10 : 'Comando inválido.',
11 : 'O tipo de recurso não foi especificado na solicitação.',
12 : 'O recurso solicitado não é válido.',
102 : 'Nome do arquivo ou pasta inválido.',
103 : 'Não foi possível completar a solicitação por restrições de acesso.',
104 : 'Não foi possível completar a solicitação por restrições de acesso do sistema de arquivos.',
105 : 'Extensão de arquivo inválida.',
109 : 'Solicitação inválida.',
110 : 'Erro desconhecido.',
115 : 'Uma arquivo ou pasta já existe com esse nome.',
116 : 'Pasta não encontrada. Atualize e tente novamente.',
117 : 'Arquivo não encontrado. Atualize a lista de arquivos e tente novamente.',
118 : 'Origem e destino são iguais.',
201 : 'Um arquivo com o mesmo nome já está disponível. O arquivo enviado foi renomeado para "%1".',
202 : 'Arquivo inválido.',
203 : 'Arquivo inválido. O tamanho é muito grande.',
204 : 'O arquivo enviado está corrompido.',
205 : 'Nenhuma pasta temporária para envio está disponível no servidor.',
206 : 'Transmissão cancelada por razões de segurança. O arquivo contem dados HTML.',
207 : 'O arquivo enviado foi renomeado para "%1".',
300 : 'Não foi possível mover o(s) arquivo(s).',
301 : 'Não foi possível copiar o(s) arquivos(s).',
500 : 'A navegação de arquivos está desativada por razões de segurança. Contacte o administrador do sistema.',
501 : 'O suporte a miniaturas está desabilitado.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'O nome do arquivo não pode ser vazio.',
FileExists : 'O nome %s já é em uso.',
FolderEmpty : 'O nome da pasta não pode ser vazio.',
FileInvChar : 'O nome do arquivo não pode conter nenhum desses caracteres: \n\\ / : * ? " < > |',
FolderInvChar : 'O nome da pasta não pode conter nenhum desses caracteres: \n\\ / : * ? " < > |',
PopupBlockView : 'Não foi possível abrir o arquivo em outra janela. Configure seu navegador e desabilite o bloqueio a popups para esse site.',
XmlError : 'Não foi possível carregar a resposta XML enviada pelo servidor.',
XmlEmpty : 'Não foi possível carregar a resposta XML enviada pelo servidor. Resposta vazia..',
XmlRawResponse : 'Resposta original enviada pelo servidor: %s'
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Redimensionar %s',
sizeTooBig : 'Não possível usar dimensões maiores do que as originais (%size).',
resizeSuccess : 'Imagem redimensionada corretamente.',
thumbnailNew : 'Cria nova anteprima',
thumbnailSmall : 'Pequeno (%s)',
thumbnailMedium : 'Médio (%s)',
thumbnailLarge : 'Grande (%s)',
newSize : 'Novas dimensões',
width : 'Largura',
height : 'Altura',
invalidHeight : 'Altura incorreta.',
invalidWidth : 'Largura incorreta.',
invalidName : 'O nome do arquivo não é válido.',
newImage : 'Cria nova imagem',
noExtensionChange : 'A extensão do arquivo não pode ser modificada.',
imageSmall : 'A imagem original é muito pequena.',
contextMenuName : 'Redimensionar',
lockRatio : 'Travar Proporções',
resetSize : 'Redefinir para o Tamanho Original'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Salva',
fileOpenError : 'Não é possível abrir o arquivo.',
fileSaveSuccess : 'Arquivo salvado corretamente.',
contextMenuName : 'Modificar',
loadingFile : 'Carregando arquivo. Por favor aguarde...'
},
Maximize :
{
maximize : 'Maximizar',
minimize : 'Minimizar'
}
};
| JavaScript |
/*
* CKFinder
* ========
* http://ckfinder.com
* Copyright (C) 2007-2011, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file, and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying, or distributing this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*
*/
/**
* @fileOverview Defines the {@link CKFinder.lang} object for the Norwegian
* Nynorsk language.
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKFinder.lang['no'] =
{
appTitle : 'CKFinder',
// Common messages and labels.
common :
{
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, utilgjenglig</span>',
confirmCancel : 'Noen av valgene har blitt endret. Er du sikker på at du vil lukke dialogen?',
ok : 'OK',
cancel : 'Avbryt',
confirmationTitle : 'Confirmation', // MISSING
messageTitle : 'Information', // MISSING
inputTitle : 'Question', // MISSING
undo : 'Angre',
redo : 'Gjør om',
skip : 'Skip', // MISSING
skipAll : 'Skip all', // MISSING
makeDecision : 'What action should be taken?', // MISSING
rememberDecision: 'Remember my decision' // MISSING
},
// Language direction, 'ltr' or 'rtl'.
dir : 'ltr',
HelpLang : 'en',
LangCode : 'no',
// Date Format
// d : Day
// dd : Day (padding zero)
// m : Month
// mm : Month (padding zero)
// yy : Year (two digits)
// yyyy : Year (four digits)
// h : Hour (12 hour clock)
// hh : Hour (12 hour clock, padding zero)
// H : Hour (24 hour clock)
// HH : Hour (24 hour clock, padding zero)
// M : Minute
// MM : Minute (padding zero)
// a : Firt char of AM/PM
// aa : AM/PM
DateTime : 'dd/mm/yyyy HH:MM',
DateAmPm : ['AM', 'PM'],
// Folders
FoldersTitle : 'Mapper',
FolderLoading : 'Laster...',
FolderNew : 'Skriv inn det nye mappenavnet: ',
FolderRename : 'Skriv inn det nye mappenavnet: ',
FolderDelete : 'Er du sikker på at du vil slette mappen "%1"?',
FolderRenaming : ' (Endrer mappenavn...)',
FolderDeleting : ' (Sletter...)',
// Files
FileRename : 'Skriv inn det nye filnavnet: ',
FileRenameExt : 'Er du sikker på at du vil endre filtypen? Filen kan bli ubrukelig.',
FileRenaming : 'Endrer filnavn...',
FileDelete : 'Er du sikker på at du vil slette denne filen "%1"?',
FilesLoading : 'Laster...',
FilesEmpty : 'The folder is empty.', // MISSING
FilesMoved : 'File %1 moved to %2:%3.', // MISSING
FilesCopied : 'File %1 copied to %2:%3.', // MISSING
// Basket
BasketFolder : 'Basket', // MISSING
BasketClear : 'Clear Basket', // MISSING
BasketRemove : 'Remove from Basket', // MISSING
BasketOpenFolder : 'Open Parent Folder', // MISSING
BasketTruncateConfirm : 'Do you really want to remove all files from the basket?', // MISSING
BasketRemoveConfirm : 'Do you really want to remove the file "%1" from the basket?', // MISSING
BasketEmpty : 'No files in the basket, drag and drop some.', // MISSING
BasketCopyFilesHere : 'Copy Files from Basket', // MISSING
BasketMoveFilesHere : 'Move Files from Basket', // MISSING
BasketPasteErrorOther : 'File %s error: %e', // MISSING
BasketPasteMoveSuccess : 'The following files were moved: %s', // MISSING
BasketPasteCopySuccess : 'The following files were copied: %s', // MISSING
// Toolbar Buttons (some used elsewhere)
Upload : 'Last opp',
UploadTip : 'Last opp en ny fil',
Refresh : 'Oppdater',
Settings : 'Innstillinger',
Help : 'Hjelp',
HelpTip : 'Hjelp finnes kun på engelsk',
// Context Menus
Select : 'Velg',
SelectThumbnail : 'Velg Miniatyr',
View : 'Vis fullversjon',
Download : 'Last ned',
NewSubFolder : 'Ny Undermappe',
Rename : 'Endre navn',
Delete : 'Slett',
CopyDragDrop : 'Copy File Here', // MISSING
MoveDragDrop : 'Move File Here', // MISSING
// Dialogs
RenameDlgTitle : 'Rename', // MISSING
NewNameDlgTitle : 'New Name', // MISSING
FileExistsDlgTitle : 'File Already Exists', // MISSING
SysErrorDlgTitle : 'System Error', // MISSING
FileOverwrite : 'Overwrite', // MISSING
FileAutorename : 'Auto-rename', // MISSING
// Generic
OkBtn : 'OK',
CancelBtn : 'Avbryt',
CloseBtn : 'Lukk',
// Upload Panel
UploadTitle : 'Last opp ny fil',
UploadSelectLbl : 'Velg filen du vil laste opp',
UploadProgressLbl : '(Laster opp filen, vennligst vent...)',
UploadBtn : 'Last opp valgt fil',
UploadBtnCancel : 'Avbryt',
UploadNoFileMsg : 'Du må velge en fil fra din datamaskin',
UploadNoFolder : 'Please select a folder before uploading.', // MISSING
UploadNoPerms : 'File upload not allowed.', // MISSING
UploadUnknError : 'Error sending the file.', // MISSING
UploadExtIncorrect : 'File extension not allowed in this folder.', // MISSING
// Flash Uploads
UploadLabel : 'Files to Upload', // MISSING
UploadTotalFiles : 'Total Files:', // MISSING
UploadTotalSize : 'Total Size:', // MISSING
UploadAddFiles : 'Add Files', // MISSING
UploadClearFiles : 'Clear Files', // MISSING
UploadCancel : 'Cancel Upload', // MISSING
UploadRemove : 'Remove', // MISSING
UploadRemoveTip : 'Remove !f', // MISSING
UploadUploaded : 'Uploaded !n%', // MISSING
UploadProcessing : 'Processing...', // MISSING
// Settings Panel
SetTitle : 'Innstillinger',
SetView : 'Filvisning:',
SetViewThumb : 'Miniatyrbilder',
SetViewList : 'Liste',
SetDisplay : 'Vis:',
SetDisplayName : 'Filnavn',
SetDisplayDate : 'Dato',
SetDisplaySize : 'Filstørrelse',
SetSort : 'Sorter etter:',
SetSortName : 'Filnavn',
SetSortDate : 'Dato',
SetSortSize : 'Størrelse',
// Status Bar
FilesCountEmpty : '<Tom Mappe>',
FilesCountOne : '1 fil',
FilesCountMany : '%1 filer',
// Size and Speed
Kb : '%1 kB',
KbPerSecond : '%1 kB/s',
// Connector Error Messages.
ErrorUnknown : 'Det var ikke mulig å utføre forespørselen. (Feil %1)',
Errors :
{
10 : 'Ugyldig kommando.',
11 : 'Ressurstypen ble ikke spesifisert i forepørselen.',
12 : 'Ugyldig ressurstype.',
102 : 'Ugyldig fil- eller mappenavn.',
103 : 'Kunne ikke utføre forespørselen pga manglende autorisasjon.',
104 : 'Kunne ikke utføre forespørselen pga manglende tilgang til filsystemet.',
105 : 'Ugyldig filtype.',
109 : 'Ugyldig forespørsel.',
110 : 'Ukjent feil.',
115 : 'Det finnes allerede en fil eller mappe med dette navnet.',
116 : 'Kunne ikke finne mappen. Oppdater vinduet og prøv igjen.',
117 : 'Kunne ikke finne filen. Oppdater vinduet og prøv igjen.',
118 : 'Source and target paths are equal.', // MISSING
201 : 'Det fantes allerede en fil med dette navnet. Den opplastede filens navn har blitt endret til "%1".',
202 : 'Ugyldig fil.',
203 : 'Ugyldig fil. Filen er for stor.',
204 : 'Den opplastede filen er korrupt.',
205 : 'Det finnes ingen midlertidig mappe for filopplastinger.',
206 : 'Opplastingen ble avbrutt av sikkerhetshensyn. Filen inneholder HTML-aktig data.',
207 : 'Den opplastede filens navn har blitt endret til "%1".',
300 : 'Moving file(s) failed.', // MISSING
301 : 'Copying file(s) failed.', // MISSING
500 : 'Filvelgeren ikke tilgjengelig av sikkerhetshensyn. Kontakt systemansvarlig og be han sjekke CKFinder\'s konfigurasjonsfil.',
501 : 'Funksjon for minityrbilder er skrudd av.'
},
// Other Error Messages.
ErrorMsg :
{
FileEmpty : 'Filnavnet kan ikke være tomt.',
FileExists : 'File %s already exists.', // MISSING
FolderEmpty : 'Mappenavnet kan ikke være tomt.',
FileInvChar : 'Filnavnet kan ikke inneholde følgende tegn: \n\\ / : * ? " < > |',
FolderInvChar : 'Mappenavnet kan ikke inneholde følgende tegn: \n\\ / : * ? " < > |',
PopupBlockView : 'Du må skru av popup-blockeren for å se bildet i nytt vindu.',
XmlError : 'It was not possible to properly load the XML response from the web server.', // MISSING
XmlEmpty : 'It was not possible to load the XML response from the web server. The server returned an empty response.', // MISSING
XmlRawResponse : 'Raw response from the server: %s' // MISSING
},
// Imageresize plugin
Imageresize :
{
dialogTitle : 'Resize %s', // MISSING
sizeTooBig : 'Cannot set image height or width to a value bigger than the original size (%size).', // MISSING
resizeSuccess : 'Image resized successfully.', // MISSING
thumbnailNew : 'Create a new thumbnail', // MISSING
thumbnailSmall : 'Small (%s)', // MISSING
thumbnailMedium : 'Medium (%s)', // MISSING
thumbnailLarge : 'Large (%s)', // MISSING
newSize : 'Set a new size', // MISSING
width : 'Bredde',
height : 'Høyde',
invalidHeight : 'Invalid height.', // MISSING
invalidWidth : 'Invalid width.', // MISSING
invalidName : 'Invalid file name.', // MISSING
newImage : 'Create a new image', // MISSING
noExtensionChange : 'File extension cannot be changed.', // MISSING
imageSmall : 'Source image is too small.', // MISSING
contextMenuName : 'Resize', // MISSING
lockRatio : 'Lås forhold',
resetSize : 'Tilbakestill størrelse'
},
// Fileeditor plugin
Fileeditor :
{
save : 'Lagre',
fileOpenError : 'Unable to open file.', // MISSING
fileSaveSuccess : 'File saved successfully.', // MISSING
contextMenuName : 'Edit', // MISSING
loadingFile : 'Loading file, please wait...' // MISSING
},
Maximize :
{
maximize : 'Maksimer',
minimize : 'Minimer'
}
};
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckfinder.com/license
*/
CKFinder.customConfig = function( config )
{
// Define changes to default configuration here.
// For the list of available options, check:
// http://docs.cksource.com/ckfinder_2.x_api/symbols/CKFinder.config.html
// Sample configuration options:
// config.uiColor = '#BDE31E';
// config.language = 'fr';
// config.removePlugins = 'basket';
};
| JavaScript |
CKFinder.addPlugin( 'imageresize', {
connectorInitialized : function( api, xml ) {
var node = xml.selectSingleNode( 'Connector/PluginsInfo/imageresize/@smallThumb' );
if ( node )
CKFinder.config.imageresize_thumbSmall = node.value;
node = xml.selectSingleNode( 'Connector/PluginsInfo/imageresize/@mediumThumb' );
if ( node )
CKFinder.config.imageresize_thumbMedium = node.value;
node = xml.selectSingleNode( 'Connector/PluginsInfo/imageresize/@largeThumb' );
if ( node )
CKFinder.config.imageresize_thumbLarge = node.value;
},
uiReady : function( api ) {
var regexExt = /^(.*)\.([^\.]+)$/,
regexFileName = /^(.*?)(?:_\d+x\d+)?\.([^\.]+)$/,
regexGetSize = /^\s*(\d+)(px)?\s*$/i,
regexGetSizeOrEmpty = /(^\s*(\d+)(px)?\s*$)|^$/i,
imageDimension = { width : 0, height : 0 },
file,
doc;
var updateFileName = function( dialog )
{
var width = dialog.getValueOf( 'tab1', 'width' ) || 0,
height = dialog.getValueOf( 'tab1', 'height' ) || 0,
e = dialog.getContentElement('tab1', 'createNewBox');
if ( width && height )
{
var matches = file.name.match( regexFileName );
dialog.setValueOf( 'tab1', 'fileName', matches[1] + "_" + width + "x" + height + "." + matches[2]);
e.getElement().show();
}
else
e.getElement().hide();
};
var onSizeChange = function()
{
var value = this.getValue(), // This = input element.
dialog = this.getDialog(),
maxWidth = api.config.imagesMaxWidth,
maxHeight = api.config.imagesMaxHeight,
aMatch = value.match( regexGetSize ),
width = imageDimension.width,
height = imageDimension.height,
newHeight,
newWidth;
if ( aMatch )
value = aMatch[1];
if ( !api.config.imageresize_allowEnlarging )
{
if ( width && width < maxWidth )
maxWidth = width;
if ( height && height < maxHeight )
maxHeight = height;
}
if ( maxHeight > 0 && this.id == 'height' && value > maxHeight )
{
value = maxHeight;
dialog.setValueOf( 'tab1', 'height', value );
}
if ( maxWidth > 0 && this.id == 'width' && value > maxWidth )
{
value = maxWidth;
dialog.setValueOf( 'tab1', 'width', value );
}
// Only if ratio is locked
if ( dialog.lockRatio && width && height )
{
if ( this.id == 'height' )
{
if ( value && value != '0' )
value = Math.round( width * ( value / height ) );
if ( !isNaN( value ) )
{
// newWidth > maxWidth
if ( maxWidth > 0 && value > maxWidth )
{
value = maxWidth;
newHeight = Math.round( height * ( value / width ) );
dialog.setValueOf( 'tab1', 'height', newHeight );
}
dialog.setValueOf( 'tab1', 'width', value );
}
}
else //this.id = txtWidth.
{
if ( value && value != '0' )
value = Math.round( height * ( value / width ) );
if ( !isNaN( value ) )
{
// newHeight > maxHeight
if ( maxHeight > 0 && value > maxHeight )
{
value = maxHeight;
newWidth = Math.round( width * ( value / height ) );
dialog.setValueOf( 'tab1', 'width', newWidth );
}
dialog.setValueOf( 'tab1', 'height', value );
}
}
}
updateFileName( dialog );
};
var resetSize = function( dialog )
{
if ( imageDimension.width && imageDimension.height )
{
dialog.setValueOf( 'tab1', 'width', imageDimension.width );
dialog.setValueOf( 'tab1', 'height', imageDimension.height );
updateFileName( dialog );
}
};
var switchLockRatio = function( dialog, value )
{
var doc = dialog.getElement().getDocument(),
ratioButton = doc.getById( 'btnLockSizes' );
if ( imageDimension.width && imageDimension.height )
{
if ( value == 'check' ) // Check image ratio and original image ratio.
{
var width = dialog.getValueOf( 'tab1', 'width' ),
height = dialog.getValueOf( 'tab1', 'height' ),
originalRatio = imageDimension.width * 1000 / imageDimension.height,
thisRatio = width * 1000 / height;
dialog.lockRatio = false; // Default: unlock ratio
if ( !width && !height )
dialog.lockRatio = true; // If someone didn't start typing, lock ratio.
else if ( !isNaN( originalRatio ) && !isNaN( thisRatio ) )
{
if ( Math.round( originalRatio ) == Math.round( thisRatio ) )
dialog.lockRatio = true;
}
}
else if ( value != undefined )
dialog.lockRatio = value;
else
dialog.lockRatio = !dialog.lockRatio;
}
else if ( value != 'check' ) // I can't lock ratio if ratio is unknown.
dialog.lockRatio = false;
if ( dialog.lockRatio )
ratioButton.removeClass( 'ckf_btn_unlocked' );
else
ratioButton.addClass( 'ckf_btn_unlocked' );
return dialog.lockRatio;
};
CKFinder.dialog.add( 'resizeDialog', function( api )
{
return {
title : api.lang.Imageresize.dialogTitle.replace( '%s', api.getSelectedFile().name ),
// TODO resizable : CKFINDER.DIALOG_RESIZE_BOTH
minWidth : 390,
minHeight : 230,
onShow : function() {
var dialog = this,
thumbSmall = CKFinder.config.imageresize_thumbSmall,
thumbMedium = CKFinder.config.imageresize_thumbMedium,
thumbLarge = CKFinder.config.imageresize_thumbLarge;
doc = dialog.getElement().getDocument();
file = api.getSelectedFile();
this.setTitle( api.lang.Imageresize.dialogTitle.replace( '%s', file.name ) );
var previewImg = doc.getById('previewImage');
var sizeSpan = doc.getById('imageSize');
previewImg.setAttribute('src', file.getThumbnailUrl( true ));
var updateImgDimension = function( width, height ) {
if ( !width || !height )
{
sizeSpan.setText( '' );
return;
}
imageDimension.width = width;
imageDimension.height = height;
sizeSpan.setText( width + " x " + height + " px" );
CKFinder.tools.setTimeout( function(){ switchLockRatio( dialog, 'check' ); }, 0, dialog );
};
api.connector.sendCommand( "ImageResizeInfo", {
fileName : file.name
},
function( xml ) {
if ( xml.checkError() )
return;
var width = xml.selectSingleNode( 'Connector/ImageInfo/@width' ),
height = xml.selectSingleNode( 'Connector/ImageInfo/@height' ),
result;
if ( width && height )
{
width = parseInt( width.value, 10 );
height = parseInt( height.value, 10 );
updateImgDimension( width, height );
var checkThumbs = function( id, size ) {
if ( !size )
return;
var reThumb = /^(\d+)x(\d+)$/;
result = reThumb.exec( size );
var el = dialog.getContentElement( 'tab1', id );
if ( 0 + result[1] > width && 0 + result[2] > height )
{
el.disable();
el.getElement().setAttribute('title', api.lang.Imageresize.imageSmall).addClass('cke_disabled');
}
else
{
el.enable();
el.getElement().setAttribute('title', '').removeClass('cke_disabled');
}
};
checkThumbs('smallThumb', thumbSmall );
checkThumbs('mediumThumb', thumbMedium );
checkThumbs('largeThumb', thumbLarge );
}
},
file.folder.type,
file.folder
);
if ( !thumbSmall )
dialog.getContentElement('tab1', 'smallThumb').getElement().hide();
if ( !thumbMedium )
dialog.getContentElement('tab1', 'mediumThumb').getElement().hide();
if ( !thumbLarge )
dialog.getContentElement('tab1', 'largeThumb').getElement().hide();
if ( !thumbSmall && !thumbMedium && !thumbLarge )
dialog.getContentElement('tab1', 'thumbsLabel').getElement().hide();
dialog.setValueOf( 'tab1', 'fileName', file.name );
dialog.getContentElement('tab1', 'width').focus();
dialog.getContentElement('tab1', 'fileName').setValue('');
dialog.getContentElement('tab1', 'createNewBox').getElement().hide();
updateImgDimension( 0,0 );
},
onOk : function() {
var dialog = this,
width = dialog.getValueOf( 'tab1', 'width' ),
height = dialog.getValueOf( 'tab1', 'height' ),
small = dialog.getValueOf( 'tab1', 'smallThumb' ),
medium = dialog.getValueOf( 'tab1', 'mediumThumb' ),
large = dialog.getValueOf( 'tab1', 'largeThumb' ),
fileName = dialog.getValueOf( 'tab1', 'fileName' ),
createNew = dialog.getValueOf( 'tab1', 'createNew' );
if ( width && !height )
{
api.openMsgDialog( '', api.lang.Imageresize.invalidHeight );
return false;
}
else if ( !width && height )
{
api.openMsgDialog( '', api.lang.Imageresize.invalidWidth );
return false;
}
if ( !api.config.imageresize_allowEnlarging && ( parseInt( width, 10 ) > imageDimension.width || parseInt( height, 10 ) > imageDimension.height ) )
{
var str = api.lang.Imageresize.sizeTooBig;
api.openMsgDialog( '', str.replace( "%size", imageDimension.width + "x" + imageDimension.height ) );
return false;
}
if ( ( width && height ) || small || medium || large )
{
if ( !createNew )
fileName = file.name;
api.connector.sendCommandPost( "ImageResize", null, {
width : width,
height : height,
fileName : file.name,
newFileName : fileName,
overwrite : createNew ? 0 : 1,
small : small ? 1 : 0,
medium : medium ? 1 : 0,
large : large ? 1 : 0
},
function( xml ) {
if ( xml.checkError() )
return;
api.openMsgDialog( '', api.lang.Imageresize.resizeSuccess );
api.refreshOpenedFolder();
},
file.folder.type,
file.folder
);
}
return undefined;
},
contents : [
{
id : 'tab1',
label : '',
title : '',
expand : true,
padding : 0,
elements :
[
{
type : 'hbox',
widths : [ '180px', '280px' ],
children:
[
{
type : 'vbox',
children:
[
{
type : 'html',
html : '' +
'<style type="text/css">' +
'a.ckf_btn_reset' +
'{' +
'float: right;' +
'background-position: 0 -32px;' +
'background-image: url("' + CKFinder.getPluginPath('imageresize') + 'images/mini.gif");' +
'width: 16px;' +
'height: 16px;' +
'background-repeat: no-repeat;' +
'border: 1px none;' +
'font-size: 1px;' +
'}' +
'a.ckf_btn_locked,' +
'a.ckf_btn_unlocked' +
'{' +
'float: left;' +
'background-position: 0 0;' +
'background-image: url("' + CKFinder.getPluginPath('imageresize') + 'images/mini.gif");' +
'width: 16px;' +
'height: 16px;' +
'background-repeat: no-repeat;' +
'border: none 1px;' +
'font-size: 1px;' +
'}' +
'a.ckf_btn_unlocked' +
'{' +
'background-position: 0 -16px;' +
'background-image: url("' + CKFinder.getPluginPath('imageresize') + '/images/mini.gif");' +
'}' +
'.ckf_btn_over' +
'{' +
'border: outset 1px;' +
'cursor: pointer;' +
'cursor: hand;' +
'}' +
'</style>' +
'<div style="height:100px;padding:7px">' +
'<img id="previewImage" src="" style="margin-bottom:4px;" /><br />' +
'<span style="font-size:9px;" id="imageSize"></span>' +
'</div>'
},
{
type : 'html',
id : 'thumbsLabel',
html : '<strong>' + api.lang.Imageresize.thumbnailNew + '</strong>'
},
{
type : 'checkbox',
id : 'smallThumb',
checked : false,
label : api.lang.Imageresize.thumbnailSmall.replace( '%s', CKFinder.config.imageresize_thumbSmall )
},
{
type : 'checkbox',
id : 'mediumThumb',
checked : false,
label : api.lang.Imageresize.thumbnailMedium.replace( '%s', CKFinder.config.imageresize_thumbMedium )
},
{
type : 'checkbox',
id : 'largeThumb',
checked : false,
label : api.lang.Imageresize.thumbnailLarge.replace( '%s', CKFinder.config.imageresize_thumbLarge )
}
]
},
{
type : 'vbox',
children :
[
{
type : 'html',
html : '<strong>' + api.lang.Imageresize.newSize + '</strong>'
},
{
type : 'hbox',
widths : [ '80%', '20%' ],
children:
[
{
type : 'vbox',
children:
[
{
type : 'text',
labelLayout : 'horizontal',
label : api.lang.Imageresize.width,
onKeyUp : onSizeChange,
validate: function()
{
var value = this.getValue();
if ( value )
{
var aMatch = value.match( regexGetSize );
if ( !aMatch || parseInt( aMatch[1], 10 ) < 1 )
{
api.openMsgDialog( '', api.lang.Imageresize.invalidWidth );
return false;
}
}
return true;
},
id : 'width'
},
{
type : 'text',
labelLayout : 'horizontal',
label : api.lang.Imageresize.height,
onKeyUp : onSizeChange,
validate: function()
{
var value = this.getValue();
if ( value )
{
var aMatch = value.match( regexGetSize );
if ( !aMatch || parseInt( aMatch[1], 10 ) < 1 )
{
api.openMsgDialog( '', api.lang.Imageresize.invalidHeight );
return false;
}
}
return true;
},
id : 'height'
}
]
},
{
type : 'html',
onLoad : function()
{
var doc = this.getElement().getDocument(),
dialog = this.getDialog();
// Activate Reset button
var resetButton = doc.getById( 'btnResetSize' ),
ratioButton = doc.getById( 'btnLockSizes' );
if ( resetButton )
{
resetButton.on( 'click', function(evt)
{
resetSize( this );
evt.data.preventDefault();
}, dialog );
resetButton.on( 'mouseover', function()
{
this.addClass( 'ckf_btn_over' );
}, resetButton );
resetButton.on( 'mouseout', function()
{
this.removeClass( 'ckf_btn_over' );
}, resetButton );
}
// Activate (Un)LockRatio button
if ( ratioButton )
{
ratioButton.on( 'click', function(evt)
{
var locked = switchLockRatio( this ),
width = this.getValueOf( 'tab1', 'width' );
if ( imageDimension.width && width )
{
var height = imageDimension.height / imageDimension.width * width;
if ( !isNaN( height ) )
{
this.setValueOf( 'tab1', 'height', Math.round( height ) );
updateFileName( dialog );
}
}
evt.data.preventDefault();
}, dialog );
ratioButton.on( 'mouseover', function()
{
this.addClass( 'ckf_btn_over' );
}, ratioButton );
ratioButton.on( 'mouseout', function()
{
this.removeClass( 'ckf_btn_over' );
}, ratioButton );
}
},
html : '<div style="margin-top:4px">'+
'<a href="javascript:void(0)" tabindex="-1" title="' + api.lang.Imageresize.lockRatio + '" class="ckf_btn_locked ckf_btn_unlocked" id="btnLockSizes"></a>' +
'<a href="javascript:void(0)" tabindex="-1" title="' + api.lang.Imageresize.resetSize + '" class="ckf_btn_reset" id="btnResetSize"></a>'+
'</div>'
}
]
},
{
type : 'vbox',
id : 'createNewBox',
hidden : true,
children:
[
{
type : 'checkbox',
checked : true,
id : 'createNew',
label : api.lang.Imageresize.newImage,
'default' : true,
onChange : function() {
var dialog = this.getDialog();
var filenameInput = dialog.getContentElement('tab1', 'fileName');
if ( filenameInput ) {
if (!this.getValue())
filenameInput.getElement().hide();
else
filenameInput.getElement().show();
}
}
},
{
type : 'text',
label : '',
validate : function() {
var dialog = this.getDialog(),
createNew = dialog.getContentElement('tab1', 'createNew'),
value = this.getValue(),
matches = value.match( regexExt );
if ( createNew && dialog.getValueOf( 'tab1', 'width' ) && dialog.getValueOf( 'tab1', 'height' ) )
{
if ( !value || !matches ) {
api.openMsgDialog( '', api.lang.Imageresize.invalidName );
return false;
}
if ( file.ext != matches[2] ) {
api.openMsgDialog( '', api.lang.Imageresize.noExtensionChange );
return false;
}
}
return true;
},
id : 'fileName'
}
]
}
]
}
]
}
]
}
],
// TODO http://dev.fckeditor.net/ticket/4750
buttons : [ CKFinder.dialog.okButton, CKFinder.dialog.cancelButton ]
};
} );
api.addFileContextMenuOption( { label : api.lang.Imageresize.contextMenuName, command : "resizeImage" } , function( api, file )
{
api.openDialog( 'resizeDialog' );
},
function ( file )
{
// Disable for files other than images.
if ( !file.isImage() || !api.getSelectedFolder().type )
return false;
if ( file.folder.acl.fileDelete && file.folder.acl.fileUpload )
return true;
else
return -1;
});
}
} );
| JavaScript |
/* Demonstration of embedding CodeMirror in a bigger application. The
* interface defined here is a mess of prompts and confirms, and
* should probably not be used in a real project.
*/
function MirrorFrame(place, options) {
this.home = document.createElement("div");
if (place.appendChild)
place.appendChild(this.home);
else
place(this.home);
var self = this;
function makeButton(name, action) {
var button = document.createElement("input");
button.type = "button";
button.value = name;
self.home.appendChild(button);
button.onclick = function(){self[action].call(self);};
}
makeButton("Search", "search");
makeButton("Replace", "replace");
makeButton("Current line", "line");
makeButton("Jump to line", "jump");
makeButton("Insert constructor", "macro");
makeButton("Indent all", "reindent");
this.mirror = new CodeMirror(this.home, options);
}
MirrorFrame.prototype = {
search: function() {
var text = prompt("Enter search term:", "");
if (!text) return;
var first = true;
do {
var cursor = this.mirror.getSearchCursor(text, first);
first = false;
while (cursor.findNext()) {
cursor.select();
if (!confirm("Search again?"))
return;
}
} while (confirm("End of document reached. Start over?"));
},
replace: function() {
// This is a replace-all, but it is possible to implement a
// prompting replace.
var from = prompt("Enter search string:", ""), to;
if (from) to = prompt("What should it be replaced with?", "");
if (to == null) return;
var cursor = this.mirror.getSearchCursor(from, false);
while (cursor.findNext())
cursor.replace(to);
},
jump: function() {
var line = prompt("Jump to line:", "");
if (line && !isNaN(Number(line)))
this.mirror.jumpToLine(Number(line));
},
line: function() {
alert("The cursor is currently at line " + this.mirror.currentLine());
this.mirror.focus();
},
macro: function() {
var name = prompt("Name your constructor:", "");
if (name)
this.mirror.replaceSelection("function " + name + "() {\n \n}\n\n" + name + ".prototype = {\n \n};\n");
},
reindent: function() {
this.mirror.reindent();
}
};
| JavaScript |
var HTMLMixedParser = Editor.Parser = (function() {
// tags that trigger seperate parsers
var triggers = {
"script": "JSParser",
"style": "CSSParser"
};
function checkDependencies() {
var parsers = ['XMLParser'];
for (var p in triggers) parsers.push(triggers[p]);
for (var i in parsers) {
if (!window[parsers[i]]) throw new Error(parsers[i] + " parser must be loaded for HTML mixed mode to work.");
}
XMLParser.configure({useHTMLKludges: true});
}
function parseMixed(stream) {
checkDependencies();
var htmlParser = XMLParser.make(stream), localParser = null, inTag = false;
var iter = {next: top, copy: copy};
function top() {
var token = htmlParser.next();
if (token.content == "<")
inTag = true;
else if (token.style == "xml-tagname" && inTag === true)
inTag = token.content.toLowerCase();
else if (token.content == ">") {
if (triggers[inTag]) {
var parser = window[triggers[inTag]];
iter.next = local(parser, "</" + inTag);
}
inTag = false;
}
return token;
}
function local(parser, tag) {
var baseIndent = htmlParser.indentation();
localParser = parser.make(stream, baseIndent + indentUnit);
return function() {
if (stream.lookAhead(tag, false, false, true)) {
localParser = null;
iter.next = top;
return top();
}
var token = localParser.next();
var lt = token.value.lastIndexOf("<"), sz = Math.min(token.value.length - lt, tag.length);
if (lt != -1 && token.value.slice(lt, lt + sz).toLowerCase() == tag.slice(0, sz) &&
stream.lookAhead(tag.slice(sz), false, false, true)) {
stream.push(token.value.slice(lt));
token.value = token.value.slice(0, lt);
}
if (token.indentation) {
var oldIndent = token.indentation;
token.indentation = function(chars) {
if (chars == "</")
return baseIndent;
else
return oldIndent(chars);
};
}
return token;
};
}
function copy() {
var _html = htmlParser.copy(), _local = localParser && localParser.copy(),
_next = iter.next, _inTag = inTag;
return function(_stream) {
stream = _stream;
htmlParser = _html(_stream);
localParser = _local && _local(_stream);
iter.next = _next;
inTag = _inTag;
return iter;
};
}
return iter;
}
return {
make: parseMixed,
electricChars: "{}/:",
configure: function(obj) {
if (obj.triggers) triggers = obj.triggers;
}
};
})();
| JavaScript |
/* Simple parser for CSS */
var CSSParser = Editor.Parser = (function() {
var tokenizeCSS = (function() {
function normal(source, setState) {
var ch = source.next();
if (ch == "@") {
source.nextWhileMatches(/\w/);
return "css-at";
}
else if (ch == "/" && source.equals("*")) {
setState(inCComment);
return null;
}
else if (ch == "<" && source.equals("!")) {
setState(inSGMLComment);
return null;
}
else if (ch == "=") {
return "css-compare";
}
else if (source.equals("=") && (ch == "~" || ch == "|")) {
source.next();
return "css-compare";
}
else if (ch == "\"" || ch == "'") {
setState(inString(ch));
return null;
}
else if (ch == "#") {
source.nextWhileMatches(/\w/);
return "css-hash";
}
else if (ch == "!") {
source.nextWhileMatches(/[ \t]/);
source.nextWhileMatches(/\w/);
return "css-important";
}
else if (/\d/.test(ch)) {
source.nextWhileMatches(/[\w.%]/);
return "css-unit";
}
else if (/[,.+>*\/]/.test(ch)) {
return "css-select-op";
}
else if (/[;{}:\[\]]/.test(ch)) {
return "css-punctuation";
}
else {
source.nextWhileMatches(/[\w\\\-_]/);
return "css-identifier";
}
}
function inCComment(source, setState) {
var maybeEnd = false;
while (!source.endOfLine()) {
var ch = source.next();
if (maybeEnd && ch == "/") {
setState(normal);
break;
}
maybeEnd = (ch == "*");
}
return "css-comment";
}
function inSGMLComment(source, setState) {
var dashes = 0;
while (!source.endOfLine()) {
var ch = source.next();
if (dashes >= 2 && ch == ">") {
setState(normal);
break;
}
dashes = (ch == "-") ? dashes + 1 : 0;
}
return "css-comment";
}
function inString(quote) {
return function(source, setState) {
var escaped = false;
while (!source.endOfLine()) {
var ch = source.next();
if (ch == quote && !escaped)
break;
escaped = !escaped && ch == "\\";
}
if (!escaped)
setState(normal);
return "css-string";
};
}
return function(source, startState) {
return tokenizer(source, startState || normal);
};
})();
function indentCSS(inBraces, inRule, base) {
return function(nextChars) {
if (!inBraces || /^\}/.test(nextChars)) return base;
else if (inRule) return base + indentUnit * 2;
else return base + indentUnit;
};
}
// This is a very simplistic parser -- since CSS does not really
// nest, it works acceptably well, but some nicer colouroing could
// be provided with a more complicated parser.
function parseCSS(source, basecolumn) {
basecolumn = basecolumn || 0;
var tokens = tokenizeCSS(source);
var inBraces = false, inRule = false, inDecl = false;;
var iter = {
next: function() {
var token = tokens.next(), style = token.style, content = token.content;
if (style == "css-hash")
style = token.style = inRule ? "css-colorcode" : "css-identifier";
if (style == "css-identifier") {
if (inRule) token.style = "css-value";
else if (!inBraces && !inDecl) token.style = "css-selector";
}
if (content == "\n")
token.indentation = indentCSS(inBraces, inRule, basecolumn);
if (content == "{" && inDecl == "@media")
inDecl = false;
else if (content == "{")
inBraces = true;
else if (content == "}")
inBraces = inRule = inDecl = false;
else if (content == ";")
inRule = inDecl = false;
else if (inBraces && style != "css-comment" && style != "whitespace")
inRule = true;
else if (!inBraces && style == "css-at")
inDecl = content;
return token;
},
copy: function() {
var _inBraces = inBraces, _inRule = inRule, _tokenState = tokens.state;
return function(source) {
tokens = tokenizeCSS(source, _tokenState);
inBraces = _inBraces;
inRule = _inRule;
return iter;
};
}
};
return iter;
}
return {make: parseCSS, electricChars: "}"};
})();
| JavaScript |
/* Functionality for finding, storing, and restoring selections
*
* This does not provide a generic API, just the minimal functionality
* required by the CodeMirror system.
*/
// Namespace object.
var select = {};
(function() {
select.ie_selection = document.selection && document.selection.createRangeCollection;
// Find the 'top-level' (defined as 'a direct child of the node
// passed as the top argument') node that the given node is
// contained in. Return null if the given node is not inside the top
// node.
function topLevelNodeAt(node, top) {
while (node && node.parentNode != top)
node = node.parentNode;
return node;
}
// Find the top-level node that contains the node before this one.
function topLevelNodeBefore(node, top) {
while (!node.previousSibling && node.parentNode != top)
node = node.parentNode;
return topLevelNodeAt(node.previousSibling, top);
}
var fourSpaces = "\u00a0\u00a0\u00a0\u00a0";
select.scrollToNode = function(node, cursor) {
if (!node) return;
var element = node, body = document.body,
html = document.documentElement,
atEnd = !element.nextSibling || !element.nextSibling.nextSibling
|| !element.nextSibling.nextSibling.nextSibling;
// In Opera (and recent Webkit versions), BR elements *always*
// have a offsetTop property of zero.
var compensateHack = 0;
while (element && !element.offsetTop) {
compensateHack++;
element = element.previousSibling;
}
// atEnd is another kludge for these browsers -- if the cursor is
// at the end of the document, and the node doesn't have an
// offset, just scroll to the end.
if (compensateHack == 0) atEnd = false;
// WebKit has a bad habit of (sometimes) happily returning bogus
// offsets when the document has just been changed. This seems to
// always be 5/5, so we don't use those.
if (webkit && element && element.offsetTop == 5 && element.offsetLeft == 5)
return;
var y = compensateHack * (element ? element.offsetHeight : 0), x = 0,
width = (node ? node.offsetWidth : 0), pos = element;
while (pos && pos.offsetParent) {
y += pos.offsetTop;
// Don't count X offset for <br> nodes
if (!isBR(pos))
x += pos.offsetLeft;
pos = pos.offsetParent;
}
var scroll_x = body.scrollLeft || html.scrollLeft || 0,
scroll_y = body.scrollTop || html.scrollTop || 0,
scroll = false, screen_width = window.innerWidth || html.clientWidth || 0;
if (cursor || width < screen_width) {
if (cursor) {
var off = select.offsetInNode(node), size = nodeText(node).length;
if (size) x += width * (off / size);
}
var screen_x = x - scroll_x;
if (screen_x < 0 || screen_x > screen_width) {
scroll_x = x;
scroll = true;
}
}
var screen_y = y - scroll_y;
if (screen_y < 0 || atEnd || screen_y > (window.innerHeight || html.clientHeight || 0) - 50) {
scroll_y = atEnd ? 1e6 : y;
scroll = true;
}
if (scroll) window.scrollTo(scroll_x, scroll_y);
};
select.scrollToCursor = function(container) {
select.scrollToNode(select.selectionTopNode(container, true) || container.firstChild, true);
};
// Used to prevent restoring a selection when we do not need to.
var currentSelection = null;
select.snapshotChanged = function() {
if (currentSelection) currentSelection.changed = true;
};
// Find the 'leaf' node (BR or text) after the given one.
function baseNodeAfter(node) {
var next = node.nextSibling;
if (next) {
while (next.firstChild) next = next.firstChild;
if (next.nodeType == 3 || isBR(next)) return next;
else return baseNodeAfter(next);
}
else {
var parent = node.parentNode;
while (parent && !parent.nextSibling) parent = parent.parentNode;
return parent && baseNodeAfter(parent);
}
}
// This is called by the code in editor.js whenever it is replacing
// a text node. The function sees whether the given oldNode is part
// of the current selection, and updates this selection if it is.
// Because nodes are often only partially replaced, the length of
// the part that gets replaced has to be taken into account -- the
// selection might stay in the oldNode if the newNode is smaller
// than the selection's offset. The offset argument is needed in
// case the selection does move to the new object, and the given
// length is not the whole length of the new node (part of it might
// have been used to replace another node).
select.snapshotReplaceNode = function(from, to, length, offset) {
if (!currentSelection) return;
function replace(point) {
if (from == point.node) {
currentSelection.changed = true;
if (length && point.offset > length) {
point.offset -= length;
}
else {
point.node = to;
point.offset += (offset || 0);
}
}
else if (select.ie_selection && point.offset == 0 && point.node == baseNodeAfter(from)) {
currentSelection.changed = true;
}
}
replace(currentSelection.start);
replace(currentSelection.end);
};
select.snapshotMove = function(from, to, distance, relative, ifAtStart) {
if (!currentSelection) return;
function move(point) {
if (from == point.node && (!ifAtStart || point.offset == 0)) {
currentSelection.changed = true;
point.node = to;
if (relative) point.offset = Math.max(0, point.offset + distance);
else point.offset = distance;
}
}
move(currentSelection.start);
move(currentSelection.end);
};
// Most functions are defined in two ways, one for the IE selection
// model, one for the W3C one.
if (select.ie_selection) {
function selRange() {
var sel = document.selection;
return sel && (sel.createRange || sel.createTextRange)();
}
function selectionNode(start) {
var range = selRange();
range.collapse(start);
function nodeAfter(node) {
var found = null;
while (!found && node) {
found = node.nextSibling;
node = node.parentNode;
}
return nodeAtStartOf(found);
}
function nodeAtStartOf(node) {
while (node && node.firstChild) node = node.firstChild;
return {node: node, offset: 0};
}
var containing = range.parentElement();
if (!isAncestor(document.body, containing)) return null;
if (!containing.firstChild) return nodeAtStartOf(containing);
var working = range.duplicate();
working.moveToElementText(containing);
working.collapse(true);
for (var cur = containing.firstChild; cur; cur = cur.nextSibling) {
if (cur.nodeType == 3) {
var size = cur.nodeValue.length;
working.move("character", size);
}
else {
working.moveToElementText(cur);
working.collapse(false);
}
var dir = range.compareEndPoints("StartToStart", working);
if (dir == 0) return nodeAfter(cur);
if (dir == 1) continue;
if (cur.nodeType != 3) return nodeAtStartOf(cur);
working.setEndPoint("StartToEnd", range);
return {node: cur, offset: size - working.text.length};
}
return nodeAfter(containing);
}
select.markSelection = function() {
currentSelection = null;
var sel = document.selection;
if (!sel) return;
var start = selectionNode(true),
end = selectionNode(false);
if (!start || !end) return;
currentSelection = {start: start, end: end, changed: false};
};
select.selectMarked = function() {
if (!currentSelection || !currentSelection.changed) return;
function makeRange(point) {
var range = document.body.createTextRange(),
node = point.node;
if (!node) {
range.moveToElementText(document.body);
range.collapse(false);
}
else if (node.nodeType == 3) {
range.moveToElementText(node.parentNode);
var offset = point.offset;
while (node.previousSibling) {
node = node.previousSibling;
offset += (node.innerText || "").length;
}
range.move("character", offset);
}
else {
range.moveToElementText(node);
range.collapse(true);
}
return range;
}
var start = makeRange(currentSelection.start), end = makeRange(currentSelection.end);
start.setEndPoint("StartToEnd", end);
start.select();
};
select.offsetInNode = function(node) {
var range = selRange();
if (!range) return 0;
var range2 = range.duplicate();
try {range2.moveToElementText(node);} catch(e){return 0;}
range.setEndPoint("StartToStart", range2);
return range.text.length;
};
// Get the top-level node that one end of the cursor is inside or
// after. Note that this returns false for 'no cursor', and null
// for 'start of document'.
select.selectionTopNode = function(container, start) {
var range = selRange();
if (!range) return false;
var range2 = range.duplicate();
range.collapse(start);
var around = range.parentElement();
if (around && isAncestor(container, around)) {
// Only use this node if the selection is not at its start.
range2.moveToElementText(around);
if (range.compareEndPoints("StartToStart", range2) == 1)
return topLevelNodeAt(around, container);
}
// Move the start of a range to the start of a node,
// compensating for the fact that you can't call
// moveToElementText with text nodes.
function moveToNodeStart(range, node) {
if (node.nodeType == 3) {
var count = 0, cur = node.previousSibling;
while (cur && cur.nodeType == 3) {
count += cur.nodeValue.length;
cur = cur.previousSibling;
}
if (cur) {
try{range.moveToElementText(cur);}
catch(e){return false;}
range.collapse(false);
}
else range.moveToElementText(node.parentNode);
if (count) range.move("character", count);
}
else {
try{range.moveToElementText(node);}
catch(e){return false;}
}
return true;
}
// Do a binary search through the container object, comparing
// the start of each node to the selection
var start = 0, end = container.childNodes.length - 1;
while (start < end) {
var middle = Math.ceil((end + start) / 2), node = container.childNodes[middle];
if (!node) return false; // Don't ask. IE6 manages this sometimes.
if (!moveToNodeStart(range2, node)) return false;
if (range.compareEndPoints("StartToStart", range2) == 1)
start = middle;
else
end = middle - 1;
}
if (start == 0) {
var test1 = selRange(), test2 = test1.duplicate();
try {
test2.moveToElementText(container);
} catch(exception) {
return null;
}
if (test1.compareEndPoints("StartToStart", test2) == 0)
return null;
}
return container.childNodes[start] || null;
};
// Place the cursor after this.start. This is only useful when
// manually moving the cursor instead of restoring it to its old
// position.
select.focusAfterNode = function(node, container) {
var range = document.body.createTextRange();
range.moveToElementText(node || container);
range.collapse(!node);
range.select();
};
select.somethingSelected = function() {
var range = selRange();
return range && (range.text != "");
};
function insertAtCursor(html) {
var range = selRange();
if (range) {
range.pasteHTML(html);
range.collapse(false);
range.select();
}
}
// Used to normalize the effect of the enter key, since browsers
// do widely different things when pressing enter in designMode.
select.insertNewlineAtCursor = function() {
insertAtCursor("<br>");
};
select.insertTabAtCursor = function() {
insertAtCursor(fourSpaces);
};
// Get the BR node at the start of the line on which the cursor
// currently is, and the offset into the line. Returns null as
// node if cursor is on first line.
select.cursorPos = function(container, start) {
var range = selRange();
if (!range) return null;
var topNode = select.selectionTopNode(container, start);
while (topNode && !isBR(topNode))
topNode = topNode.previousSibling;
var range2 = range.duplicate();
range.collapse(start);
if (topNode) {
range2.moveToElementText(topNode);
range2.collapse(false);
}
else {
// When nothing is selected, we can get all kinds of funky errors here.
try { range2.moveToElementText(container); }
catch (e) { return null; }
range2.collapse(true);
}
range.setEndPoint("StartToStart", range2);
return {node: topNode, offset: range.text.length};
};
select.setCursorPos = function(container, from, to) {
function rangeAt(pos) {
var range = document.body.createTextRange();
if (!pos.node) {
range.moveToElementText(container);
range.collapse(true);
}
else {
range.moveToElementText(pos.node);
range.collapse(false);
}
range.move("character", pos.offset);
return range;
}
var range = rangeAt(from);
if (to && to != from)
range.setEndPoint("EndToEnd", rangeAt(to));
range.select();
}
// Some hacks for storing and re-storing the selection when the editor loses and regains focus.
select.getBookmark = function (container) {
var from = select.cursorPos(container, true), to = select.cursorPos(container, false);
if (from && to) return {from: from, to: to};
};
// Restore a stored selection.
select.setBookmark = function(container, mark) {
if (!mark) return;
select.setCursorPos(container, mark.from, mark.to);
};
}
// W3C model
else {
// Find the node right at the cursor, not one of its
// ancestors with a suitable offset. This goes down the DOM tree
// until a 'leaf' is reached (or is it *up* the DOM tree?).
function innerNode(node, offset) {
while (node.nodeType != 3 && !isBR(node)) {
var newNode = node.childNodes[offset] || node.nextSibling;
offset = 0;
while (!newNode && node.parentNode) {
node = node.parentNode;
newNode = node.nextSibling;
}
node = newNode;
if (!newNode) break;
}
return {node: node, offset: offset};
}
// Store start and end nodes, and offsets within these, and refer
// back to the selection object from those nodes, so that this
// object can be updated when the nodes are replaced before the
// selection is restored.
select.markSelection = function () {
var selection = window.getSelection();
if (!selection || selection.rangeCount == 0)
return (currentSelection = null);
var range = selection.getRangeAt(0);
currentSelection = {
start: innerNode(range.startContainer, range.startOffset),
end: innerNode(range.endContainer, range.endOffset),
changed: false
};
};
select.selectMarked = function () {
var cs = currentSelection;
// on webkit-based browsers, it is apparently possible that the
// selection gets reset even when a node that is not one of the
// endpoints get messed with. the most common situation where
// this occurs is when a selection is deleted or overwitten. we
// check for that here.
function focusIssue() {
if (cs.start.node == cs.end.node && cs.start.offset == cs.end.offset) {
var selection = window.getSelection();
if (!selection || selection.rangeCount == 0) return true;
var range = selection.getRangeAt(0), point = innerNode(range.startContainer, range.startOffset);
return cs.start.node != point.node || cs.start.offset != point.offset;
}
}
if (!cs || !(cs.changed || (webkit && focusIssue()))) return;
var range = document.createRange();
function setPoint(point, which) {
if (point.node) {
// Some magic to generalize the setting of the start and end
// of a range.
if (point.offset == 0)
range["set" + which + "Before"](point.node);
else
range["set" + which](point.node, point.offset);
}
else {
range.setStartAfter(document.body.lastChild || document.body);
}
}
setPoint(cs.end, "End");
setPoint(cs.start, "Start");
selectRange(range);
};
// Helper for selecting a range object.
function selectRange(range) {
var selection = window.getSelection();
if (!selection) return;
selection.removeAllRanges();
selection.addRange(range);
}
function selectionRange() {
var selection = window.getSelection();
if (!selection || selection.rangeCount == 0)
return false;
else
return selection.getRangeAt(0);
}
// Finding the top-level node at the cursor in the W3C is, as you
// can see, quite an involved process.
select.selectionTopNode = function(container, start) {
var range = selectionRange();
if (!range) return false;
var node = start ? range.startContainer : range.endContainer;
var offset = start ? range.startOffset : range.endOffset;
// Work around (yet another) bug in Opera's selection model.
if (window.opera && !start && range.endContainer == container && range.endOffset == range.startOffset + 1 &&
container.childNodes[range.startOffset] && isBR(container.childNodes[range.startOffset]))
offset--;
// For text nodes, we look at the node itself if the cursor is
// inside, or at the node before it if the cursor is at the
// start.
if (node.nodeType == 3){
if (offset > 0)
return topLevelNodeAt(node, container);
else
return topLevelNodeBefore(node, container);
}
// Occasionally, browsers will return the HTML node as
// selection. If the offset is 0, we take the start of the frame
// ('after null'), otherwise, we take the last node.
else if (node.nodeName.toUpperCase() == "HTML") {
return (offset == 1 ? null : container.lastChild);
}
// If the given node is our 'container', we just look up the
// correct node by using the offset.
else if (node == container) {
return (offset == 0) ? null : node.childNodes[offset - 1];
}
// In any other case, we have a regular node. If the cursor is
// at the end of the node, we use the node itself, if it is at
// the start, we use the node before it, and in any other
// case, we look up the child before the cursor and use that.
else {
if (offset == node.childNodes.length)
return topLevelNodeAt(node, container);
else if (offset == 0)
return topLevelNodeBefore(node, container);
else
return topLevelNodeAt(node.childNodes[offset - 1], container);
}
};
select.focusAfterNode = function(node, container) {
var range = document.createRange();
range.setStartBefore(container.firstChild || container);
// In Opera, setting the end of a range at the end of a line
// (before a BR) will cause the cursor to appear on the next
// line, so we set the end inside of the start node when
// possible.
if (node && !node.firstChild)
range.setEndAfter(node);
else if (node)
range.setEnd(node, node.childNodes.length);
else
range.setEndBefore(container.firstChild || container);
range.collapse(false);
selectRange(range);
};
select.somethingSelected = function() {
var range = selectionRange();
return range && !range.collapsed;
};
select.offsetInNode = function(node) {
var range = selectionRange();
if (!range) return 0;
range = range.cloneRange();
range.setStartBefore(node);
return range.toString().length;
};
select.insertNodeAtCursor = function(node) {
var range = selectionRange();
if (!range) return;
range.deleteContents();
range.insertNode(node);
webkitLastLineHack(document.body);
// work around weirdness where Opera will magically insert a new
// BR node when a BR node inside a span is moved around. makes
// sure the BR ends up outside of spans.
if (window.opera && isBR(node) && isSpan(node.parentNode)) {
var next = node.nextSibling, p = node.parentNode, outer = p.parentNode;
outer.insertBefore(node, p.nextSibling);
var textAfter = "";
for (; next && next.nodeType == 3; next = next.nextSibling) {
textAfter += next.nodeValue;
removeElement(next);
}
outer.insertBefore(makePartSpan(textAfter, document), node.nextSibling);
}
range = document.createRange();
range.selectNode(node);
range.collapse(false);
selectRange(range);
}
select.insertNewlineAtCursor = function() {
select.insertNodeAtCursor(document.createElement("BR"));
};
select.insertTabAtCursor = function() {
select.insertNodeAtCursor(document.createTextNode(fourSpaces));
};
select.cursorPos = function(container, start) {
var range = selectionRange();
if (!range) return;
var topNode = select.selectionTopNode(container, start);
while (topNode && !isBR(topNode))
topNode = topNode.previousSibling;
range = range.cloneRange();
range.collapse(start);
if (topNode)
range.setStartAfter(topNode);
else
range.setStartBefore(container);
var text = range.toString();
return {node: topNode, offset: text.length};
};
select.setCursorPos = function(container, from, to) {
var range = document.createRange();
function setPoint(node, offset, side) {
if (offset == 0 && node && !node.nextSibling) {
range["set" + side + "After"](node);
return true;
}
if (!node)
node = container.firstChild;
else
node = node.nextSibling;
if (!node) return;
if (offset == 0) {
range["set" + side + "Before"](node);
return true;
}
var backlog = []
function decompose(node) {
if (node.nodeType == 3)
backlog.push(node);
else
forEach(node.childNodes, decompose);
}
while (true) {
while (node && !backlog.length) {
decompose(node);
node = node.nextSibling;
}
var cur = backlog.shift();
if (!cur) return false;
var length = cur.nodeValue.length;
if (length >= offset) {
range["set" + side](cur, offset);
return true;
}
offset -= length;
}
}
to = to || from;
if (setPoint(to.node, to.offset, "End") && setPoint(from.node, from.offset, "Start"))
selectRange(range);
};
}
})();
| JavaScript |
/* A few useful utility functions. */
// Capture a method on an object.
function method(obj, name) {
return function() {obj[name].apply(obj, arguments);};
}
// The value used to signal the end of a sequence in iterators.
var StopIteration = {toString: function() {return "StopIteration"}};
// Apply a function to each element in a sequence.
function forEach(iter, f) {
if (iter.next) {
try {while (true) f(iter.next());}
catch (e) {if (e != StopIteration) throw e;}
}
else {
for (var i = 0; i < iter.length; i++)
f(iter[i]);
}
}
// Map a function over a sequence, producing an array of results.
function map(iter, f) {
var accum = [];
forEach(iter, function(val) {accum.push(f(val));});
return accum;
}
// Create a predicate function that tests a string againsts a given
// regular expression. No longer used but might be used by 3rd party
// parsers.
function matcher(regexp){
return function(value){return regexp.test(value);};
}
// Test whether a DOM node has a certain CSS class.
function hasClass(element, className) {
var classes = element.className;
return classes && new RegExp("(^| )" + className + "($| )").test(classes);
}
function removeClass(element, className) {
element.className = element.className.replace(new RegExp(" " + className + "\\b", "g"), "");
return element;
}
// Insert a DOM node after another node.
function insertAfter(newNode, oldNode) {
var parent = oldNode.parentNode;
parent.insertBefore(newNode, oldNode.nextSibling);
return newNode;
}
function removeElement(node) {
if (node.parentNode)
node.parentNode.removeChild(node);
}
function clearElement(node) {
while (node.firstChild)
node.removeChild(node.firstChild);
}
// Check whether a node is contained in another one.
function isAncestor(node, child) {
while (child = child.parentNode) {
if (node == child)
return true;
}
return false;
}
// The non-breaking space character.
var nbsp = "\u00a0";
var matching = {"{": "}", "[": "]", "(": ")",
"}": "{", "]": "[", ")": "("};
// Standardize a few unportable event properties.
function normalizeEvent(event) {
if (!event.stopPropagation) {
event.stopPropagation = function() {this.cancelBubble = true;};
event.preventDefault = function() {this.returnValue = false;};
}
if (!event.stop) {
event.stop = function() {
this.stopPropagation();
this.preventDefault();
};
}
if (event.type == "keypress") {
event.code = (event.charCode == null) ? event.keyCode : event.charCode;
event.character = String.fromCharCode(event.code);
}
return event;
}
// Portably register event handlers.
function addEventHandler(node, type, handler, removeFunc) {
function wrapHandler(event) {
handler(normalizeEvent(event || window.event));
}
if (typeof node.addEventListener == "function") {
node.addEventListener(type, wrapHandler, false);
if (removeFunc) return function() {node.removeEventListener(type, wrapHandler, false);};
}
else {
node.attachEvent("on" + type, wrapHandler);
if (removeFunc) return function() {node.detachEvent("on" + type, wrapHandler);};
}
}
function nodeText(node) {
return node.textContent || node.innerText || node.nodeValue || "";
}
function nodeTop(node) {
var top = 0;
while (node.offsetParent) {
top += node.offsetTop;
node = node.offsetParent;
}
return top;
}
function isBR(node) {
var nn = node.nodeName;
return nn == "BR" || nn == "br";
}
function isSpan(node) {
var nn = node.nodeName;
return nn == "SPAN" || nn == "span";
}
| JavaScript |
var SparqlParser = Editor.Parser = (function() {
function wordRegexp(words) {
return new RegExp("^(?:" + words.join("|") + ")$", "i");
}
var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
"isblank", "isliteral", "union", "a"]);
var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
"ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional",
"graph", "by", "asc", "desc"]);
var operatorChars = /[*+\-<>=&|]/;
var tokenizeSparql = (function() {
function normal(source, setState) {
var ch = source.next();
if (ch == "$" || ch == "?") {
source.nextWhileMatches(/[\w\d]/);
return "sp-var";
}
else if (ch == "<" && !source.matches(/[\s\u00a0=]/)) {
source.nextWhileMatches(/[^\s\u00a0>]/);
if (source.equals(">")) source.next();
return "sp-uri";
}
else if (ch == "\"" || ch == "'") {
setState(inLiteral(ch));
return null;
}
else if (/[{}\(\),\.;\[\]]/.test(ch)) {
return "sp-punc";
}
else if (ch == "#") {
while (!source.endOfLine()) source.next();
return "sp-comment";
}
else if (operatorChars.test(ch)) {
source.nextWhileMatches(operatorChars);
return "sp-operator";
}
else if (ch == ":") {
source.nextWhileMatches(/[\w\d\._\-]/);
return "sp-prefixed";
}
else {
source.nextWhileMatches(/[_\w\d]/);
if (source.equals(":")) {
source.next();
source.nextWhileMatches(/[\w\d_\-]/);
return "sp-prefixed";
}
var word = source.get(), type;
if (ops.test(word))
type = "sp-operator";
else if (keywords.test(word))
type = "sp-keyword";
else
type = "sp-word";
return {style: type, content: word};
}
}
function inLiteral(quote) {
return function(source, setState) {
var escaped = false;
while (!source.endOfLine()) {
var ch = source.next();
if (ch == quote && !escaped) {
setState(normal);
break;
}
escaped = !escaped && ch == "\\";
}
return "sp-literal";
};
}
return function(source, startState) {
return tokenizer(source, startState || normal);
};
})();
function indentSparql(context) {
return function(nextChars) {
var firstChar = nextChars && nextChars.charAt(0);
if (/[\]\}]/.test(firstChar))
while (context && context.type == "pattern") context = context.prev;
var closing = context && firstChar == matching[context.type];
if (!context)
return 0;
else if (context.type == "pattern")
return context.col;
else if (context.align)
return context.col - (closing ? context.width : 0);
else
return context.indent + (closing ? 0 : indentUnit);
}
}
function parseSparql(source) {
var tokens = tokenizeSparql(source);
var context = null, indent = 0, col = 0;
function pushContext(type, width) {
context = {prev: context, indent: indent, col: col, type: type, width: width};
}
function popContext() {
context = context.prev;
}
var iter = {
next: function() {
var token = tokens.next(), type = token.style, content = token.content, width = token.value.length;
if (content == "\n") {
token.indentation = indentSparql(context);
indent = col = 0;
if (context && context.align == null) context.align = false;
}
else if (type == "whitespace" && col == 0) {
indent = width;
}
else if (type != "sp-comment" && context && context.align == null) {
context.align = true;
}
if (content != "\n") col += width;
if (/[\[\{\(]/.test(content)) {
pushContext(content, width);
}
else if (/[\]\}\)]/.test(content)) {
while (context && context.type == "pattern")
popContext();
if (context && content == matching[context.type])
popContext();
}
else if (content == "." && context && context.type == "pattern") {
popContext();
}
else if ((type == "sp-word" || type == "sp-prefixed" || type == "sp-uri" || type == "sp-var" || type == "sp-literal") &&
context && /[\{\[]/.test(context.type)) {
pushContext("pattern", width);
}
return token;
},
copy: function() {
var _context = context, _indent = indent, _col = col, _tokenState = tokens.state;
return function(source) {
tokens = tokenizeSparql(source, _tokenState);
context = _context;
indent = _indent;
col = _col;
return iter;
};
}
};
return iter;
}
return {make: parseSparql, electricChars: "}]"};
})();
| JavaScript |
/* This file defines an XML parser, with a few kludges to make it
* useable for HTML. autoSelfClosers defines a set of tag names that
* are expected to not have a closing tag, and doNotIndent specifies
* the tags inside of which no indentation should happen (see Config
* object). These can be disabled by passing the editor an object like
* {useHTMLKludges: false} as parserConfig option.
*/
var XMLParser = Editor.Parser = (function() {
var Kludges = {
autoSelfClosers: {"br": true, "img": true, "hr": true, "link": true, "input": true,
"meta": true, "col": true, "frame": true, "base": true, "area": true},
doNotIndent: {"pre": true, "!cdata": true}
};
var NoKludges = {autoSelfClosers: {}, doNotIndent: {"!cdata": true}};
var UseKludges = Kludges;
var alignCDATA = false;
// Simple stateful tokenizer for XML documents. Returns a
// MochiKit-style iterator, with a state property that contains a
// function encapsulating the current state. See tokenize.js.
var tokenizeXML = (function() {
function inText(source, setState) {
var ch = source.next();
if (ch == "<") {
if (source.equals("!")) {
source.next();
if (source.equals("[")) {
if (source.lookAhead("[CDATA[", true)) {
setState(inBlock("xml-cdata", "]]>"));
return null;
}
else {
return "xml-text";
}
}
else if (source.lookAhead("--", true)) {
setState(inBlock("xml-comment", "-->"));
return null;
}
else if (source.lookAhead("DOCTYPE", true)) {
source.nextWhileMatches(/[\w\._\-]/);
setState(inBlock("xml-doctype", ">"));
return "xml-doctype";
}
else {
return "xml-text";
}
}
else if (source.equals("?")) {
source.next();
source.nextWhileMatches(/[\w\._\-]/);
setState(inBlock("xml-processing", "?>"));
return "xml-processing";
}
else {
if (source.equals("/")) source.next();
setState(inTag);
return "xml-punctuation";
}
}
else if (ch == "&") {
while (!source.endOfLine()) {
if (source.next() == ";")
break;
}
return "xml-entity";
}
else {
source.nextWhileMatches(/[^&<\n]/);
return "xml-text";
}
}
function inTag(source, setState) {
var ch = source.next();
if (ch == ">") {
setState(inText);
return "xml-punctuation";
}
else if (/[?\/]/.test(ch) && source.equals(">")) {
source.next();
setState(inText);
return "xml-punctuation";
}
else if (ch == "=") {
return "xml-punctuation";
}
else if (/[\'\"]/.test(ch)) {
setState(inAttribute(ch));
return null;
}
else {
source.nextWhileMatches(/[^\s\u00a0=<>\"\'\/?]/);
return "xml-name";
}
}
function inAttribute(quote) {
return function(source, setState) {
while (!source.endOfLine()) {
if (source.next() == quote) {
setState(inTag);
break;
}
}
return "xml-attribute";
};
}
function inBlock(style, terminator) {
return function(source, setState) {
while (!source.endOfLine()) {
if (source.lookAhead(terminator, true)) {
setState(inText);
break;
}
source.next();
}
return style;
};
}
return function(source, startState) {
return tokenizer(source, startState || inText);
};
})();
// The parser. The structure of this function largely follows that of
// parseJavaScript in parsejavascript.js (there is actually a bit more
// shared code than I'd like), but it is quite a bit simpler.
function parseXML(source) {
var tokens = tokenizeXML(source), token;
var cc = [base];
var tokenNr = 0, indented = 0;
var currentTag = null, context = null;
var consume;
function push(fs) {
for (var i = fs.length - 1; i >= 0; i--)
cc.push(fs[i]);
}
function cont() {
push(arguments);
consume = true;
}
function pass() {
push(arguments);
consume = false;
}
function markErr() {
token.style += " xml-error";
}
function expect(text) {
return function(style, content) {
if (content == text) cont();
else {markErr(); cont(arguments.callee);}
};
}
function pushContext(tagname, startOfLine) {
var noIndent = UseKludges.doNotIndent.hasOwnProperty(tagname) || (context && context.noIndent);
context = {prev: context, name: tagname, indent: indented, startOfLine: startOfLine, noIndent: noIndent};
}
function popContext() {
context = context.prev;
}
function computeIndentation(baseContext) {
return function(nextChars, current) {
var context = baseContext;
if (context && context.noIndent)
return current;
if (alignCDATA && /<!\[CDATA\[/.test(nextChars))
return 0;
if (context && /^<\//.test(nextChars))
context = context.prev;
while (context && !context.startOfLine)
context = context.prev;
if (context)
return context.indent + indentUnit;
else
return 0;
};
}
function base() {
return pass(element, base);
}
var harmlessTokens = {"xml-text": true, "xml-entity": true, "xml-comment": true, "xml-processing": true, "xml-doctype": true};
function element(style, content) {
if (content == "<") cont(tagname, attributes, endtag(tokenNr == 1));
else if (content == "</") cont(closetagname, expect(">"));
else if (style == "xml-cdata") {
if (!context || context.name != "!cdata") pushContext("!cdata");
if (/\]\]>$/.test(content)) popContext();
cont();
}
else if (harmlessTokens.hasOwnProperty(style)) cont();
else {markErr(); cont();}
}
function tagname(style, content) {
if (style == "xml-name") {
currentTag = content.toLowerCase();
token.style = "xml-tagname";
cont();
}
else {
currentTag = null;
pass();
}
}
function closetagname(style, content) {
if (style == "xml-name") {
token.style = "xml-tagname";
if (context && content.toLowerCase() == context.name) popContext();
else markErr();
}
cont();
}
function endtag(startOfLine) {
return function(style, content) {
if (content == "/>" || (content == ">" && UseKludges.autoSelfClosers.hasOwnProperty(currentTag))) cont();
else if (content == ">") {pushContext(currentTag, startOfLine); cont();}
else {markErr(); cont(arguments.callee);}
};
}
function attributes(style) {
if (style == "xml-name") {token.style = "xml-attname"; cont(attribute, attributes);}
else pass();
}
function attribute(style, content) {
if (content == "=") cont(value);
else if (content == ">" || content == "/>") pass(endtag);
else pass();
}
function value(style) {
if (style == "xml-attribute") cont(value);
else pass();
}
return {
indentation: function() {return indented;},
next: function(){
token = tokens.next();
if (token.style == "whitespace" && tokenNr == 0)
indented = token.value.length;
else
tokenNr++;
if (token.content == "\n") {
indented = tokenNr = 0;
token.indentation = computeIndentation(context);
}
if (token.style == "whitespace" || token.type == "xml-comment")
return token;
while(true){
consume = false;
cc.pop()(token.style, token.content);
if (consume) return token;
}
},
copy: function(){
var _cc = cc.concat([]), _tokenState = tokens.state, _context = context;
var parser = this;
return function(input){
cc = _cc.concat([]);
tokenNr = indented = 0;
context = _context;
tokens = tokenizeXML(input, _tokenState);
return parser;
};
}
};
}
return {
make: parseXML,
electricChars: "/",
configure: function(config) {
if (config.useHTMLKludges != null)
UseKludges = config.useHTMLKludges ? Kludges : NoKludges;
if (config.alignCDATA)
alignCDATA = config.alignCDATA;
}
};
})();
| JavaScript |
/* Tokenizer for JavaScript code */
var tokenizeJavaScript = (function() {
// Advance the stream until the given character (not preceded by a
// backslash) is encountered, or the end of the line is reached.
function nextUntilUnescaped(source, end) {
var escaped = false;
while (!source.endOfLine()) {
var next = source.next();
if (next == end && !escaped)
return false;
escaped = !escaped && next == "\\";
}
return escaped;
}
// A map of JavaScript's keywords. The a/b/c keyword distinction is
// very rough, but it gives the parser enough information to parse
// correct code correctly (we don't care that much how we parse
// incorrect code). The style information included in these objects
// is used by the highlighter to pick the correct CSS style for a
// token.
var keywords = function(){
function result(type, style){
return {type: type, style: "js-" + style};
}
// keywords that take a parenthised expression, and then a
// statement (if)
var keywordA = result("keyword a", "keyword");
// keywords that take just a statement (else)
var keywordB = result("keyword b", "keyword");
// keywords that optionally take an expression, and form a
// statement (return)
var keywordC = result("keyword c", "keyword");
var operator = result("operator", "keyword");
var atom = result("atom", "atom");
return {
"if": keywordA, "while": keywordA, "with": keywordA,
"else": keywordB, "do": keywordB, "try": keywordB, "finally": keywordB,
"return": keywordC, "break": keywordC, "continue": keywordC, "new": keywordC, "delete": keywordC, "throw": keywordC,
"in": operator, "typeof": operator, "instanceof": operator,
"var": result("var", "keyword"), "function": result("function", "keyword"), "catch": result("catch", "keyword"),
"for": result("for", "keyword"), "switch": result("switch", "keyword"),
"case": result("case", "keyword"), "default": result("default", "keyword"),
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
};
}();
// Some helper regexps
var isOperatorChar = /[+\-*&%=<>!?|]/;
var isHexDigit = /[0-9A-Fa-f]/;
var isWordChar = /[\w\$_]/;
// Wrapper around jsToken that helps maintain parser state (whether
// we are inside of a multi-line comment and whether the next token
// could be a regular expression).
function jsTokenState(inside, regexp) {
return function(source, setState) {
var newInside = inside;
var type = jsToken(inside, regexp, source, function(c) {newInside = c;});
var newRegexp = type.type == "operator" || type.type == "keyword c" || type.type.match(/^[\[{}\(,;:]$/);
if (newRegexp != regexp || newInside != inside)
setState(jsTokenState(newInside, newRegexp));
return type;
};
}
// The token reader, intended to be used by the tokenizer from
// tokenize.js (through jsTokenState). Advances the source stream
// over a token, and returns an object containing the type and style
// of that token.
function jsToken(inside, regexp, source, setInside) {
function readHexNumber(){
source.next(); // skip the 'x'
source.nextWhileMatches(isHexDigit);
return {type: "number", style: "js-atom"};
}
function readNumber() {
source.nextWhileMatches(/[0-9]/);
if (source.equals(".")){
source.next();
source.nextWhileMatches(/[0-9]/);
}
if (source.equals("e") || source.equals("E")){
source.next();
if (source.equals("-"))
source.next();
source.nextWhileMatches(/[0-9]/);
}
return {type: "number", style: "js-atom"};
}
// Read a word, look it up in keywords. If not found, it is a
// variable, otherwise it is a keyword of the type found.
function readWord() {
source.nextWhileMatches(isWordChar);
var word = source.get();
var known = keywords.hasOwnProperty(word) && keywords.propertyIsEnumerable(word) && keywords[word];
return known ? {type: known.type, style: known.style, content: word} :
{type: "variable", style: "js-variable", content: word};
}
function readRegexp() {
nextUntilUnescaped(source, "/");
source.nextWhileMatches(/[gimy]/); // 'y' is "sticky" option in Mozilla
return {type: "regexp", style: "js-string"};
}
// Mutli-line comments are tricky. We want to return the newlines
// embedded in them as regular newline tokens, and then continue
// returning a comment token for every line of the comment. So
// some state has to be saved (inside) to indicate whether we are
// inside a /* */ sequence.
function readMultilineComment(start){
var newInside = "/*";
var maybeEnd = (start == "*");
while (true) {
if (source.endOfLine())
break;
var next = source.next();
if (next == "/" && maybeEnd){
newInside = null;
break;
}
maybeEnd = (next == "*");
}
setInside(newInside);
return {type: "comment", style: "js-comment"};
}
function readOperator() {
source.nextWhileMatches(isOperatorChar);
return {type: "operator", style: "js-operator"};
}
function readString(quote) {
var endBackSlash = nextUntilUnescaped(source, quote);
setInside(endBackSlash ? quote : null);
return {type: "string", style: "js-string"};
}
// Fetch the next token. Dispatches on first character in the
// stream, or first two characters when the first is a slash.
if (inside == "\"" || inside == "'")
return readString(inside);
var ch = source.next();
if (inside == "/*")
return readMultilineComment(ch);
else if (ch == "\"" || ch == "'")
return readString(ch);
// with punctuation, the type of the token is the symbol itself
else if (/[\[\]{}\(\),;\:\.]/.test(ch))
return {type: ch, style: "js-punctuation"};
else if (ch == "0" && (source.equals("x") || source.equals("X")))
return readHexNumber();
else if (/[0-9]/.test(ch))
return readNumber();
else if (ch == "/"){
if (source.equals("*"))
{ source.next(); return readMultilineComment(ch); }
else if (source.equals("/"))
{ nextUntilUnescaped(source, null); return {type: "comment", style: "js-comment"};}
else if (regexp)
return readRegexp();
else
return readOperator();
}
else if (isOperatorChar.test(ch))
return readOperator();
else
return readWord();
}
// The external interface to the tokenizer.
return function(source, startState) {
return tokenizer(source, startState || jsTokenState(false, true));
};
})();
| JavaScript |
// A framework for simple tokenizers. Takes care of newlines and
// white-space, and of getting the text from the source stream into
// the token object. A state is a function of two arguments -- a
// string stream and a setState function. The second can be used to
// change the tokenizer's state, and can be ignored for stateless
// tokenizers. This function should advance the stream over a token
// and return a string or object containing information about the next
// token, or null to pass and have the (new) state be called to finish
// the token. When a string is given, it is wrapped in a {style, type}
// object. In the resulting object, the characters consumed are stored
// under the content property. Any whitespace following them is also
// automatically consumed, and added to the value property. (Thus,
// content is the actual meaningful part of the token, while value
// contains all the text it spans.)
function tokenizer(source, state) {
// Newlines are always a separate token.
function isWhiteSpace(ch) {
// The messy regexp is because IE's regexp matcher is of the
// opinion that non-breaking spaces are no whitespace.
return ch != "\n" && /^[\s\u00a0]*$/.test(ch);
}
var tokenizer = {
state: state,
take: function(type) {
if (typeof(type) == "string")
type = {style: type, type: type};
type.content = (type.content || "") + source.get();
if (!/\n$/.test(type.content))
source.nextWhile(isWhiteSpace);
type.value = type.content + source.get();
return type;
},
next: function () {
if (!source.more()) throw StopIteration;
var type;
if (source.equals("\n")) {
source.next();
return this.take("whitespace");
}
if (source.applies(isWhiteSpace))
type = "whitespace";
else
while (!type)
type = this.state(source, function(s) {tokenizer.state = s;});
return this.take(type);
}
};
return tokenizer;
}
| JavaScript |
/* CodeMirror main module (http://codemirror.net/)
*
* Implements the CodeMirror constructor and prototype, which take care
* of initializing the editor frame, and providing the outside interface.
*/
// The CodeMirrorConfig object is used to specify a default
// configuration. If you specify such an object before loading this
// file, the values you put into it will override the defaults given
// below. You can also assign to it after loading.
var CodeMirrorConfig = window.CodeMirrorConfig || {};
var CodeMirror = (function(){
function setDefaults(object, defaults) {
for (var option in defaults) {
if (!object.hasOwnProperty(option))
object[option] = defaults[option];
}
}
function forEach(array, action) {
for (var i = 0; i < array.length; i++)
action(array[i]);
}
function createHTMLElement(el) {
if (document.createElementNS && document.documentElement.namespaceURI !== null)
return document.createElementNS("http://www.w3.org/1999/xhtml", el)
else
return document.createElement(el)
}
// These default options can be overridden by passing a set of
// options to a specific CodeMirror constructor. See manual.html for
// their meaning.
setDefaults(CodeMirrorConfig, {
stylesheet: [],
path: "",
parserfile: [],
basefiles: ["util.js", "stringstream.js", "select.js", "undo.js", "editor.js", "tokenize.js"],
iframeClass: null,
passDelay: 200,
passTime: 50,
lineNumberDelay: 200,
lineNumberTime: 50,
continuousScanning: false,
saveFunction: null,
onLoad: null,
onChange: null,
undoDepth: 50,
undoDelay: 800,
disableSpellcheck: true,
textWrapping: true,
readOnly: false,
width: "",
height: "300px",
minHeight: 100,
autoMatchParens: false,
markParen: null,
unmarkParen: null,
parserConfig: null,
tabMode: "indent", // or "spaces", "default", "shift"
enterMode: "indent", // or "keep", "flat"
electricChars: true,
reindentOnLoad: false,
activeTokens: null,
onCursorActivity: null,
lineNumbers: false,
firstLineNumber: 1,
onLineNumberClick: null,
indentUnit: 2,
domain: null,
noScriptCaching: false,
incrementalLoading: false
});
function addLineNumberDiv(container, firstNum) {
var nums = createHTMLElement("div"),
scroller = createHTMLElement("div");
nums.style.position = "absolute";
nums.style.height = "100%";
if (nums.style.setExpression) {
try {nums.style.setExpression("height", "this.previousSibling.offsetHeight + 'px'");}
catch(e) {} // Seems to throw 'Not Implemented' on some IE8 versions
}
nums.style.top = "0px";
nums.style.left = "0px";
nums.style.overflow = "hidden";
container.appendChild(nums);
scroller.className = "CodeMirror-line-numbers";
nums.appendChild(scroller);
scroller.innerHTML = "<div>" + firstNum + "</div>";
return nums;
}
function frameHTML(options) {
if (typeof options.parserfile == "string")
options.parserfile = [options.parserfile];
if (typeof options.basefiles == "string")
options.basefiles = [options.basefiles];
if (typeof options.stylesheet == "string")
options.stylesheet = [options.stylesheet];
var html = ["<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head>"];
// Hack to work around a bunch of IE8-specific problems.
html.push("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\"/>");
var queryStr = options.noScriptCaching ? "?nocache=" + new Date().getTime().toString(16) : "";
forEach(options.stylesheet, function(file) {
html.push("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + file + queryStr + "\"/>");
});
forEach(options.basefiles.concat(options.parserfile), function(file) {
if (!/^https?:/.test(file)) file = options.path + file;
html.push("<script type=\"text/javascript\" src=\"" + file + queryStr + "\"><" + "/script>");
});
html.push("</head><body style=\"border-width: 0;\" class=\"editbox\" spellcheck=\"" +
(options.disableSpellcheck ? "false" : "true") + "\"></body></html>");
return html.join("");
}
var internetExplorer = document.selection && window.ActiveXObject && /MSIE/.test(navigator.userAgent);
function CodeMirror(place, options) {
// Use passed options, if any, to override defaults.
this.options = options = options || {};
setDefaults(options, CodeMirrorConfig);
// Backward compatibility for deprecated options.
if (options.dumbTabs) options.tabMode = "spaces";
else if (options.normalTab) options.tabMode = "default";
if (options.cursorActivity) options.onCursorActivity = options.cursorActivity;
var frame = this.frame = createHTMLElement("iframe");
if (options.iframeClass) frame.className = options.iframeClass;
frame.frameBorder = 0;
frame.style.border = "0";
frame.style.width = '100%';
frame.style.height = '100%';
// display: block occasionally suppresses some Firefox bugs, so we
// always add it, redundant as it sounds.
frame.style.display = "block";
var div = this.wrapping = createHTMLElement("div");
div.style.position = "relative";
div.className = "CodeMirror-wrapping";
div.style.width = options.width;
div.style.height = (options.height == "dynamic") ? options.minHeight + "px" : options.height;
// This is used by Editor.reroutePasteEvent
var teHack = this.textareaHack = createHTMLElement("textarea");
div.appendChild(teHack);
teHack.style.position = "absolute";
teHack.style.left = "-10000px";
teHack.style.width = "10px";
teHack.tabIndex = 100000;
// Link back to this object, so that the editor can fetch options
// and add a reference to itself.
frame.CodeMirror = this;
if (options.domain && internetExplorer) {
this.html = frameHTML(options);
frame.src = "javascript:(function(){document.open();" +
(options.domain ? "document.domain=\"" + options.domain + "\";" : "") +
"document.write(window.frameElement.CodeMirror.html);document.close();})()";
}
else {
frame.src = "javascript:;";
}
if (place.appendChild) place.appendChild(div);
else place(div);
div.appendChild(frame);
if (options.lineNumbers) this.lineNumbers = addLineNumberDiv(div, options.firstLineNumber);
this.win = frame.contentWindow;
if (!options.domain || !internetExplorer) {
this.win.document.open();
this.win.document.write(frameHTML(options));
this.win.document.close();
}
}
CodeMirror.prototype = {
init: function() {
// Deprecated, but still supported.
if (this.options.initCallback) this.options.initCallback(this);
if (this.options.onLoad) this.options.onLoad(this);
if (this.options.lineNumbers) this.activateLineNumbers();
if (this.options.reindentOnLoad) this.reindent();
if (this.options.height == "dynamic") this.setDynamicHeight();
},
getCode: function() {return this.editor.getCode();},
setCode: function(code) {this.editor.importCode(code);},
selection: function() {this.focusIfIE(); return this.editor.selectedText();},
reindent: function() {this.editor.reindent();},
reindentSelection: function() {this.focusIfIE(); this.editor.reindentSelection(null);},
focusIfIE: function() {
// in IE, a lot of selection-related functionality only works when the frame is focused
if (this.win.select.ie_selection && document.activeElement != this.frame)
this.focus();
},
focus: function() {
this.win.focus();
if (this.editor.selectionSnapshot) // IE hack
this.win.select.setBookmark(this.win.document.body, this.editor.selectionSnapshot);
},
replaceSelection: function(text) {
this.focus();
this.editor.replaceSelection(text);
return true;
},
replaceChars: function(text, start, end) {
this.editor.replaceChars(text, start, end);
},
getSearchCursor: function(string, fromCursor, caseFold) {
return this.editor.getSearchCursor(string, fromCursor, caseFold);
},
undo: function() {this.editor.history.undo();},
redo: function() {this.editor.history.redo();},
historySize: function() {return this.editor.history.historySize();},
clearHistory: function() {this.editor.history.clear();},
grabKeys: function(callback, filter) {this.editor.grabKeys(callback, filter);},
ungrabKeys: function() {this.editor.ungrabKeys();},
setParser: function(name, parserConfig) {this.editor.setParser(name, parserConfig);},
setSpellcheck: function(on) {this.win.document.body.spellcheck = on;},
setStylesheet: function(names) {
if (typeof names === "string") names = [names];
var activeStylesheets = {};
var matchedNames = {};
var links = this.win.document.getElementsByTagName("link");
// Create hashes of active stylesheets and matched names.
// This is O(n^2) but n is expected to be very small.
for (var x = 0, link; link = links[x]; x++) {
if (link.rel.indexOf("stylesheet") !== -1) {
for (var y = 0; y < names.length; y++) {
var name = names[y];
if (link.href.substring(link.href.length - name.length) === name) {
activeStylesheets[link.href] = true;
matchedNames[name] = true;
}
}
}
}
// Activate the selected stylesheets and disable the rest.
for (var x = 0, link; link = links[x]; x++) {
if (link.rel.indexOf("stylesheet") !== -1) {
link.disabled = !(link.href in activeStylesheets);
}
}
// Create any new stylesheets.
for (var y = 0; y < names.length; y++) {
var name = names[y];
if (!(name in matchedNames)) {
var link = this.win.document.createElement("link");
link.rel = "stylesheet";
link.type = "text/css";
link.href = name;
this.win.document.getElementsByTagName('head')[0].appendChild(link);
}
}
},
setTextWrapping: function(on) {
if (on == this.options.textWrapping) return;
this.win.document.body.style.whiteSpace = on ? "" : "nowrap";
this.options.textWrapping = on;
if (this.lineNumbers) {
this.setLineNumbers(false);
this.setLineNumbers(true);
}
},
setIndentUnit: function(unit) {this.win.indentUnit = unit;},
setUndoDepth: function(depth) {this.editor.history.maxDepth = depth;},
setTabMode: function(mode) {this.options.tabMode = mode;},
setEnterMode: function(mode) {this.options.enterMode = mode;},
setLineNumbers: function(on) {
if (on && !this.lineNumbers) {
this.lineNumbers = addLineNumberDiv(this.wrapping,this.options.firstLineNumber);
this.activateLineNumbers();
}
else if (!on && this.lineNumbers) {
this.wrapping.removeChild(this.lineNumbers);
this.wrapping.style.paddingLeft = "";
this.lineNumbers = null;
}
},
cursorPosition: function(start) {this.focusIfIE(); return this.editor.cursorPosition(start);},
firstLine: function() {return this.editor.firstLine();},
lastLine: function() {return this.editor.lastLine();},
nextLine: function(line) {return this.editor.nextLine(line);},
prevLine: function(line) {return this.editor.prevLine(line);},
lineContent: function(line) {return this.editor.lineContent(line);},
setLineContent: function(line, content) {this.editor.setLineContent(line, content);},
removeLine: function(line){this.editor.removeLine(line);},
insertIntoLine: function(line, position, content) {this.editor.insertIntoLine(line, position, content);},
selectLines: function(startLine, startOffset, endLine, endOffset) {
this.win.focus();
this.editor.selectLines(startLine, startOffset, endLine, endOffset);
},
nthLine: function(n) {
var line = this.firstLine();
for (; n > 1 && line !== false; n--)
line = this.nextLine(line);
return line;
},
lineNumber: function(line) {
var num = 0;
while (line !== false) {
num++;
line = this.prevLine(line);
}
return num;
},
jumpToLine: function(line) {
if (typeof line == "number") line = this.nthLine(line);
this.selectLines(line, 0);
this.win.focus();
},
currentLine: function() { // Deprecated, but still there for backward compatibility
return this.lineNumber(this.cursorLine());
},
cursorLine: function() {
return this.cursorPosition().line;
},
cursorCoords: function(start) {return this.editor.cursorCoords(start);},
activateLineNumbers: function() {
var frame = this.frame, win = frame.contentWindow, doc = win.document, body = doc.body,
nums = this.lineNumbers, scroller = nums.firstChild, self = this;
var barWidth = null;
nums.onclick = function(e) {
var handler = self.options.onLineNumberClick;
if (handler) {
var div = (e || window.event).target || (e || window.event).srcElement;
var num = div == nums ? NaN : Number(div.innerHTML);
if (!isNaN(num)) handler(num, div);
}
};
function sizeBar() {
if (frame.offsetWidth == 0) return;
for (var root = frame; root.parentNode; root = root.parentNode){}
if (!nums.parentNode || root != document || !win.Editor) {
// Clear event handlers (their nodes might already be collected, so try/catch)
try{clear();}catch(e){}
clearInterval(sizeInterval);
return;
}
if (nums.offsetWidth != barWidth) {
barWidth = nums.offsetWidth;
frame.parentNode.style.paddingLeft = barWidth + "px";
}
}
function doScroll() {
nums.scrollTop = body.scrollTop || doc.documentElement.scrollTop || 0;
}
// Cleanup function, registered by nonWrapping and wrapping.
var clear = function(){};
sizeBar();
var sizeInterval = setInterval(sizeBar, 500);
function ensureEnoughLineNumbers(fill) {
var lineHeight = scroller.firstChild.offsetHeight;
if (lineHeight == 0) return;
var targetHeight = 50 + Math.max(body.offsetHeight, Math.max(frame.offsetHeight, body.scrollHeight || 0)),
lastNumber = Math.ceil(targetHeight / lineHeight);
for (var i = scroller.childNodes.length; i <= lastNumber; i++) {
var div = createHTMLElement("div");
div.appendChild(document.createTextNode(fill ? String(i + self.options.firstLineNumber) : "\u00a0"));
scroller.appendChild(div);
}
}
function nonWrapping() {
function update() {
ensureEnoughLineNumbers(true);
doScroll();
}
self.updateNumbers = update;
var onScroll = win.addEventHandler(win, "scroll", doScroll, true),
onResize = win.addEventHandler(win, "resize", update, true);
clear = function(){
onScroll(); onResize();
if (self.updateNumbers == update) self.updateNumbers = null;
};
update();
}
function wrapping() {
var node, lineNum, next, pos, changes = [], styleNums = self.options.styleNumbers;
function setNum(n, node) {
// Does not typically happen (but can, if you mess with the
// document during the numbering)
if (!lineNum) lineNum = scroller.appendChild(createHTMLElement("div"));
if (styleNums) styleNums(lineNum, node, n);
// Changes are accumulated, so that the document layout
// doesn't have to be recomputed during the pass
changes.push(lineNum); changes.push(n);
pos = lineNum.offsetHeight + lineNum.offsetTop;
lineNum = lineNum.nextSibling;
}
function commitChanges() {
for (var i = 0; i < changes.length; i += 2)
changes[i].innerHTML = changes[i + 1];
changes = [];
}
function work() {
if (!scroller.parentNode || scroller.parentNode != self.lineNumbers) return;
var endTime = new Date().getTime() + self.options.lineNumberTime;
while (node) {
setNum(next++, node.previousSibling);
for (; node && !win.isBR(node); node = node.nextSibling) {
var bott = node.offsetTop + node.offsetHeight;
while (scroller.offsetHeight && bott - 3 > pos) {
var oldPos = pos;
setNum(" ");
if (pos <= oldPos) break;
}
}
if (node) node = node.nextSibling;
if (new Date().getTime() > endTime) {
commitChanges();
pending = setTimeout(work, self.options.lineNumberDelay);
return;
}
}
while (lineNum) setNum(next++);
commitChanges();
doScroll();
}
function start(firstTime) {
doScroll();
ensureEnoughLineNumbers(firstTime);
node = body.firstChild;
lineNum = scroller.firstChild;
pos = 0;
next = self.options.firstLineNumber;
work();
}
start(true);
var pending = null;
function update() {
if (pending) clearTimeout(pending);
if (self.editor.allClean()) start();
else pending = setTimeout(update, 200);
}
self.updateNumbers = update;
var onScroll = win.addEventHandler(win, "scroll", doScroll, true),
onResize = win.addEventHandler(win, "resize", update, true);
clear = function(){
if (pending) clearTimeout(pending);
if (self.updateNumbers == update) self.updateNumbers = null;
onScroll();
onResize();
};
}
(this.options.textWrapping || this.options.styleNumbers ? wrapping : nonWrapping)();
},
setDynamicHeight: function() {
var self = this, activity = self.options.onCursorActivity, win = self.win, body = win.document.body,
lineHeight = null, timeout = null, vmargin = 2 * self.frame.offsetTop;
body.style.overflowY = "hidden";
win.document.documentElement.style.overflowY = "hidden";
this.frame.scrolling = "no";
function updateHeight() {
var trailingLines = 0, node = body.lastChild, computedHeight;
while (node && win.isBR(node)) {
if (!node.hackBR) trailingLines++;
node = node.previousSibling;
}
if (node) {
lineHeight = node.offsetHeight;
computedHeight = node.offsetTop + (1 + trailingLines) * lineHeight;
}
else if (lineHeight) {
computedHeight = trailingLines * lineHeight;
}
if (computedHeight)
self.wrapping.style.height = Math.max(vmargin + computedHeight, self.options.minHeight) + "px";
}
setTimeout(updateHeight, 300);
self.options.onCursorActivity = function(x) {
if (activity) activity(x);
clearTimeout(timeout);
timeout = setTimeout(updateHeight, 100);
};
}
};
CodeMirror.InvalidLineHandle = {toString: function(){return "CodeMirror.InvalidLineHandle";}};
CodeMirror.replace = function(element) {
if (typeof element == "string")
element = document.getElementById(element);
return function(newElement) {
element.parentNode.replaceChild(newElement, element);
};
};
CodeMirror.fromTextArea = function(area, options) {
if (typeof area == "string")
area = document.getElementById(area);
options = options || {};
if (area.style.width && options.width == null)
options.width = area.style.width;
if (area.style.height && options.height == null)
options.height = area.style.height;
if (options.content == null) options.content = area.value;
function updateField() {
area.value = mirror.getCode();
}
if (area.form) {
if (typeof area.form.addEventListener == "function")
area.form.addEventListener("submit", updateField, false);
else
area.form.attachEvent("onsubmit", updateField);
var realSubmit = area.form.submit;
function wrapSubmit() {
updateField();
// Can't use realSubmit.apply because IE6 is too stupid
area.form.submit = realSubmit;
area.form.submit();
area.form.submit = wrapSubmit;
}
area.form.submit = wrapSubmit;
}
function insert(frame) {
if (area.nextSibling)
area.parentNode.insertBefore(frame, area.nextSibling);
else
area.parentNode.appendChild(frame);
}
area.style.display = "none";
var mirror = new CodeMirror(insert, options);
mirror.save = updateField;
mirror.toTextArea = function() {
updateField();
area.parentNode.removeChild(mirror.wrapping);
area.style.display = "";
if (area.form) {
area.form.submit = realSubmit;
if (typeof area.form.removeEventListener == "function")
area.form.removeEventListener("submit", updateField, false);
else
area.form.detachEvent("onsubmit", updateField);
}
};
return mirror;
};
CodeMirror.isProbablySupported = function() {
// This is rather awful, but can be useful.
var match;
if (window.opera)
return Number(window.opera.version()) >= 9.52;
else if (/Apple Computer, Inc/.test(navigator.vendor) && (match = navigator.userAgent.match(/Version\/(\d+(?:\.\d+)?)\./)))
return Number(match[1]) >= 3;
else if (document.selection && window.ActiveXObject && (match = navigator.userAgent.match(/MSIE (\d+(?:\.\d*)?)\b/)))
return Number(match[1]) >= 6;
else if (match = navigator.userAgent.match(/gecko\/(\d{8})/i))
return Number(match[1]) >= 20050901;
else if (match = navigator.userAgent.match(/AppleWebKit\/(\d+)/))
return Number(match[1]) >= 525;
else
return null;
};
return CodeMirror;
})();
| JavaScript |
// Minimal framing needed to use CodeMirror-style parsers to highlight
// code. Load this along with tokenize.js, stringstream.js, and your
// parser. Then call highlightText, passing a string as the first
// argument, and as the second argument either a callback function
// that will be called with an array of SPAN nodes for every line in
// the code, or a DOM node to which to append these spans, and
// optionally (not needed if you only loaded one parser) a parser
// object.
// Stuff from util.js that the parsers are using.
var StopIteration = {toString: function() {return "StopIteration"}};
var Editor = {};
var indentUnit = 2;
(function(){
function normaliseString(string) {
var tab = "";
for (var i = 0; i < indentUnit; i++) tab += " ";
string = string.replace(/\t/g, tab).replace(/\u00a0/g, " ").replace(/\r\n?/g, "\n");
var pos = 0, parts = [], lines = string.split("\n");
for (var line = 0; line < lines.length; line++) {
if (line != 0) parts.push("\n");
parts.push(lines[line]);
}
return {
next: function() {
if (pos < parts.length) return parts[pos++];
else throw StopIteration;
}
};
}
window.highlightText = function(string, callback, parser) {
parser = (parser || Editor.Parser).make(stringStream(normaliseString(string)));
var line = [];
if (callback.nodeType == 1) {
var node = callback;
callback = function(line) {
for (var i = 0; i < line.length; i++)
node.appendChild(line[i]);
node.appendChild(document.createElement("br"));
};
}
try {
while (true) {
var token = parser.next();
if (token.value == "\n") {
callback(line);
line = [];
}
else {
var span = document.createElement("span");
span.className = token.style;
span.appendChild(document.createTextNode(token.value));
line.push(span);
}
}
}
catch (e) {
if (e != StopIteration) throw e;
}
if (line.length) callback(line);
}
})();
| JavaScript |
/* The Editor object manages the content of the editable frame. It
* catches events, colours nodes, and indents lines. This file also
* holds some functions for transforming arbitrary DOM structures into
* plain sequences of <span> and <br> elements
*/
var internetExplorer = document.selection && window.ActiveXObject && /MSIE/.test(navigator.userAgent);
var webkit = /AppleWebKit/.test(navigator.userAgent);
var safari = /Apple Computer, Inc/.test(navigator.vendor);
var gecko = navigator.userAgent.match(/gecko\/(\d{8})/i);
if (gecko) gecko = Number(gecko[1]);
var mac = /Mac/.test(navigator.platform);
// TODO this is related to the backspace-at-end-of-line bug. Remove
// this if Opera gets their act together, make the version check more
// broad if they don't.
var brokenOpera = window.opera && /Version\/10.[56]/.test(navigator.userAgent);
// TODO remove this once WebKit 533 becomes less common.
var slowWebkit = /AppleWebKit\/533/.test(navigator.userAgent);
// Make sure a string does not contain two consecutive 'collapseable'
// whitespace characters.
function makeWhiteSpace(n) {
var buffer = [], nb = true;
for (; n > 0; n--) {
buffer.push((nb || n == 1) ? nbsp : " ");
nb ^= true;
}
return buffer.join("");
}
// Create a set of white-space characters that will not be collapsed
// by the browser, but will not break text-wrapping either.
function fixSpaces(string) {
if (string.charAt(0) == " ") string = nbsp + string.slice(1);
return string.replace(/\t/g, function() {return makeWhiteSpace(indentUnit);})
.replace(/[ \u00a0]{2,}/g, function(s) {return makeWhiteSpace(s.length);});
}
function cleanText(text) {
return text.replace(/\u00a0/g, " ").replace(/\u200b/g, "");
}
// Create a SPAN node with the expected properties for document part
// spans.
function makePartSpan(value) {
var text = value;
if (value.nodeType == 3) text = value.nodeValue;
else value = document.createTextNode(text);
var span = document.createElement("span");
span.isPart = true;
span.appendChild(value);
span.currentText = text;
return span;
}
function alwaysZero() {return 0;}
// On webkit, when the last BR of the document does not have text
// behind it, the cursor can not be put on the line after it. This
// makes pressing enter at the end of the document occasionally do
// nothing (or at least seem to do nothing). To work around it, this
// function makes sure the document ends with a span containing a
// zero-width space character. The traverseDOM iterator filters such
// character out again, so that the parsers won't see them. This
// function is called from a few strategic places to make sure the
// zwsp is restored after the highlighting process eats it.
var webkitLastLineHack = webkit ?
function(container) {
var last = container.lastChild;
if (!last || !last.hackBR) {
var br = document.createElement("br");
br.hackBR = true;
container.appendChild(br);
}
} : function() {};
function asEditorLines(string) {
var tab = makeWhiteSpace(indentUnit);
return map(string.replace(/\t/g, tab).replace(/\u00a0/g, " ").replace(/\r\n?/g, "\n").split("\n"), fixSpaces);
}
var Editor = (function(){
// The HTML elements whose content should be suffixed by a newline
// when converting them to flat text.
var newlineElements = {"P": true, "DIV": true, "LI": true};
// Helper function for traverseDOM. Flattens an arbitrary DOM node
// into an array of textnodes and <br> tags.
function simplifyDOM(root, atEnd) {
var result = [];
var leaving = true;
function simplifyNode(node, top) {
if (node.nodeType == 3) {
var text = node.nodeValue = fixSpaces(node.nodeValue.replace(/[\r\u200b]/g, "").replace(/\n/g, " "));
if (text.length) leaving = false;
result.push(node);
}
else if (isBR(node) && node.childNodes.length == 0) {
leaving = true;
result.push(node);
}
else {
for (var n = node.firstChild; n; n = n.nextSibling) simplifyNode(n);
if (!leaving && newlineElements.hasOwnProperty(node.nodeName.toUpperCase())) {
leaving = true;
if (!atEnd || !top)
result.push(document.createElement("br"));
}
}
}
simplifyNode(root, true);
return result;
}
// Creates a MochiKit-style iterator that goes over a series of DOM
// nodes. The values it yields are strings, the textual content of
// the nodes. It makes sure that all nodes up to and including the
// one whose text is being yielded have been 'normalized' to be just
// <span> and <br> elements.
function traverseDOM(start){
var nodeQueue = [];
// Create a function that can be used to insert nodes after the
// one given as argument.
function pointAt(node){
var parent = node.parentNode;
var next = node.nextSibling;
return function(newnode) {
parent.insertBefore(newnode, next);
};
}
var point = null;
// This an Opera-specific hack -- always insert an empty span
// between two BRs, because Opera's cursor code gets terribly
// confused when the cursor is between two BRs.
var afterBR = true;
// Insert a normalized node at the current point. If it is a text
// node, wrap it in a <span>, and give that span a currentText
// property -- this is used to cache the nodeValue, because
// directly accessing nodeValue is horribly slow on some browsers.
// The dirty property is used by the highlighter to determine
// which parts of the document have to be re-highlighted.
function insertPart(part){
var text = "\n";
if (part.nodeType == 3) {
select.snapshotChanged();
part = makePartSpan(part);
text = part.currentText;
afterBR = false;
}
else {
if (afterBR && window.opera)
point(makePartSpan(""));
afterBR = true;
}
part.dirty = true;
nodeQueue.push(part);
point(part);
return text;
}
// Extract the text and newlines from a DOM node, insert them into
// the document, and return the textual content. Used to replace
// non-normalized nodes.
function writeNode(node, end) {
var simplified = simplifyDOM(node, end);
for (var i = 0; i < simplified.length; i++)
simplified[i] = insertPart(simplified[i]);
return simplified.join("");
}
// Check whether a node is a normalized <span> element.
function partNode(node){
if (node.isPart && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
var text = node.firstChild.nodeValue;
node.dirty = node.dirty || text != node.currentText;
node.currentText = text;
return !/[\n\t\r]/.test(node.currentText);
}
return false;
}
// Advance to next node, return string for current node.
function next() {
if (!start) throw StopIteration;
var node = start;
start = node.nextSibling;
if (partNode(node)){
nodeQueue.push(node);
afterBR = false;
return node.currentText;
}
else if (isBR(node)) {
if (afterBR && window.opera)
node.parentNode.insertBefore(makePartSpan(""), node);
nodeQueue.push(node);
afterBR = true;
return "\n";
}
else {
var end = !node.nextSibling;
point = pointAt(node);
removeElement(node);
return writeNode(node, end);
}
}
// MochiKit iterators are objects with a next function that
// returns the next value or throws StopIteration when there are
// no more values.
return {next: next, nodes: nodeQueue};
}
// Determine the text size of a processed node.
function nodeSize(node) {
return isBR(node) ? 1 : node.currentText.length;
}
// Search backwards through the top-level nodes until the next BR or
// the start of the frame.
function startOfLine(node) {
while (node && !isBR(node)) node = node.previousSibling;
return node;
}
function endOfLine(node, container) {
if (!node) node = container.firstChild;
else if (isBR(node)) node = node.nextSibling;
while (node && !isBR(node)) node = node.nextSibling;
return node;
}
function time() {return new Date().getTime();}
// Client interface for searching the content of the editor. Create
// these by calling CodeMirror.getSearchCursor. To use, call
// findNext on the resulting object -- this returns a boolean
// indicating whether anything was found, and can be called again to
// skip to the next find. Use the select and replace methods to
// actually do something with the found locations.
function SearchCursor(editor, pattern, from, caseFold) {
this.editor = editor;
this.history = editor.history;
this.history.commit();
this.valid = !!pattern;
this.atOccurrence = false;
if (caseFold == undefined) caseFold = typeof pattern == "string" && pattern == pattern.toLowerCase();
function getText(node){
var line = cleanText(editor.history.textAfter(node));
return (caseFold ? line.toLowerCase() : line);
}
var topPos = {node: null, offset: 0}, self = this;
if (from && typeof from == "object" && typeof from.character == "number") {
editor.checkLine(from.line);
var pos = {node: from.line, offset: from.character};
this.pos = {from: pos, to: pos};
}
else if (from) {
this.pos = {from: select.cursorPos(editor.container, true) || topPos,
to: select.cursorPos(editor.container, false) || topPos};
}
else {
this.pos = {from: topPos, to: topPos};
}
if (typeof pattern != "string") { // Regexp match
this.matches = function(reverse, node, offset) {
if (reverse) {
var line = getText(node).slice(0, offset), match = line.match(pattern), start = 0;
while (match) {
var ind = line.indexOf(match[0]);
start += ind;
line = line.slice(ind + 1);
var newmatch = line.match(pattern);
if (newmatch) match = newmatch;
else break;
}
}
else {
var line = getText(node).slice(offset), match = line.match(pattern),
start = match && offset + line.indexOf(match[0]);
}
if (match) {
self.currentMatch = match;
return {from: {node: node, offset: start},
to: {node: node, offset: start + match[0].length}};
}
};
return;
}
if (caseFold) pattern = pattern.toLowerCase();
// Create a matcher function based on the kind of string we have.
var target = pattern.split("\n");
this.matches = (target.length == 1) ?
// For one-line strings, searching can be done simply by calling
// indexOf or lastIndexOf on the current line.
function(reverse, node, offset) {
var line = getText(node), len = pattern.length, match;
if (reverse ? (offset >= len && (match = line.lastIndexOf(pattern, offset - len)) != -1)
: (match = line.indexOf(pattern, offset)) != -1)
return {from: {node: node, offset: match},
to: {node: node, offset: match + len}};
} :
// Multi-line strings require internal iteration over lines, and
// some clunky checks to make sure the first match ends at the
// end of the line and the last match starts at the start.
function(reverse, node, offset) {
var idx = (reverse ? target.length - 1 : 0), match = target[idx], line = getText(node);
var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
if (reverse ? offsetA >= offset || offsetA != match.length
: offsetA <= offset || offsetA != line.length - match.length)
return;
var pos = node;
while (true) {
if (reverse && !pos) return;
pos = (reverse ? this.history.nodeBefore(pos) : this.history.nodeAfter(pos) );
if (!reverse && !pos) return;
line = getText(pos);
match = target[reverse ? --idx : ++idx];
if (idx > 0 && idx < target.length - 1) {
if (line != match) return;
else continue;
}
var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
return;
return {from: {node: reverse ? pos : node, offset: reverse ? offsetB : offsetA},
to: {node: reverse ? node : pos, offset: reverse ? offsetA : offsetB}};
}
};
}
SearchCursor.prototype = {
findNext: function() {return this.find(false);},
findPrevious: function() {return this.find(true);},
find: function(reverse) {
if (!this.valid) return false;
var self = this, pos = reverse ? this.pos.from : this.pos.to,
node = pos.node, offset = pos.offset;
// Reset the cursor if the current line is no longer in the DOM tree.
if (node && !node.parentNode) {
node = null; offset = 0;
}
function savePosAndFail() {
var pos = {node: node, offset: offset};
self.pos = {from: pos, to: pos};
self.atOccurrence = false;
return false;
}
while (true) {
if (this.pos = this.matches(reverse, node, offset)) {
this.atOccurrence = true;
return true;
}
if (reverse) {
if (!node) return savePosAndFail();
node = this.history.nodeBefore(node);
offset = this.history.textAfter(node).length;
}
else {
var next = this.history.nodeAfter(node);
if (!next) {
offset = this.history.textAfter(node).length;
return savePosAndFail();
}
node = next;
offset = 0;
}
}
},
select: function() {
if (this.atOccurrence) {
select.setCursorPos(this.editor.container, this.pos.from, this.pos.to);
select.scrollToCursor(this.editor.container);
}
},
replace: function(string) {
if (this.atOccurrence) {
var fragments = this.currentMatch;
if (fragments)
string = string.replace(/\\(\d)/, function(m, i){return fragments[i];});
var end = this.editor.replaceRange(this.pos.from, this.pos.to, string);
this.pos.to = end;
this.atOccurrence = false;
}
},
position: function() {
if (this.atOccurrence)
return {line: this.pos.from.node, character: this.pos.from.offset};
}
};
// The Editor object is the main inside-the-iframe interface.
function Editor(options) {
this.options = options;
window.indentUnit = options.indentUnit;
var container = this.container = document.body;
this.history = new UndoHistory(container, options.undoDepth, options.undoDelay, this);
var self = this;
if (!Editor.Parser)
throw "No parser loaded.";
if (options.parserConfig && Editor.Parser.configure)
Editor.Parser.configure(options.parserConfig);
if (!options.readOnly && !internetExplorer)
select.setCursorPos(container, {node: null, offset: 0});
this.dirty = [];
this.importCode(options.content || "");
this.history.onChange = options.onChange;
if (!options.readOnly) {
if (options.continuousScanning !== false) {
this.scanner = this.documentScanner(options.passTime);
this.delayScanning();
}
function setEditable() {
// Use contentEditable instead of designMode on IE, since designMode frames
// can not run any scripts. It would be nice if we could use contentEditable
// everywhere, but it is significantly flakier than designMode on every
// single non-IE browser.
if (document.body.contentEditable != undefined && internetExplorer)
document.body.contentEditable = "true";
else
document.designMode = "on";
// Work around issue where you have to click on the actual
// body of the document to focus it in IE, making focusing
// hard when the document is small.
if (internetExplorer && options.height != "dynamic")
document.body.style.minHeight = (
window.frameElement.clientHeight - 2 * document.body.offsetTop - 5) + "px";
document.documentElement.style.borderWidth = "0";
if (!options.textWrapping)
container.style.whiteSpace = "nowrap";
}
// If setting the frame editable fails, try again when the user
// focus it (happens when the frame is not visible on
// initialisation, in Firefox).
try {
setEditable();
}
catch(e) {
var focusEvent = addEventHandler(document, "focus", function() {
focusEvent();
setEditable();
}, true);
}
addEventHandler(document, "keydown", method(this, "keyDown"));
addEventHandler(document, "keypress", method(this, "keyPress"));
addEventHandler(document, "keyup", method(this, "keyUp"));
function cursorActivity() {self.cursorActivity(false);}
addEventHandler(internetExplorer ? document.body : window, "mouseup", cursorActivity);
addEventHandler(document.body, "cut", cursorActivity);
// workaround for a gecko bug [?] where going forward and then
// back again breaks designmode (no more cursor)
if (gecko)
addEventHandler(window, "pagehide", function(){self.unloaded = true;});
addEventHandler(document.body, "paste", function(event) {
cursorActivity();
var text = null;
try {
var clipboardData = event.clipboardData || window.clipboardData;
if (clipboardData) text = clipboardData.getData('Text');
}
catch(e) {}
if (text !== null) {
event.stop();
self.replaceSelection(text);
select.scrollToCursor(self.container);
}
});
if (this.options.autoMatchParens)
addEventHandler(document.body, "click", method(this, "scheduleParenHighlight"));
}
else if (!options.textWrapping) {
container.style.whiteSpace = "nowrap";
}
}
function isSafeKey(code) {
return (code >= 16 && code <= 18) || // shift, control, alt
(code >= 33 && code <= 40); // arrows, home, end
}
Editor.prototype = {
// Import a piece of code into the editor.
importCode: function(code) {
var lines = asEditorLines(code), chunk = 1000;
if (!this.options.incrementalLoading || lines.length < chunk) {
this.history.push(null, null, lines);
this.history.reset();
}
else {
var cur = 0, self = this;
function addChunk() {
var chunklines = lines.slice(cur, cur + chunk);
chunklines.push("");
self.history.push(self.history.nodeBefore(null), null, chunklines);
self.history.reset();
cur += chunk;
if (cur < lines.length)
parent.setTimeout(addChunk, 1000);
}
addChunk();
}
},
// Extract the code from the editor.
getCode: function() {
if (!this.container.firstChild)
return "";
var accum = [];
select.markSelection();
forEach(traverseDOM(this.container.firstChild), method(accum, "push"));
select.selectMarked();
// On webkit, don't count last (empty) line if the webkitLastLineHack BR is present
if (webkit && this.container.lastChild.hackBR)
accum.pop();
webkitLastLineHack(this.container);
return cleanText(accum.join(""));
},
checkLine: function(node) {
if (node === false || !(node == null || node.parentNode == this.container || node.hackBR))
throw parent.CodeMirror.InvalidLineHandle;
},
cursorPosition: function(start) {
if (start == null) start = true;
var pos = select.cursorPos(this.container, start);
if (pos) return {line: pos.node, character: pos.offset};
else return {line: null, character: 0};
},
firstLine: function() {
return null;
},
lastLine: function() {
var last = this.container.lastChild;
if (last) last = startOfLine(last);
if (last && last.hackBR) last = startOfLine(last.previousSibling);
return last;
},
nextLine: function(line) {
this.checkLine(line);
var end = endOfLine(line, this.container);
if (!end || end.hackBR) return false;
else return end;
},
prevLine: function(line) {
this.checkLine(line);
if (line == null) return false;
return startOfLine(line.previousSibling);
},
visibleLineCount: function() {
var line = this.container.firstChild;
while (line && isBR(line)) line = line.nextSibling; // BR heights are unreliable
if (!line) return false;
var innerHeight = (window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight);
return Math.floor(innerHeight / line.offsetHeight);
},
selectLines: function(startLine, startOffset, endLine, endOffset) {
this.checkLine(startLine);
var start = {node: startLine, offset: startOffset}, end = null;
if (endOffset !== undefined) {
this.checkLine(endLine);
end = {node: endLine, offset: endOffset};
}
select.setCursorPos(this.container, start, end);
select.scrollToCursor(this.container);
},
lineContent: function(line) {
var accum = [];
for (line = line ? line.nextSibling : this.container.firstChild;
line && !isBR(line); line = line.nextSibling)
accum.push(nodeText(line));
return cleanText(accum.join(""));
},
setLineContent: function(line, content) {
this.history.commit();
this.replaceRange({node: line, offset: 0},
{node: line, offset: this.history.textAfter(line).length},
content);
this.addDirtyNode(line);
this.scheduleHighlight();
},
removeLine: function(line) {
var node = line ? line.nextSibling : this.container.firstChild;
while (node) {
var next = node.nextSibling;
removeElement(node);
if (isBR(node)) break;
node = next;
}
this.addDirtyNode(line);
this.scheduleHighlight();
},
insertIntoLine: function(line, position, content) {
var before = null;
if (position == "end") {
before = endOfLine(line, this.container);
}
else {
for (var cur = line ? line.nextSibling : this.container.firstChild; cur; cur = cur.nextSibling) {
if (position == 0) {
before = cur;
break;
}
var text = nodeText(cur);
if (text.length > position) {
before = cur.nextSibling;
content = text.slice(0, position) + content + text.slice(position);
removeElement(cur);
break;
}
position -= text.length;
}
}
var lines = asEditorLines(content);
for (var i = 0; i < lines.length; i++) {
if (i > 0) this.container.insertBefore(document.createElement("BR"), before);
this.container.insertBefore(makePartSpan(lines[i]), before);
}
this.addDirtyNode(line);
this.scheduleHighlight();
},
// Retrieve the selected text.
selectedText: function() {
var h = this.history;
h.commit();
var start = select.cursorPos(this.container, true),
end = select.cursorPos(this.container, false);
if (!start || !end) return "";
if (start.node == end.node)
return h.textAfter(start.node).slice(start.offset, end.offset);
var text = [h.textAfter(start.node).slice(start.offset)];
for (var pos = h.nodeAfter(start.node); pos != end.node; pos = h.nodeAfter(pos))
text.push(h.textAfter(pos));
text.push(h.textAfter(end.node).slice(0, end.offset));
return cleanText(text.join("\n"));
},
// Replace the selection with another piece of text.
replaceSelection: function(text) {
this.history.commit();
var start = select.cursorPos(this.container, true),
end = select.cursorPos(this.container, false);
if (!start || !end) return;
end = this.replaceRange(start, end, text);
select.setCursorPos(this.container, end);
webkitLastLineHack(this.container);
},
cursorCoords: function(start, internal) {
var sel = select.cursorPos(this.container, start);
if (!sel) return null;
var off = sel.offset, node = sel.node, self = this;
function measureFromNode(node, xOffset) {
var y = -(document.body.scrollTop || document.documentElement.scrollTop || 0),
x = -(document.body.scrollLeft || document.documentElement.scrollLeft || 0) + xOffset;
forEach([node, internal ? null : window.frameElement], function(n) {
while (n) {x += n.offsetLeft; y += n.offsetTop;n = n.offsetParent;}
});
return {x: x, y: y, yBot: y + node.offsetHeight};
}
function withTempNode(text, f) {
var node = document.createElement("SPAN");
node.appendChild(document.createTextNode(text));
try {return f(node);}
finally {if (node.parentNode) node.parentNode.removeChild(node);}
}
while (off) {
node = node ? node.nextSibling : this.container.firstChild;
var txt = nodeText(node);
if (off < txt.length)
return withTempNode(txt.substr(0, off), function(tmp) {
tmp.style.position = "absolute"; tmp.style.visibility = "hidden";
tmp.className = node.className;
self.container.appendChild(tmp);
return measureFromNode(node, tmp.offsetWidth);
});
off -= txt.length;
}
if (node && isSpan(node))
return measureFromNode(node, node.offsetWidth);
else if (node && node.nextSibling && isSpan(node.nextSibling))
return measureFromNode(node.nextSibling, 0);
else
return withTempNode("\u200b", function(tmp) {
if (node) node.parentNode.insertBefore(tmp, node.nextSibling);
else self.container.insertBefore(tmp, self.container.firstChild);
return measureFromNode(tmp, 0);
});
},
reroutePasteEvent: function() {
if (this.capturingPaste || window.opera || (gecko && gecko >= 20101026)) return;
this.capturingPaste = true;
var te = window.frameElement.CodeMirror.textareaHack;
var coords = this.cursorCoords(true, true);
te.style.top = coords.y + "px";
if (internetExplorer) {
var snapshot = select.getBookmark(this.container);
if (snapshot) this.selectionSnapshot = snapshot;
}
parent.focus();
te.value = "";
te.focus();
var self = this;
parent.setTimeout(function() {
self.capturingPaste = false;
window.focus();
if (self.selectionSnapshot) // IE hack
window.select.setBookmark(self.container, self.selectionSnapshot);
var text = te.value;
if (text) {
self.replaceSelection(text);
select.scrollToCursor(self.container);
}
}, 10);
},
replaceRange: function(from, to, text) {
var lines = asEditorLines(text);
lines[0] = this.history.textAfter(from.node).slice(0, from.offset) + lines[0];
var lastLine = lines[lines.length - 1];
lines[lines.length - 1] = lastLine + this.history.textAfter(to.node).slice(to.offset);
var end = this.history.nodeAfter(to.node);
this.history.push(from.node, end, lines);
return {node: this.history.nodeBefore(end),
offset: lastLine.length};
},
getSearchCursor: function(string, fromCursor, caseFold) {
return new SearchCursor(this, string, fromCursor, caseFold);
},
// Re-indent the whole buffer
reindent: function() {
if (this.container.firstChild)
this.indentRegion(null, this.container.lastChild);
},
reindentSelection: function(direction) {
if (!select.somethingSelected()) {
this.indentAtCursor(direction);
}
else {
var start = select.selectionTopNode(this.container, true),
end = select.selectionTopNode(this.container, false);
if (start === false || end === false) return;
this.indentRegion(start, end, direction);
}
},
grabKeys: function(eventHandler, filter) {
this.frozen = eventHandler;
this.keyFilter = filter;
},
ungrabKeys: function() {
this.frozen = "leave";
},
setParser: function(name, parserConfig) {
Editor.Parser = window[name];
parserConfig = parserConfig || this.options.parserConfig;
if (parserConfig && Editor.Parser.configure)
Editor.Parser.configure(parserConfig);
if (this.container.firstChild) {
forEach(this.container.childNodes, function(n) {
if (n.nodeType != 3) n.dirty = true;
});
this.addDirtyNode(this.firstChild);
this.scheduleHighlight();
}
},
// Intercept enter and tab, and assign their new functions.
keyDown: function(event) {
if (this.frozen == "leave") {this.frozen = null; this.keyFilter = null;}
if (this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode, event))) {
event.stop();
this.frozen(event);
return;
}
var code = event.keyCode;
// Don't scan when the user is typing.
this.delayScanning();
// Schedule a paren-highlight event, if configured.
if (this.options.autoMatchParens)
this.scheduleParenHighlight();
// The various checks for !altKey are there because AltGr sets both
// ctrlKey and altKey to true, and should not be recognised as
// Control.
if (code == 13) { // enter
if (event.ctrlKey && !event.altKey) {
this.reparseBuffer();
}
else {
select.insertNewlineAtCursor();
var mode = this.options.enterMode;
if (mode != "flat") this.indentAtCursor(mode == "keep" ? "keep" : undefined);
select.scrollToCursor(this.container);
}
event.stop();
}
else if (code == 9 && this.options.tabMode != "default" && !event.ctrlKey) { // tab
this.handleTab(!event.shiftKey);
event.stop();
}
else if (code == 32 && event.shiftKey && this.options.tabMode == "default") { // space
this.handleTab(true);
event.stop();
}
else if (code == 36 && !event.shiftKey && !event.ctrlKey) { // home
if (this.home()) event.stop();
}
else if (code == 35 && !event.shiftKey && !event.ctrlKey) { // end
if (this.end()) event.stop();
}
// Only in Firefox is the default behavior for PgUp/PgDn correct.
else if (code == 33 && !event.shiftKey && !event.ctrlKey && !gecko) { // PgUp
if (this.pageUp()) event.stop();
}
else if (code == 34 && !event.shiftKey && !event.ctrlKey && !gecko) { // PgDn
if (this.pageDown()) event.stop();
}
else if ((code == 219 || code == 221) && event.ctrlKey && !event.altKey) { // [, ]
this.highlightParens(event.shiftKey, true);
event.stop();
}
else if (event.metaKey && !event.shiftKey && (code == 37 || code == 39)) { // Meta-left/right
var cursor = select.selectionTopNode(this.container);
if (cursor === false || !this.container.firstChild) return;
if (code == 37) select.focusAfterNode(startOfLine(cursor), this.container);
else {
var end = endOfLine(cursor, this.container);
select.focusAfterNode(end ? end.previousSibling : this.container.lastChild, this.container);
}
event.stop();
}
else if ((event.ctrlKey || event.metaKey) && !event.altKey) {
if ((event.shiftKey && code == 90) || code == 89) { // shift-Z, Y
select.scrollToNode(this.history.redo());
event.stop();
}
else if (code == 90 || (safari && code == 8)) { // Z, backspace
select.scrollToNode(this.history.undo());
event.stop();
}
else if (code == 83 && this.options.saveFunction) { // S
this.options.saveFunction();
event.stop();
}
else if (code == 86 && !mac) { // V
this.reroutePasteEvent();
}
}
},
// Check for characters that should re-indent the current line,
// and prevent Opera from handling enter and tab anyway.
keyPress: function(event) {
var electric = this.options.electricChars && Editor.Parser.electricChars, self = this;
// Hack for Opera, and Firefox on OS X, in which stopping a
// keydown event does not prevent the associated keypress event
// from happening, so we have to cancel enter and tab again
// here.
if ((this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode || event.code, event))) ||
event.code == 13 || (event.code == 9 && this.options.tabMode != "default") ||
(event.code == 32 && event.shiftKey && this.options.tabMode == "default"))
event.stop();
else if (mac && (event.ctrlKey || event.metaKey) && event.character == "v") {
this.reroutePasteEvent();
}
else if (electric && electric.indexOf(event.character) != -1)
parent.setTimeout(function(){self.indentAtCursor(null);}, 0);
// Work around a bug where pressing backspace at the end of a
// line, or delete at the start, often causes the cursor to jump
// to the start of the line in Opera 10.60.
else if (brokenOpera) {
if (event.code == 8) { // backspace
var sel = select.selectionTopNode(this.container), self = this,
next = sel ? sel.nextSibling : this.container.firstChild;
if (sel !== false && next && isBR(next))
parent.setTimeout(function(){
if (select.selectionTopNode(self.container) == next)
select.focusAfterNode(next.previousSibling, self.container);
}, 20);
}
else if (event.code == 46) { // delete
var sel = select.selectionTopNode(this.container), self = this;
if (sel && isBR(sel)) {
parent.setTimeout(function(){
if (select.selectionTopNode(self.container) != sel)
select.focusAfterNode(sel, self.container);
}, 20);
}
}
}
// In 533.* WebKit versions, when the document is big, typing
// something at the end of a line causes the browser to do some
// kind of stupid heavy operation, creating delays of several
// seconds before the typed characters appear. This very crude
// hack inserts a temporary zero-width space after the cursor to
// make it not be at the end of the line.
else if (slowWebkit) {
var sel = select.selectionTopNode(this.container),
next = sel ? sel.nextSibling : this.container.firstChild;
// Doesn't work on empty lines, for some reason those always
// trigger the delay.
if (sel && next && isBR(next) && !isBR(sel)) {
var cheat = document.createTextNode("\u200b");
this.container.insertBefore(cheat, next);
parent.setTimeout(function() {
if (cheat.nodeValue == "\u200b") removeElement(cheat);
else cheat.nodeValue = cheat.nodeValue.replace("\u200b", "");
}, 20);
}
}
// Magic incantation that works abound a webkit bug when you
// can't type on a blank line following a line that's wider than
// the window.
if (webkit && !this.options.textWrapping)
setTimeout(function () {
var node = select.selectionTopNode(self.container, true);
if (node && node.nodeType == 3 && node.previousSibling && isBR(node.previousSibling)
&& node.nextSibling && isBR(node.nextSibling))
node.parentNode.replaceChild(document.createElement("BR"), node.previousSibling);
}, 50);
},
// Mark the node at the cursor dirty when a non-safe key is
// released.
keyUp: function(event) {
this.cursorActivity(isSafeKey(event.keyCode));
},
// Indent the line following a given <br>, or null for the first
// line. If given a <br> element, this must have been highlighted
// so that it has an indentation method. Returns the whitespace
// element that has been modified or created (if any).
indentLineAfter: function(start, direction) {
function whiteSpaceAfter(node) {
var ws = node ? node.nextSibling : self.container.firstChild;
if (!ws || !hasClass(ws, "whitespace")) return null;
return ws;
}
// whiteSpace is the whitespace span at the start of the line,
// or null if there is no such node.
var self = this, whiteSpace = whiteSpaceAfter(start);
var newIndent = 0, curIndent = whiteSpace ? whiteSpace.currentText.length : 0;
var firstText = whiteSpace ? whiteSpace.nextSibling : (start ? start.nextSibling : this.container.firstChild);
if (direction == "keep") {
if (start) {
var prevWS = whiteSpaceAfter(startOfLine(start.previousSibling))
if (prevWS) newIndent = prevWS.currentText.length;
}
}
else {
// Sometimes the start of the line can influence the correct
// indentation, so we retrieve it.
var nextChars = (start && firstText && firstText.currentText) ? firstText.currentText : "";
// Ask the lexical context for the correct indentation, and
// compute how much this differs from the current indentation.
if (direction != null && this.options.tabMode == "shift")
newIndent = direction ? curIndent + indentUnit : Math.max(0, curIndent - indentUnit)
else if (start)
newIndent = start.indentation(nextChars, curIndent, direction, firstText);
else if (Editor.Parser.firstIndentation)
newIndent = Editor.Parser.firstIndentation(nextChars, curIndent, direction, firstText);
}
var indentDiff = newIndent - curIndent;
// If there is too much, this is just a matter of shrinking a span.
if (indentDiff < 0) {
if (newIndent == 0) {
if (firstText) select.snapshotMove(whiteSpace.firstChild, firstText.firstChild || firstText, 0);
removeElement(whiteSpace);
whiteSpace = null;
}
else {
select.snapshotMove(whiteSpace.firstChild, whiteSpace.firstChild, indentDiff, true);
whiteSpace.currentText = makeWhiteSpace(newIndent);
whiteSpace.firstChild.nodeValue = whiteSpace.currentText;
}
}
// Not enough...
else if (indentDiff > 0) {
// If there is whitespace, we grow it.
if (whiteSpace) {
whiteSpace.currentText = makeWhiteSpace(newIndent);
whiteSpace.firstChild.nodeValue = whiteSpace.currentText;
select.snapshotMove(whiteSpace.firstChild, whiteSpace.firstChild, indentDiff, true);
}
// Otherwise, we have to add a new whitespace node.
else {
whiteSpace = makePartSpan(makeWhiteSpace(newIndent));
whiteSpace.className = "whitespace";
if (start) insertAfter(whiteSpace, start);
else this.container.insertBefore(whiteSpace, this.container.firstChild);
select.snapshotMove(firstText && (firstText.firstChild || firstText),
whiteSpace.firstChild, newIndent, false, true);
}
}
// Make sure cursor ends up after the whitespace
else if (whiteSpace) {
select.snapshotMove(whiteSpace.firstChild, whiteSpace.firstChild, newIndent, false);
}
if (indentDiff != 0) this.addDirtyNode(start);
},
// Re-highlight the selected part of the document.
highlightAtCursor: function() {
var pos = select.selectionTopNode(this.container, true);
var to = select.selectionTopNode(this.container, false);
if (pos === false || to === false) return false;
select.markSelection();
if (this.highlight(pos, endOfLine(to, this.container), true, 20) === false)
return false;
select.selectMarked();
return true;
},
// When tab is pressed with text selected, the whole selection is
// re-indented, when nothing is selected, the line with the cursor
// is re-indented.
handleTab: function(direction) {
if (this.options.tabMode == "spaces")
select.insertTabAtCursor();
else
this.reindentSelection(direction);
},
// Custom home behaviour that doesn't land the cursor in front of
// leading whitespace unless pressed twice.
home: function() {
var cur = select.selectionTopNode(this.container, true), start = cur;
if (cur === false || !(!cur || cur.isPart || isBR(cur)) || !this.container.firstChild)
return false;
while (cur && !isBR(cur)) cur = cur.previousSibling;
var next = cur ? cur.nextSibling : this.container.firstChild;
if (next && next != start && next.isPart && hasClass(next, "whitespace"))
select.focusAfterNode(next, this.container);
else
select.focusAfterNode(cur, this.container);
select.scrollToCursor(this.container);
return true;
},
// Some browsers (Opera) don't manage to handle the end key
// properly in the face of vertical scrolling.
end: function() {
var cur = select.selectionTopNode(this.container, true);
if (cur === false) return false;
cur = endOfLine(cur, this.container);
if (!cur) return false;
select.focusAfterNode(cur.previousSibling, this.container);
select.scrollToCursor(this.container);
return true;
},
pageUp: function() {
var line = this.cursorPosition().line, scrollAmount = this.visibleLineCount();
if (line === false || scrollAmount === false) return false;
// Try to keep one line on the screen.
scrollAmount -= 2;
for (var i = 0; i < scrollAmount; i++) {
line = this.prevLine(line);
if (line === false) break;
}
if (i == 0) return false; // Already at first line
select.setCursorPos(this.container, {node: line, offset: 0});
select.scrollToCursor(this.container);
return true;
},
pageDown: function() {
var line = this.cursorPosition().line, scrollAmount = this.visibleLineCount();
if (line === false || scrollAmount === false) return false;
// Try to move to the last line of the current page.
scrollAmount -= 2;
for (var i = 0; i < scrollAmount; i++) {
var nextLine = this.nextLine(line);
if (nextLine === false) break;
line = nextLine;
}
if (i == 0) return false; // Already at last line
select.setCursorPos(this.container, {node: line, offset: 0});
select.scrollToCursor(this.container);
return true;
},
// Delay (or initiate) the next paren highlight event.
scheduleParenHighlight: function() {
if (this.parenEvent) parent.clearTimeout(this.parenEvent);
var self = this;
this.parenEvent = parent.setTimeout(function(){self.highlightParens();}, 300);
},
// Take the token before the cursor. If it contains a character in
// '()[]{}', search for the matching paren/brace/bracket, and
// highlight them in green for a moment, or red if no proper match
// was found.
highlightParens: function(jump, fromKey) {
var self = this, mark = this.options.markParen;
if (typeof mark == "string") mark = [mark, mark];
// give the relevant nodes a colour.
function highlight(node, ok) {
if (!node) return;
if (!mark) {
node.style.fontWeight = "bold";
node.style.color = ok ? "#8F8" : "#F88";
}
else if (mark.call) mark(node, ok);
else node.className += " " + mark[ok ? 0 : 1];
}
function unhighlight(node) {
if (!node) return;
if (mark && !mark.call)
removeClass(removeClass(node, mark[0]), mark[1]);
else if (self.options.unmarkParen)
self.options.unmarkParen(node);
else {
node.style.fontWeight = "";
node.style.color = "";
}
}
if (!fromKey && self.highlighted) {
unhighlight(self.highlighted[0]);
unhighlight(self.highlighted[1]);
}
if (!window || !window.parent || !window.select) return;
// Clear the event property.
if (this.parenEvent) parent.clearTimeout(this.parenEvent);
this.parenEvent = null;
// Extract a 'paren' from a piece of text.
function paren(node) {
if (node.currentText) {
var match = node.currentText.match(/^[\s\u00a0]*([\(\)\[\]{}])[\s\u00a0]*$/);
return match && match[1];
}
}
// Determine the direction a paren is facing.
function forward(ch) {
return /[\(\[\{]/.test(ch);
}
var ch, cursor = select.selectionTopNode(this.container, true);
if (!cursor || !this.highlightAtCursor()) return;
cursor = select.selectionTopNode(this.container, true);
if (!(cursor && ((ch = paren(cursor)) || (cursor = cursor.nextSibling) && (ch = paren(cursor)))))
return;
// We only look for tokens with the same className.
var className = cursor.className, dir = forward(ch), match = matching[ch];
// Since parts of the document might not have been properly
// highlighted, and it is hard to know in advance which part we
// have to scan, we just try, and when we find dirty nodes we
// abort, parse them, and re-try.
function tryFindMatch() {
var stack = [], ch, ok = true;
for (var runner = cursor; runner; runner = dir ? runner.nextSibling : runner.previousSibling) {
if (runner.className == className && isSpan(runner) && (ch = paren(runner))) {
if (forward(ch) == dir)
stack.push(ch);
else if (!stack.length)
ok = false;
else if (stack.pop() != matching[ch])
ok = false;
if (!stack.length) break;
}
else if (runner.dirty || !isSpan(runner) && !isBR(runner)) {
return {node: runner, status: "dirty"};
}
}
return {node: runner, status: runner && ok};
}
while (true) {
var found = tryFindMatch();
if (found.status == "dirty") {
this.highlight(found.node, endOfLine(found.node));
// Needed because in some corner cases a highlight does not
// reach a node.
found.node.dirty = false;
continue;
}
else {
highlight(cursor, found.status);
highlight(found.node, found.status);
if (fromKey)
parent.setTimeout(function() {unhighlight(cursor); unhighlight(found.node);}, 500);
else
self.highlighted = [cursor, found.node];
if (jump && found.node)
select.focusAfterNode(found.node.previousSibling, this.container);
break;
}
}
},
// Adjust the amount of whitespace at the start of the line that
// the cursor is on so that it is indented properly.
indentAtCursor: function(direction) {
if (!this.container.firstChild) return;
// The line has to have up-to-date lexical information, so we
// highlight it first.
if (!this.highlightAtCursor()) return;
var cursor = select.selectionTopNode(this.container, false);
// If we couldn't determine the place of the cursor,
// there's nothing to indent.
if (cursor === false)
return;
select.markSelection();
this.indentLineAfter(startOfLine(cursor), direction);
select.selectMarked();
},
// Indent all lines whose start falls inside of the current
// selection.
indentRegion: function(start, end, direction) {
var current = (start = startOfLine(start)), before = start && startOfLine(start.previousSibling);
if (!isBR(end)) end = endOfLine(end, this.container);
this.addDirtyNode(start);
do {
var next = endOfLine(current, this.container);
if (current) this.highlight(before, next, true);
this.indentLineAfter(current, direction);
before = current;
current = next;
} while (current != end);
select.setCursorPos(this.container, {node: start, offset: 0}, {node: end, offset: 0});
},
// Find the node that the cursor is in, mark it as dirty, and make
// sure a highlight pass is scheduled.
cursorActivity: function(safe) {
// pagehide event hack above
if (this.unloaded) {
window.document.designMode = "off";
window.document.designMode = "on";
this.unloaded = false;
}
if (internetExplorer) {
this.container.createTextRange().execCommand("unlink");
clearTimeout(this.saveSelectionSnapshot);
var self = this;
this.saveSelectionSnapshot = setTimeout(function() {
var snapshot = select.getBookmark(self.container);
if (snapshot) self.selectionSnapshot = snapshot;
}, 200);
}
var activity = this.options.onCursorActivity;
if (!safe || activity) {
var cursor = select.selectionTopNode(this.container, false);
if (cursor === false || !this.container.firstChild) return;
cursor = cursor || this.container.firstChild;
if (activity) activity(cursor);
if (!safe) {
this.scheduleHighlight();
this.addDirtyNode(cursor);
}
}
},
reparseBuffer: function() {
forEach(this.container.childNodes, function(node) {node.dirty = true;});
if (this.container.firstChild)
this.addDirtyNode(this.container.firstChild);
},
// Add a node to the set of dirty nodes, if it isn't already in
// there.
addDirtyNode: function(node) {
node = node || this.container.firstChild;
if (!node) return;
for (var i = 0; i < this.dirty.length; i++)
if (this.dirty[i] == node) return;
if (node.nodeType != 3)
node.dirty = true;
this.dirty.push(node);
},
allClean: function() {
return !this.dirty.length;
},
// Cause a highlight pass to happen in options.passDelay
// milliseconds. Clear the existing timeout, if one exists. This
// way, the passes do not happen while the user is typing, and
// should as unobtrusive as possible.
scheduleHighlight: function() {
// Timeouts are routed through the parent window, because on
// some browsers designMode windows do not fire timeouts.
var self = this;
parent.clearTimeout(this.highlightTimeout);
this.highlightTimeout = parent.setTimeout(function(){self.highlightDirty();}, this.options.passDelay);
},
// Fetch one dirty node, and remove it from the dirty set.
getDirtyNode: function() {
while (this.dirty.length > 0) {
var found = this.dirty.pop();
// IE8 sometimes throws an unexplainable 'invalid argument'
// exception for found.parentNode
try {
// If the node has been coloured in the meantime, or is no
// longer in the document, it should not be returned.
while (found && found.parentNode != this.container)
found = found.parentNode;
if (found && (found.dirty || found.nodeType == 3))
return found;
} catch (e) {}
}
return null;
},
// Pick dirty nodes, and highlight them, until options.passTime
// milliseconds have gone by. The highlight method will continue
// to next lines as long as it finds dirty nodes. It returns
// information about the place where it stopped. If there are
// dirty nodes left after this function has spent all its lines,
// it shedules another highlight to finish the job.
highlightDirty: function(force) {
// Prevent FF from raising an error when it is firing timeouts
// on a page that's no longer loaded.
if (!window || !window.parent || !window.select) return false;
if (!this.options.readOnly) select.markSelection();
var start, endTime = force ? null : time() + this.options.passTime;
while ((time() < endTime || force) && (start = this.getDirtyNode())) {
var result = this.highlight(start, endTime);
if (result && result.node && result.dirty)
this.addDirtyNode(result.node.nextSibling);
}
if (!this.options.readOnly) select.selectMarked();
if (start) this.scheduleHighlight();
return this.dirty.length == 0;
},
// Creates a function that, when called through a timeout, will
// continuously re-parse the document.
documentScanner: function(passTime) {
var self = this, pos = null;
return function() {
// FF timeout weirdness workaround.
if (!window || !window.parent || !window.select) return;
// If the current node is no longer in the document... oh
// well, we start over.
if (pos && pos.parentNode != self.container)
pos = null;
select.markSelection();
var result = self.highlight(pos, time() + passTime, true);
select.selectMarked();
var newPos = result ? (result.node && result.node.nextSibling) : null;
pos = (pos == newPos) ? null : newPos;
self.delayScanning();
};
},
// Starts the continuous scanning process for this document after
// a given interval.
delayScanning: function() {
if (this.scanner) {
parent.clearTimeout(this.documentScan);
this.documentScan = parent.setTimeout(this.scanner, this.options.continuousScanning);
}
},
// The function that does the actual highlighting/colouring (with
// help from the parser and the DOM normalizer). Its interface is
// rather overcomplicated, because it is used in different
// situations: ensuring that a certain line is highlighted, or
// highlighting up to X milliseconds starting from a certain
// point. The 'from' argument gives the node at which it should
// start. If this is null, it will start at the beginning of the
// document. When a timestamp is given with the 'target' argument,
// it will stop highlighting at that time. If this argument holds
// a DOM node, it will highlight until it reaches that node. If at
// any time it comes across two 'clean' lines (no dirty nodes), it
// will stop, except when 'cleanLines' is true. maxBacktrack is
// the maximum number of lines to backtrack to find an existing
// parser instance. This is used to give up in situations where a
// highlight would take too long and freeze the browser interface.
highlight: function(from, target, cleanLines, maxBacktrack){
var container = this.container, self = this, active = this.options.activeTokens;
var endTime = (typeof target == "number" ? target : null);
if (!container.firstChild)
return false;
// Backtrack to the first node before from that has a partial
// parse stored.
while (from && (!from.parserFromHere || from.dirty)) {
if (maxBacktrack != null && isBR(from) && (--maxBacktrack) < 0)
return false;
from = from.previousSibling;
}
// If we are at the end of the document, do nothing.
if (from && !from.nextSibling)
return false;
// Check whether a part (<span> node) and the corresponding token
// match.
function correctPart(token, part){
return !part.reduced && part.currentText == token.value && part.className == token.style;
}
// Shorten the text associated with a part by chopping off
// characters from the front. Note that only the currentText
// property gets changed. For efficiency reasons, we leave the
// nodeValue alone -- we set the reduced flag to indicate that
// this part must be replaced.
function shortenPart(part, minus){
part.currentText = part.currentText.substring(minus);
part.reduced = true;
}
// Create a part corresponding to a given token.
function tokenPart(token){
var part = makePartSpan(token.value);
part.className = token.style;
return part;
}
function maybeTouch(node) {
if (node) {
var old = node.oldNextSibling;
if (lineDirty || old === undefined || node.nextSibling != old)
self.history.touch(node);
node.oldNextSibling = node.nextSibling;
}
else {
var old = self.container.oldFirstChild;
if (lineDirty || old === undefined || self.container.firstChild != old)
self.history.touch(null);
self.container.oldFirstChild = self.container.firstChild;
}
}
// Get the token stream. If from is null, we start with a new
// parser from the start of the frame, otherwise a partial parse
// is resumed.
var traversal = traverseDOM(from ? from.nextSibling : container.firstChild),
stream = stringStream(traversal),
parsed = from ? from.parserFromHere(stream) : Editor.Parser.make(stream);
function surroundedByBRs(node) {
return (node.previousSibling == null || isBR(node.previousSibling)) &&
(node.nextSibling == null || isBR(node.nextSibling));
}
// parts is an interface to make it possible to 'delay' fetching
// the next DOM node until we are completely done with the one
// before it. This is necessary because often the next node is
// not yet available when we want to proceed past the current
// one.
var parts = {
current: null,
// Fetch current node.
get: function(){
if (!this.current)
this.current = traversal.nodes.shift();
return this.current;
},
// Advance to the next part (do not fetch it yet).
next: function(){
this.current = null;
},
// Remove the current part from the DOM tree, and move to the
// next.
remove: function(){
container.removeChild(this.get());
this.current = null;
},
// Advance to the next part that is not empty, discarding empty
// parts.
getNonEmpty: function(){
var part = this.get();
// Allow empty nodes when they are alone on a line, needed
// for the FF cursor bug workaround (see select.js,
// insertNewlineAtCursor).
while (part && isSpan(part) && part.currentText == "") {
// Leave empty nodes that are alone on a line alone in
// Opera, since that browsers doesn't deal well with
// having 2 BRs in a row.
if (window.opera && surroundedByBRs(part)) {
this.next();
part = this.get();
}
else {
var old = part;
this.remove();
part = this.get();
// Adjust selection information, if any. See select.js for details.
select.snapshotMove(old.firstChild, part && (part.firstChild || part), 0);
}
}
return part;
}
};
var lineDirty = false, prevLineDirty = true, lineNodes = 0;
// This forEach loops over the tokens from the parsed stream, and
// at the same time uses the parts object to proceed through the
// corresponding DOM nodes.
forEach(parsed, function(token){
var part = parts.getNonEmpty();
if (token.value == "\n"){
// The idea of the two streams actually staying synchronized
// is such a long shot that we explicitly check.
if (!isBR(part))
throw "Parser out of sync. Expected BR.";
if (part.dirty || !part.indentation) lineDirty = true;
maybeTouch(from);
from = part;
// Every <br> gets a copy of the parser state and a lexical
// context assigned to it. The first is used to be able to
// later resume parsing from this point, the second is used
// for indentation.
part.parserFromHere = parsed.copy();
part.indentation = token.indentation || alwaysZero;
part.dirty = false;
// If the target argument wasn't an integer, go at least
// until that node.
if (endTime == null && part == target) throw StopIteration;
// A clean line with more than one node means we are done.
// Throwing a StopIteration is the way to break out of a
// MochiKit forEach loop.
if ((endTime != null && time() >= endTime) || (!lineDirty && !prevLineDirty && lineNodes > 1 && !cleanLines))
throw StopIteration;
prevLineDirty = lineDirty; lineDirty = false; lineNodes = 0;
parts.next();
}
else {
if (!isSpan(part))
throw "Parser out of sync. Expected SPAN.";
if (part.dirty)
lineDirty = true;
lineNodes++;
// If the part matches the token, we can leave it alone.
if (correctPart(token, part)){
if (active && part.dirty) active(part, token, self);
part.dirty = false;
parts.next();
}
// Otherwise, we have to fix it.
else {
lineDirty = true;
// Insert the correct part.
var newPart = tokenPart(token);
container.insertBefore(newPart, part);
if (active) active(newPart, token, self);
var tokensize = token.value.length;
var offset = 0;
// Eat up parts until the text for this token has been
// removed, adjusting the stored selection info (see
// select.js) in the process.
while (tokensize > 0) {
part = parts.get();
var partsize = part.currentText.length;
select.snapshotReplaceNode(part.firstChild, newPart.firstChild, tokensize, offset);
if (partsize > tokensize){
shortenPart(part, tokensize);
tokensize = 0;
}
else {
tokensize -= partsize;
offset += partsize;
parts.remove();
}
}
}
}
});
maybeTouch(from);
webkitLastLineHack(this.container);
// The function returns some status information that is used by
// hightlightDirty to determine whether and where it has to
// continue.
return {node: parts.getNonEmpty(),
dirty: lineDirty};
}
};
return Editor;
})();
addEventHandler(window, "load", function() {
var CodeMirror = window.frameElement.CodeMirror;
var e = CodeMirror.editor = new Editor(CodeMirror.options);
parent.setTimeout(method(CodeMirror, "init"), 0);
});
| JavaScript |
/* String streams are the things fed to parsers (which can feed them
* to a tokenizer if they want). They provide peek and next methods
* for looking at the current character (next 'consumes' this
* character, peek does not), and a get method for retrieving all the
* text that was consumed since the last time get was called.
*
* An easy mistake to make is to let a StopIteration exception finish
* the token stream while there are still characters pending in the
* string stream (hitting the end of the buffer while parsing a
* token). To make it easier to detect such errors, the stringstreams
* throw an exception when this happens.
*/
// Make a stringstream stream out of an iterator that returns strings.
// This is applied to the result of traverseDOM (see codemirror.js),
// and the resulting stream is fed to the parser.
var stringStream = function(source){
// String that's currently being iterated over.
var current = "";
// Position in that string.
var pos = 0;
// Accumulator for strings that have been iterated over but not
// get()-ed yet.
var accum = "";
// Make sure there are more characters ready, or throw
// StopIteration.
function ensureChars() {
while (pos == current.length) {
accum += current;
current = ""; // In case source.next() throws
pos = 0;
try {current = source.next();}
catch (e) {
if (e != StopIteration) throw e;
else return false;
}
}
return true;
}
return {
// peek: -> character
// Return the next character in the stream.
peek: function() {
if (!ensureChars()) return null;
return current.charAt(pos);
},
// next: -> character
// Get the next character, throw StopIteration if at end, check
// for unused content.
next: function() {
if (!ensureChars()) {
if (accum.length > 0)
throw "End of stringstream reached without emptying buffer ('" + accum + "').";
else
throw StopIteration;
}
return current.charAt(pos++);
},
// get(): -> string
// Return the characters iterated over since the last call to
// .get().
get: function() {
var temp = accum;
accum = "";
if (pos > 0){
temp += current.slice(0, pos);
current = current.slice(pos);
pos = 0;
}
return temp;
},
// Push a string back into the stream.
push: function(str) {
current = current.slice(0, pos) + str + current.slice(pos);
},
lookAhead: function(str, consume, skipSpaces, caseInsensitive) {
function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
str = cased(str);
var found = false;
var _accum = accum, _pos = pos;
if (skipSpaces) this.nextWhileMatches(/[\s\u00a0]/);
while (true) {
var end = pos + str.length, left = current.length - pos;
if (end <= current.length) {
found = str == cased(current.slice(pos, end));
pos = end;
break;
}
else if (str.slice(0, left) == cased(current.slice(pos))) {
accum += current; current = "";
try {current = source.next();}
catch (e) {if (e != StopIteration) throw e; break;}
pos = 0;
str = str.slice(left);
}
else {
break;
}
}
if (!(found && consume)) {
current = accum.slice(_accum.length) + current;
pos = _pos;
accum = _accum;
}
return found;
},
// Wont't match past end of line.
lookAheadRegex: function(regex, consume) {
if (regex.source.charAt(0) != "^")
throw new Error("Regexps passed to lookAheadRegex must start with ^");
// Fetch the rest of the line
while (current.indexOf("\n", pos) == -1) {
try {current += source.next();}
catch (e) {if (e != StopIteration) throw e; break;}
}
var matched = current.slice(pos).match(regex);
if (matched && consume) pos += matched[0].length;
return matched;
},
// Utils built on top of the above
// more: -> boolean
// Produce true if the stream isn't empty.
more: function() {
return this.peek() !== null;
},
applies: function(test) {
var next = this.peek();
return (next !== null && test(next));
},
nextWhile: function(test) {
var next;
while ((next = this.peek()) !== null && test(next))
this.next();
},
matches: function(re) {
var next = this.peek();
return (next !== null && re.test(next));
},
nextWhileMatches: function(re) {
var next;
while ((next = this.peek()) !== null && re.test(next))
this.next();
},
equals: function(ch) {
return ch === this.peek();
},
endOfLine: function() {
var next = this.peek();
return next == null || next == "\n";
}
};
};
| JavaScript |
/**
* Storage and control for undo information within a CodeMirror
* editor. 'Why on earth is such a complicated mess required for
* that?', I hear you ask. The goal, in implementing this, was to make
* the complexity of storing and reverting undo information depend
* only on the size of the edited or restored content, not on the size
* of the whole document. This makes it necessary to use a kind of
* 'diff' system, which, when applied to a DOM tree, causes some
* complexity and hackery.
*
* In short, the editor 'touches' BR elements as it parses them, and
* the UndoHistory stores these. When nothing is touched in commitDelay
* milliseconds, the changes are committed: It goes over all touched
* nodes, throws out the ones that did not change since last commit or
* are no longer in the document, and assembles the rest into zero or
* more 'chains' -- arrays of adjacent lines. Links back to these
* chains are added to the BR nodes, while the chain that previously
* spanned these nodes is added to the undo history. Undoing a change
* means taking such a chain off the undo history, restoring its
* content (text is saved per line) and linking it back into the
* document.
*/
// A history object needs to know about the DOM container holding the
// document, the maximum amount of undo levels it should store, the
// delay (of no input) after which it commits a set of changes, and,
// unfortunately, the 'parent' window -- a window that is not in
// designMode, and on which setTimeout works in every browser.
function UndoHistory(container, maxDepth, commitDelay, editor) {
this.container = container;
this.maxDepth = maxDepth; this.commitDelay = commitDelay;
this.editor = editor;
// This line object represents the initial, empty editor.
var initial = {text: "", from: null, to: null};
// As the borders between lines are represented by BR elements, the
// start of the first line and the end of the last one are
// represented by null. Since you can not store any properties
// (links to line objects) in null, these properties are used in
// those cases.
this.first = initial; this.last = initial;
// Similarly, a 'historyTouched' property is added to the BR in
// front of lines that have already been touched, and 'firstTouched'
// is used for the first line.
this.firstTouched = false;
// History is the set of committed changes, touched is the set of
// nodes touched since the last commit.
this.history = []; this.redoHistory = []; this.touched = []; this.lostundo = 0;
}
UndoHistory.prototype = {
// Schedule a commit (if no other touches come in for commitDelay
// milliseconds).
scheduleCommit: function() {
var self = this;
parent.clearTimeout(this.commitTimeout);
this.commitTimeout = parent.setTimeout(function(){self.tryCommit();}, this.commitDelay);
},
// Mark a node as touched. Null is a valid argument.
touch: function(node) {
this.setTouched(node);
this.scheduleCommit();
},
// Undo the last change.
undo: function() {
// Make sure pending changes have been committed.
this.commit();
if (this.history.length) {
// Take the top diff from the history, apply it, and store its
// shadow in the redo history.
var item = this.history.pop();
this.redoHistory.push(this.updateTo(item, "applyChain"));
this.notifyEnvironment();
return this.chainNode(item);
}
},
// Redo the last undone change.
redo: function() {
this.commit();
if (this.redoHistory.length) {
// The inverse of undo, basically.
var item = this.redoHistory.pop();
this.addUndoLevel(this.updateTo(item, "applyChain"));
this.notifyEnvironment();
return this.chainNode(item);
}
},
clear: function() {
this.history = [];
this.redoHistory = [];
this.lostundo = 0;
},
// Ask for the size of the un/redo histories.
historySize: function() {
return {undo: this.history.length, redo: this.redoHistory.length, lostundo: this.lostundo};
},
// Push a changeset into the document.
push: function(from, to, lines) {
var chain = [];
for (var i = 0; i < lines.length; i++) {
var end = (i == lines.length - 1) ? to : document.createElement("br");
chain.push({from: from, to: end, text: cleanText(lines[i])});
from = end;
}
this.pushChains([chain], from == null && to == null);
this.notifyEnvironment();
},
pushChains: function(chains, doNotHighlight) {
this.commit(doNotHighlight);
this.addUndoLevel(this.updateTo(chains, "applyChain"));
this.redoHistory = [];
},
// Retrieve a DOM node from a chain (for scrolling to it after undo/redo).
chainNode: function(chains) {
for (var i = 0; i < chains.length; i++) {
var start = chains[i][0], node = start && (start.from || start.to);
if (node) return node;
}
},
// Clear the undo history, make the current document the start
// position.
reset: function() {
this.history = []; this.redoHistory = []; this.lostundo = 0;
},
textAfter: function(br) {
return this.after(br).text;
},
nodeAfter: function(br) {
return this.after(br).to;
},
nodeBefore: function(br) {
return this.before(br).from;
},
// Commit unless there are pending dirty nodes.
tryCommit: function() {
if (!window || !window.parent || !window.UndoHistory) return; // Stop when frame has been unloaded
if (this.editor.highlightDirty()) this.commit(true);
else this.scheduleCommit();
},
// Check whether the touched nodes hold any changes, if so, commit
// them.
commit: function(doNotHighlight) {
parent.clearTimeout(this.commitTimeout);
// Make sure there are no pending dirty nodes.
if (!doNotHighlight) this.editor.highlightDirty(true);
// Build set of chains.
var chains = this.touchedChains(), self = this;
if (chains.length) {
this.addUndoLevel(this.updateTo(chains, "linkChain"));
this.redoHistory = [];
this.notifyEnvironment();
}
},
// [ end of public interface ]
// Update the document with a given set of chains, return its
// shadow. updateFunc should be "applyChain" or "linkChain". In the
// second case, the chains are taken to correspond the the current
// document, and only the state of the line data is updated. In the
// first case, the content of the chains is also pushed iinto the
// document.
updateTo: function(chains, updateFunc) {
var shadows = [], dirty = [];
for (var i = 0; i < chains.length; i++) {
shadows.push(this.shadowChain(chains[i]));
dirty.push(this[updateFunc](chains[i]));
}
if (updateFunc == "applyChain")
this.notifyDirty(dirty);
return shadows;
},
// Notify the editor that some nodes have changed.
notifyDirty: function(nodes) {
forEach(nodes, method(this.editor, "addDirtyNode"))
this.editor.scheduleHighlight();
},
notifyEnvironment: function() {
if (this.onChange) this.onChange(this.editor);
// Used by the line-wrapping line-numbering code.
if (window.frameElement && window.frameElement.CodeMirror.updateNumbers)
window.frameElement.CodeMirror.updateNumbers();
},
// Link a chain into the DOM nodes (or the first/last links for null
// nodes).
linkChain: function(chain) {
for (var i = 0; i < chain.length; i++) {
var line = chain[i];
if (line.from) line.from.historyAfter = line;
else this.first = line;
if (line.to) line.to.historyBefore = line;
else this.last = line;
}
},
// Get the line object after/before a given node.
after: function(node) {
return node ? node.historyAfter : this.first;
},
before: function(node) {
return node ? node.historyBefore : this.last;
},
// Mark a node as touched if it has not already been marked.
setTouched: function(node) {
if (node) {
if (!node.historyTouched) {
this.touched.push(node);
node.historyTouched = true;
}
}
else {
this.firstTouched = true;
}
},
// Store a new set of undo info, throw away info if there is more of
// it than allowed.
addUndoLevel: function(diffs) {
this.history.push(diffs);
if (this.history.length > this.maxDepth) {
this.history.shift();
lostundo += 1;
}
},
// Build chains from a set of touched nodes.
touchedChains: function() {
var self = this;
// The temp system is a crummy hack to speed up determining
// whether a (currently touched) node has a line object associated
// with it. nullTemp is used to store the object for the first
// line, other nodes get it stored in their historyTemp property.
var nullTemp = null;
function temp(node) {return node ? node.historyTemp : nullTemp;}
function setTemp(node, line) {
if (node) node.historyTemp = line;
else nullTemp = line;
}
function buildLine(node) {
var text = [];
for (var cur = node ? node.nextSibling : self.container.firstChild;
cur && (!isBR(cur) || cur.hackBR); cur = cur.nextSibling)
if (!cur.hackBR && cur.currentText) text.push(cur.currentText);
return {from: node, to: cur, text: cleanText(text.join(""))};
}
// Filter out unchanged lines and nodes that are no longer in the
// document. Build up line objects for remaining nodes.
var lines = [];
if (self.firstTouched) self.touched.push(null);
forEach(self.touched, function(node) {
if (node && (node.parentNode != self.container || node.hackBR)) return;
if (node) node.historyTouched = false;
else self.firstTouched = false;
var line = buildLine(node), shadow = self.after(node);
if (!shadow || shadow.text != line.text || shadow.to != line.to) {
lines.push(line);
setTemp(node, line);
}
});
// Get the BR element after/before the given node.
function nextBR(node, dir) {
var link = dir + "Sibling", search = node[link];
while (search && !isBR(search))
search = search[link];
return search;
}
// Assemble line objects into chains by scanning the DOM tree
// around them.
var chains = []; self.touched = [];
forEach(lines, function(line) {
// Note that this makes the loop skip line objects that have
// been pulled into chains by lines before them.
if (!temp(line.from)) return;
var chain = [], curNode = line.from, safe = true;
// Put any line objects (referred to by temp info) before this
// one on the front of the array.
while (true) {
var curLine = temp(curNode);
if (!curLine) {
if (safe) break;
else curLine = buildLine(curNode);
}
chain.unshift(curLine);
setTemp(curNode, null);
if (!curNode) break;
safe = self.after(curNode);
curNode = nextBR(curNode, "previous");
}
curNode = line.to; safe = self.before(line.from);
// Add lines after this one at end of array.
while (true) {
if (!curNode) break;
var curLine = temp(curNode);
if (!curLine) {
if (safe) break;
else curLine = buildLine(curNode);
}
chain.push(curLine);
setTemp(curNode, null);
safe = self.before(curNode);
curNode = nextBR(curNode, "next");
}
chains.push(chain);
});
return chains;
},
// Find the 'shadow' of a given chain by following the links in the
// DOM nodes at its start and end.
shadowChain: function(chain) {
var shadows = [], next = this.after(chain[0].from), end = chain[chain.length - 1].to;
while (true) {
shadows.push(next);
var nextNode = next.to;
if (!nextNode || nextNode == end)
break;
else
next = nextNode.historyAfter || this.before(end);
// (The this.before(end) is a hack -- FF sometimes removes
// properties from BR nodes, in which case the best we can hope
// for is to not break.)
}
return shadows;
},
// Update the DOM tree to contain the lines specified in a given
// chain, link this chain into the DOM nodes.
applyChain: function(chain) {
// Some attempt is made to prevent the cursor from jumping
// randomly when an undo or redo happens. It still behaves a bit
// strange sometimes.
var cursor = select.cursorPos(this.container, false), self = this;
// Remove all nodes in the DOM tree between from and to (null for
// start/end of container).
function removeRange(from, to) {
var pos = from ? from.nextSibling : self.container.firstChild;
while (pos != to) {
var temp = pos.nextSibling;
removeElement(pos);
pos = temp;
}
}
var start = chain[0].from, end = chain[chain.length - 1].to;
// Clear the space where this change has to be made.
removeRange(start, end);
// Insert the content specified by the chain into the DOM tree.
for (var i = 0; i < chain.length; i++) {
var line = chain[i];
// The start and end of the space are already correct, but BR
// tags inside it have to be put back.
if (i > 0)
self.container.insertBefore(line.from, end);
// Add the text.
var node = makePartSpan(fixSpaces(line.text));
self.container.insertBefore(node, end);
// See if the cursor was on this line. Put it back, adjusting
// for changed line length, if it was.
if (cursor && cursor.node == line.from) {
var cursordiff = 0;
var prev = this.after(line.from);
if (prev && i == chain.length - 1) {
// Only adjust if the cursor is after the unchanged part of
// the line.
for (var match = 0; match < cursor.offset &&
line.text.charAt(match) == prev.text.charAt(match); match++){}
if (cursor.offset > match)
cursordiff = line.text.length - prev.text.length;
}
select.setCursorPos(this.container, {node: line.from, offset: Math.max(0, cursor.offset + cursordiff)});
}
// Cursor was in removed line, this is last new line.
else if (cursor && (i == chain.length - 1) && cursor.node && cursor.node.parentNode != this.container) {
select.setCursorPos(this.container, {node: line.from, offset: line.text.length});
}
}
// Anchor the chain in the DOM tree.
this.linkChain(chain);
return start;
}
};
| JavaScript |
/* Parse function for JavaScript. Makes use of the tokenizer from
* tokenizejavascript.js. Note that your parsers do not have to be
* this complicated -- if you don't want to recognize local variables,
* in many languages it is enough to just look for braces, semicolons,
* parentheses, etc, and know when you are inside a string or comment.
*
* See manual.html for more info about the parser interface.
*/
var JSParser = Editor.Parser = (function() {
// Token types that can be considered to be atoms.
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
// Setting that can be used to have JSON data indent properly.
var json = false;
// Constructor for the lexical context objects.
function JSLexical(indented, column, type, align, prev, info) {
// indentation at start of this line
this.indented = indented;
// column at which this scope was opened
this.column = column;
// type of scope ('vardef', 'stat' (statement), 'form' (special form), '[', '{', or '(')
this.type = type;
// '[', '{', or '(' blocks that have any text after their opening
// character are said to be 'aligned' -- any lines below are
// indented all the way to the opening character.
if (align != null)
this.align = align;
// Parent scope, if any.
this.prev = prev;
this.info = info;
}
// My favourite JavaScript indentation rules.
function indentJS(lexical) {
return function(firstChars) {
var firstChar = firstChars && firstChars.charAt(0), type = lexical.type;
var closing = firstChar == type;
if (type == "vardef")
return lexical.indented + 4;
else if (type == "form" && firstChar == "{")
return lexical.indented;
else if (type == "stat" || type == "form")
return lexical.indented + indentUnit;
else if (lexical.info == "switch" && !closing)
return lexical.indented + (/^(?:case|default)\b/.test(firstChars) ? indentUnit : 2 * indentUnit);
else if (lexical.align)
return lexical.column - (closing ? 1 : 0);
else
return lexical.indented + (closing ? 0 : indentUnit);
};
}
// The parser-iterator-producing function itself.
function parseJS(input, basecolumn) {
// Wrap the input in a token stream
var tokens = tokenizeJavaScript(input);
// The parser state. cc is a stack of actions that have to be
// performed to finish the current statement. For example we might
// know that we still need to find a closing parenthesis and a
// semicolon. Actions at the end of the stack go first. It is
// initialized with an infinitely looping action that consumes
// whole statements.
var cc = [json ? expressions : statements];
// Context contains information about the current local scope, the
// variables defined in that, and the scopes above it.
var context = null;
// The lexical scope, used mostly for indentation.
var lexical = new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false);
// Current column, and the indentation at the start of the current
// line. Used to create lexical scope objects.
var column = 0;
var indented = 0;
// Variables which are used by the mark, cont, and pass functions
// below to communicate with the driver loop in the 'next'
// function.
var consume, marked;
// The iterator object.
var parser = {next: next, copy: copy};
function next(){
// Start by performing any 'lexical' actions (adjusting the
// lexical variable), or the operations below will be working
// with the wrong lexical state.
while(cc[cc.length - 1].lex)
cc.pop()();
// Fetch a token.
var token = tokens.next();
// Adjust column and indented.
if (token.type == "whitespace" && column == 0)
indented = token.value.length;
column += token.value.length;
if (token.content == "\n"){
indented = column = 0;
// If the lexical scope's align property is still undefined at
// the end of the line, it is an un-aligned scope.
if (!("align" in lexical))
lexical.align = false;
// Newline tokens get an indentation function associated with
// them.
token.indentation = indentJS(lexical);
}
// No more processing for meaningless tokens.
if (token.type == "whitespace" || token.type == "comment")
return token;
// When a meaningful token is found and the lexical scope's
// align is undefined, it is an aligned scope.
if (!("align" in lexical))
lexical.align = true;
// Execute actions until one 'consumes' the token and we can
// return it.
while(true) {
consume = marked = false;
// Take and execute the topmost action.
cc.pop()(token.type, token.content);
if (consume){
// Marked is used to change the style of the current token.
if (marked)
token.style = marked;
// Here we differentiate between local and global variables.
else if (token.type == "variable" && inScope(token.content))
token.style = "js-localvariable";
return token;
}
}
}
// This makes a copy of the parser state. It stores all the
// stateful variables in a closure, and returns a function that
// will restore them when called with a new input stream. Note
// that the cc array has to be copied, because it is contantly
// being modified. Lexical objects are not mutated, and context
// objects are not mutated in a harmful way, so they can be shared
// between runs of the parser.
function copy(){
var _context = context, _lexical = lexical, _cc = cc.concat([]), _tokenState = tokens.state;
return function copyParser(input){
context = _context;
lexical = _lexical;
cc = _cc.concat([]); // copies the array
column = indented = 0;
tokens = tokenizeJavaScript(input, _tokenState);
return parser;
};
}
// Helper function for pushing a number of actions onto the cc
// stack in reverse order.
function push(fs){
for (var i = fs.length - 1; i >= 0; i--)
cc.push(fs[i]);
}
// cont and pass are used by the action functions to add other
// actions to the stack. cont will cause the current token to be
// consumed, pass will leave it for the next action.
function cont(){
push(arguments);
consume = true;
}
function pass(){
push(arguments);
consume = false;
}
// Used to change the style of the current token.
function mark(style){
marked = style;
}
// Push a new scope. Will automatically link the current scope.
function pushcontext(){
context = {prev: context, vars: {"this": true, "arguments": true}};
}
// Pop off the current scope.
function popcontext(){
context = context.prev;
}
// Register a variable in the current scope.
function register(varname){
if (context){
mark("js-variabledef");
context.vars[varname] = true;
}
}
// Check whether a variable is defined in the current scope.
function inScope(varname){
var cursor = context;
while (cursor) {
if (cursor.vars[varname])
return true;
cursor = cursor.prev;
}
return false;
}
// Push a new lexical context of the given type.
function pushlex(type, info) {
var result = function(){
lexical = new JSLexical(indented, column, type, null, lexical, info)
};
result.lex = true;
return result;
}
// Pop off the current lexical context.
function poplex(){
if (lexical.type == ")")
indented = lexical.indented;
lexical = lexical.prev;
}
poplex.lex = true;
// The 'lex' flag on these actions is used by the 'next' function
// to know they can (and have to) be ran before moving on to the
// next token.
// Creates an action that discards tokens until it finds one of
// the given type.
function expect(wanted){
return function expecting(type){
if (type == wanted) cont();
else if (wanted == ";") pass();
else cont(arguments.callee);
};
}
// Looks for a statement, and then calls itself.
function statements(type){
return pass(statement, statements);
}
function expressions(type){
return pass(expression, expressions);
}
// Dispatches various types of statements based on the type of the
// current token.
function statement(type){
if (type == "var") cont(pushlex("vardef"), vardef1, expect(";"), poplex);
else if (type == "keyword a") cont(pushlex("form"), expression, statement, poplex);
else if (type == "keyword b") cont(pushlex("form"), statement, poplex);
else if (type == "{") cont(pushlex("}"), block, poplex);
else if (type == ";") cont();
else if (type == "function") cont(functiondef);
else if (type == "for") cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"), poplex, statement, poplex);
else if (type == "variable") cont(pushlex("stat"), maybelabel);
else if (type == "switch") cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"), block, poplex, poplex);
else if (type == "case") cont(expression, expect(":"));
else if (type == "default") cont(expect(":"));
else if (type == "catch") cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), statement, poplex, popcontext);
else pass(pushlex("stat"), expression, expect(";"), poplex);
}
// Dispatch expression types.
function expression(type){
if (atomicTypes.hasOwnProperty(type)) cont(maybeoperator);
else if (type == "function") cont(functiondef);
else if (type == "keyword c") cont(expression);
else if (type == "(") cont(pushlex(")"), expression, expect(")"), poplex, maybeoperator);
else if (type == "operator") cont(expression);
else if (type == "[") cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
else if (type == "{") cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
else cont();
}
// Called for places where operators, function calls, or
// subscripts are valid. Will skip on to the next action if none
// is found.
function maybeoperator(type, value){
if (type == "operator" && /\+\+|--/.test(value)) cont(maybeoperator);
else if (type == "operator") cont(expression);
else if (type == ";") pass();
else if (type == "(") cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
else if (type == ".") cont(property, maybeoperator);
else if (type == "[") cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
}
// When a statement starts with a variable name, it might be a
// label. If no colon follows, it's a regular statement.
function maybelabel(type){
if (type == ":") cont(poplex, statement);
else pass(maybeoperator, expect(";"), poplex);
}
// Property names need to have their style adjusted -- the
// tokenizer thinks they are variables.
function property(type){
if (type == "variable") {mark("js-property"); cont();}
}
// This parses a property and its value in an object literal.
function objprop(type){
if (type == "variable") mark("js-property");
if (atomicTypes.hasOwnProperty(type)) cont(expect(":"), expression);
}
// Parses a comma-separated list of the things that are recognized
// by the 'what' argument.
function commasep(what, end){
function proceed(type) {
if (type == ",") cont(what, proceed);
else if (type == end) cont();
else cont(expect(end));
}
return function commaSeparated(type) {
if (type == end) cont();
else pass(what, proceed);
};
}
// Look for statements until a closing brace is found.
function block(type){
if (type == "}") cont();
else pass(statement, block);
}
// Variable definitions are split into two actions -- 1 looks for
// a name or the end of the definition, 2 looks for an '=' sign or
// a comma.
function vardef1(type, value){
if (type == "variable"){register(value); cont(vardef2);}
else cont();
}
function vardef2(type, value){
if (value == "=") cont(expression, vardef2);
else if (type == ",") cont(vardef1);
}
// For loops.
function forspec1(type){
if (type == "var") cont(vardef1, forspec2);
else if (type == ";") pass(forspec2);
else if (type == "variable") cont(formaybein);
else pass(forspec2);
}
function formaybein(type, value){
if (value == "in") cont(expression);
else cont(maybeoperator, forspec2);
}
function forspec2(type, value){
if (type == ";") cont(forspec3);
else if (value == "in") cont(expression);
else cont(expression, expect(";"), forspec3);
}
function forspec3(type) {
if (type == ")") pass();
else cont(expression);
}
// A function definition creates a new context, and the variables
// in its argument list have to be added to this context.
function functiondef(type, value){
if (type == "variable"){register(value); cont(functiondef);}
else if (type == "(") cont(pushcontext, commasep(funarg, ")"), statement, popcontext);
}
function funarg(type, value){
if (type == "variable"){register(value); cont();}
}
return parser;
}
return {
make: parseJS,
electricChars: "{}:",
configure: function(obj) {
if (obj.json != null) json = obj.json;
}
};
})();
| JavaScript |
var DummyParser = Editor.Parser = (function() {
function tokenizeDummy(source) {
while (!source.endOfLine()) source.next();
return "text";
}
function parseDummy(source) {
function indentTo(n) {return function() {return n;}}
source = tokenizer(source, tokenizeDummy);
var space = 0;
var iter = {
next: function() {
var tok = source.next();
if (tok.type == "whitespace") {
if (tok.value == "\n") tok.indentation = indentTo(space);
else space = tok.value.length;
}
return tok;
},
copy: function() {
var _space = space;
return function(_source) {
space = _space;
source = tokenizer(_source, tokenizeDummy);
return iter;
};
}
};
return iter;
}
return {make: parseDummy};
})();
| JavaScript |
/* Tokenizer for CSharp code */
var tokenizeCSharp = (function() {
// Advance the stream until the given character (not preceded by a
// backslash) is encountered, or the end of the line is reached.
function nextUntilUnescaped(source, end) {
var escaped = false;
var next;
while (!source.endOfLine()) {
var next = source.next();
if (next == end && !escaped)
return false;
escaped = !escaped && next == "\\";
}
return escaped;
}
// A map of JavaScript's keywords. The a/b/c keyword distinction is
// very rough, but it gives the parser enough information to parse
// correct code correctly (we don't care that much how we parse
// incorrect code). The style information included in these objects
// is used by the highlighter to pick the correct CSS style for a
// token.
var keywords = function(){
function result(type, style){
return {type: type, style: "csharp-" + style};
}
// keywords that take a parenthised expression, and then a
// statement (if)
var keywordA = result("keyword a", "keyword");
// keywords that take just a statement (else)
var keywordB = result("keyword b", "keyword");
// keywords that optionally take an expression, and form a
// statement (return)
var keywordC = result("keyword c", "keyword");
var operator = result("operator", "keyword");
var atom = result("atom", "atom");
// just a keyword with no indentation implications
var keywordD = result("keyword d", "keyword");
return {
"if": keywordA, "while": keywordA, "with": keywordA,
"else": keywordB, "do": keywordB, "try": keywordB, "finally": keywordB,
"return": keywordC, "break": keywordC, "continue": keywordC, "new": keywordC, "delete": keywordC, "throw": keywordC,
"in": operator, "typeof": operator, "instanceof": operator,
"var": result("var", "keyword"), "function": result("function", "keyword"), "catch": result("catch", "keyword"),
"for": result("for", "keyword"), "switch": result("switch", "keyword"),
"case": result("case", "keyword"), "default": result("default", "keyword"),
"true": atom, "false": atom, "null": atom,
"class": result("class", "keyword"), "namespace": result("class", "keyword"),
"public": keywordD, "private": keywordD, "protected": keywordD, "internal": keywordD,
"extern": keywordD, "override": keywordD, "virtual": keywordD, "abstract": keywordD,
"static": keywordD, "out": keywordD, "ref": keywordD, "const": keywordD,
"foreach": result("for", "keyword"), "using": keywordC,
"int": keywordD, "double": keywordD, "long": keywordD, "bool": keywordD, "char": keywordD,
"void": keywordD, "string": keywordD, "byte": keywordD, "sbyte": keywordD, "decimal": keywordD,
"float": keywordD, "uint": keywordD, "ulong": keywordD, "object": keywordD,
"short": keywordD, "ushort": keywordD,
"get": keywordD, "set": keywordD, "value": keywordD
};
}();
// Some helper regexps
var isOperatorChar = /[+\-*&%=<>!?|]/;
var isHexDigit = /[0-9A-Fa-f]/;
var isWordChar = /[\w\$_]/;
// Wrapper around jsToken that helps maintain parser state (whether
// we are inside of a multi-line comment and whether the next token
// could be a regular expression).
function jsTokenState(inside, regexp) {
return function(source, setState) {
var newInside = inside;
var type = jsToken(inside, regexp, source, function(c) {newInside = c;});
var newRegexp = type.type == "operator" || type.type == "keyword c" || type.type.match(/^[\[{}\(,;:]$/);
if (newRegexp != regexp || newInside != inside)
setState(jsTokenState(newInside, newRegexp));
return type;
};
}
// The token reader, inteded to be used by the tokenizer from
// tokenize.js (through jsTokenState). Advances the source stream
// over a token, and returns an object containing the type and style
// of that token.
function jsToken(inside, regexp, source, setInside) {
function readHexNumber(){
source.next(); // skip the 'x'
source.nextWhileMatches(isHexDigit);
return {type: "number", style: "csharp-atom"};
}
function readNumber() {
source.nextWhileMatches(/[0-9]/);
if (source.equals(".")){
source.next();
source.nextWhileMatches(/[0-9]/);
}
if (source.equals("e") || source.equals("E")){
source.next();
if (source.equals("-"))
source.next();
source.nextWhileMatches(/[0-9]/);
}
return {type: "number", style: "csharp-atom"};
}
// Read a word, look it up in keywords. If not found, it is a
// variable, otherwise it is a keyword of the type found.
function readWord() {
source.nextWhileMatches(isWordChar);
var word = source.get();
var known = keywords.hasOwnProperty(word) && keywords.propertyIsEnumerable(word) && keywords[word];
return known ? {type: known.type, style: known.style, content: word} :
{type: "variable", style: "csharp-variable", content: word};
}
function readRegexp() {
nextUntilUnescaped(source, "/");
source.nextWhileMatches(/[gi]/);
return {type: "regexp", style: "csharp-string"};
}
// Mutli-line comments are tricky. We want to return the newlines
// embedded in them as regular newline tokens, and then continue
// returning a comment token for every line of the comment. So
// some state has to be saved (inside) to indicate whether we are
// inside a /* */ sequence.
function readMultilineComment(start){
var newInside = "/*";
var maybeEnd = (start == "*");
while (true) {
if (source.endOfLine())
break;
var next = source.next();
if (next == "/" && maybeEnd){
newInside = null;
break;
}
maybeEnd = (next == "*");
}
setInside(newInside);
return {type: "comment", style: "csharp-comment"};
}
function readOperator() {
source.nextWhileMatches(isOperatorChar);
return {type: "operator", style: "csharp-operator"};
}
function readString(quote) {
var endBackSlash = nextUntilUnescaped(source, quote);
setInside(endBackSlash ? quote : null);
return {type: "string", style: "csharp-string"};
}
// Fetch the next token. Dispatches on first character in the
// stream, or first two characters when the first is a slash.
if (inside == "\"" || inside == "'")
return readString(inside);
var ch = source.next();
if (inside == "/*")
return readMultilineComment(ch);
else if (ch == "\"" || ch == "'")
return readString(ch);
// with punctuation, the type of the token is the symbol itself
else if (/[\[\]{}\(\),;\:\.]/.test(ch))
return {type: ch, style: "csharp-punctuation"};
else if (ch == "0" && (source.equals("x") || source.equals("X")))
return readHexNumber();
else if (/[0-9]/.test(ch))
return readNumber();
else if (ch == "/"){
if (source.equals("*"))
{ source.next(); return readMultilineComment(ch); }
else if (source.equals("/"))
{ nextUntilUnescaped(source, null); return {type: "comment", style: "csharp-comment"};}
else if (regexp)
return readRegexp();
else
return readOperator();
}
else if (ch == "#") { // treat c# regions like comments
nextUntilUnescaped(source, null); return {type: "comment", style: "csharp-comment"};
}
else if (isOperatorChar.test(ch))
return readOperator();
else
return readWord();
}
// The external interface to the tokenizer.
return function(source, startState) {
return tokenizer(source, startState || jsTokenState(false, true));
};
})();
| JavaScript |
/* Parse function for JavaScript. Makes use of the tokenizer from
* tokenizecsharp.js. Note that your parsers do not have to be
* this complicated -- if you don't want to recognize local variables,
* in many languages it is enough to just look for braces, semicolons,
* parentheses, etc, and know when you are inside a string or comment.
*
* See manual.html for more info about the parser interface.
*/
var JSParser = Editor.Parser = (function() {
// Token types that can be considered to be atoms.
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
// Setting that can be used to have JSON data indent properly.
var json = false;
// Constructor for the lexical context objects.
function CSharpLexical(indented, column, type, align, prev, info) {
// indentation at start of this line
this.indented = indented;
// column at which this scope was opened
this.column = column;
// type of scope ('vardef', 'stat' (statement), 'form' (special form), '[', '{', or '(')
this.type = type;
// '[', '{', or '(' blocks that have any text after their opening
// character are said to be 'aligned' -- any lines below are
// indented all the way to the opening character.
if (align != null)
this.align = align;
// Parent scope, if any.
this.prev = prev;
this.info = info;
}
// CSharp indentation rules.
function indentCSharp(lexical) {
return function(firstChars) {
var firstChar = firstChars && firstChars.charAt(0), type = lexical.type;
var closing = firstChar == type;
if (type == "vardef")
return lexical.indented + 4;
else if (type == "form" && firstChar == "{")
return lexical.indented;
else if (type == "stat" || type == "form")
return lexical.indented + indentUnit;
else if (lexical.info == "switch" && !closing)
return lexical.indented + (/^(?:case|default)\b/.test(firstChars) ? indentUnit : 2 * indentUnit);
else if (lexical.align)
return lexical.column - (closing ? 1 : 0);
else
return lexical.indented + (closing ? 0 : indentUnit);
};
}
// The parser-iterator-producing function itself.
function parseCSharp(input, basecolumn) {
// Wrap the input in a token stream
var tokens = tokenizeCSharp(input);
// The parser state. cc is a stack of actions that have to be
// performed to finish the current statement. For example we might
// know that we still need to find a closing parenthesis and a
// semicolon. Actions at the end of the stack go first. It is
// initialized with an infinitely looping action that consumes
// whole statements.
var cc = [statements];
// The lexical scope, used mostly for indentation.
var lexical = new CSharpLexical((basecolumn || 0) - indentUnit, 0, "block", false);
// Current column, and the indentation at the start of the current
// line. Used to create lexical scope objects.
var column = 0;
var indented = 0;
// Variables which are used by the mark, cont, and pass functions
// below to communicate with the driver loop in the 'next'
// function.
var consume, marked;
// The iterator object.
var parser = {next: next, copy: copy};
function next(){
// Start by performing any 'lexical' actions (adjusting the
// lexical variable), or the operations below will be working
// with the wrong lexical state.
while(cc[cc.length - 1].lex)
cc.pop()();
// Fetch a token.
var token = tokens.next();
// Adjust column and indented.
if (token.type == "whitespace" && column == 0)
indented = token.value.length;
column += token.value.length;
if (token.content == "\n"){
indented = column = 0;
// If the lexical scope's align property is still undefined at
// the end of the line, it is an un-aligned scope.
if (!("align" in lexical))
lexical.align = false;
// Newline tokens get an indentation function associated with
// them.
token.indentation = indentCSharp(lexical);
}
// No more processing for meaningless tokens.
if (token.type == "whitespace" || token.type == "comment")
return token;
// When a meaningful token is found and the lexical scope's
// align is undefined, it is an aligned scope.
if (!("align" in lexical))
lexical.align = true;
// Execute actions until one 'consumes' the token and we can
// return it.
while(true) {
consume = marked = false;
// Take and execute the topmost action.
cc.pop()(token.type, token.content);
if (consume){
// Marked is used to change the style of the current token.
if (marked)
token.style = marked;
return token;
}
}
}
// This makes a copy of the parser state. It stores all the
// stateful variables in a closure, and returns a function that
// will restore them when called with a new input stream. Note
// that the cc array has to be copied, because it is contantly
// being modified. Lexical objects are not mutated, and context
// objects are not mutated in a harmful way, so they can be shared
// between runs of the parser.
function copy(){
var _lexical = lexical, _cc = cc.concat([]), _tokenState = tokens.state;
return function copyParser(input){
lexical = _lexical;
cc = _cc.concat([]); // copies the array
column = indented = 0;
tokens = tokenizeCSharp(input, _tokenState);
return parser;
};
}
// Helper function for pushing a number of actions onto the cc
// stack in reverse order.
function push(fs){
for (var i = fs.length - 1; i >= 0; i--)
cc.push(fs[i]);
}
// cont and pass are used by the action functions to add other
// actions to the stack. cont will cause the current token to be
// consumed, pass will leave it for the next action.
function cont(){
push(arguments);
consume = true;
}
function pass(){
push(arguments);
consume = false;
}
// Used to change the style of the current token.
function mark(style){
marked = style;
}
// Push a new lexical context of the given type.
function pushlex(type, info) {
var result = function(){
lexical = new CSharpLexical(indented, column, type, null, lexical, info)
};
result.lex = true;
return result;
}
// Pop off the current lexical context.
function poplex(){
lexical = lexical.prev;
}
poplex.lex = true;
// The 'lex' flag on these actions is used by the 'next' function
// to know they can (and have to) be ran before moving on to the
// next token.
// Creates an action that discards tokens until it finds one of
// the given type.
function expect(wanted){
return function expecting(type){
if (type == wanted) cont();
else cont(arguments.callee);
};
}
// Looks for a statement, and then calls itself.
function statements(type){
return pass(statement, statements);
}
// Dispatches various types of statements based on the type of the
// current token.
function statement(type){
if (type == "var") cont(pushlex("vardef"), vardef1, expect(";"), poplex);
else if (type == "keyword a") cont(pushlex("form"), expression, statement, poplex);
else if (type == "keyword b") cont(pushlex("form"), statement, poplex);
else if (type == "{" && json) cont(pushlex("}"), commasep(objprop, "}"), poplex);
else if (type == "{") cont(pushlex("}"), block, poplex);
else if (type == "function") cont(functiondef);
else if (type == "for") cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"), poplex, statement, poplex);
else if (type == "variable") cont(pushlex("stat"), maybelabel);
else if (type == "switch") cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"), block, poplex, poplex);
else if (type == "case") cont(expression, expect(":"));
else if (type == "default") cont(expect(":"));
else if (type == "catch") cont(pushlex("form"), expect("("), funarg, expect(")"), statement, poplex);
else if (type == "class") cont(classdef);
else if (type == "keyword d") cont(statement);
else pass(pushlex("stat"), expression, expect(";"), poplex);
}
// Dispatch expression types.
function expression(type){
if (atomicTypes.hasOwnProperty(type)) cont(maybeoperator);
else if (type == "function") cont(functiondef);
else if (type == "keyword c") cont(expression);
else if (type == "(") cont(pushlex(")"), expression, expect(")"), poplex, maybeoperator);
else if (type == "operator") cont(expression);
else if (type == "[") cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
else if (type == "{") cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
}
// Called for places where operators, function calls, or
// subscripts are valid. Will skip on to the next action if none
// is found.
function maybeoperator(type){
if (type == "operator") cont(expression);
else if (type == "(") cont(pushlex(")"), expression, commasep(expression, ")"), poplex, maybeoperator);
else if (type == ".") cont(property, maybeoperator);
else if (type == "[") cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
}
// When a statement starts with a variable name, it might be a
// label. If no colon follows, it's a regular statement.
function maybelabel(type){
if (type == ":") cont(poplex, statement);
else if (type == "(") cont(commasep(funarg, ")"), poplex, statement); // method definition
else if (type == "{") cont(poplex, pushlex("}"), block, poplex); // property definition
else pass(maybeoperator, expect(";"), poplex);
}
// Property names need to have their style adjusted -- the
// tokenizer thinks they are variables.
function property(type){
if (type == "variable") {mark("csharp-property"); cont();}
}
// This parses a property and its value in an object literal.
function objprop(type){
if (type == "variable") mark("csharp-property");
if (atomicTypes.hasOwnProperty(type)) cont(expect(":"), expression);
}
// Parses a comma-separated list of the things that are recognized
// by the 'what' argument.
function commasep(what, end){
function proceed(type) {
if (type == ",") cont(what, proceed);
else if (type == end) cont();
else cont(expect(end));
};
return function commaSeparated(type) {
if (type == end) cont();
else pass(what, proceed);
};
}
// Look for statements until a closing brace is found.
function block(type){
if (type == "}") cont();
else pass(statement, block);
}
// Variable definitions are split into two actions -- 1 looks for
// a name or the end of the definition, 2 looks for an '=' sign or
// a comma.
function vardef1(type, value){
if (type == "variable"){cont(vardef2);}
else cont();
}
function vardef2(type, value){
if (value == "=") cont(expression, vardef2);
else if (type == ",") cont(vardef1);
}
// For loops.
function forspec1(type){
if (type == "var") cont(vardef1, forspec2);
else if (type == "keyword d") cont(vardef1, forspec2);
else if (type == ";") pass(forspec2);
else if (type == "variable") cont(formaybein);
else pass(forspec2);
}
function formaybein(type, value){
if (value == "in") cont(expression);
else cont(maybeoperator, forspec2);
}
function forspec2(type, value){
if (type == ";") cont(forspec3);
else if (value == "in") cont(expression);
else cont(expression, expect(";"), forspec3);
}
function forspec3(type) {
if (type == ")") pass();
else cont(expression);
}
// A function definition creates a new context, and the variables
// in its argument list have to be added to this context.
function functiondef(type, value){
if (type == "variable") cont(functiondef);
else if (type == "(") cont(commasep(funarg, ")"), statement);
}
function funarg(type, value){
if (type == "variable"){cont();}
}
function classdef(type) {
if (type == "variable") cont(classdef, statement);
else if (type == ":") cont(classdef, statement);
}
return parser;
}
return {
make: parseCSharp,
electricChars: "{}:",
configure: function(obj) {
if (obj.json != null) json = obj.json;
}
};
})();
| JavaScript |
/*
Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
The copyrights embodied in the content of this file are licensed by
Yahoo! Inc. under the BSD (revised) open source license
@author Dan Vlad Dascalescu <dandv@yahoo-inc.com>
Parse function for PHP. Makes use of the tokenizer from tokenizephp.js.
Based on parsejavascript.js by Marijn Haverbeke.
Features:
+ special "deprecated" style for PHP4 keywords like 'var'
+ support for PHP 5.3 keywords: 'namespace', 'use'
+ 911 predefined constants, 1301 predefined functions, 105 predeclared classes
from a typical PHP installation in a LAMP environment
+ new feature: syntax error flagging, thus enabling strict parsing of:
+ function definitions with explicitly or implicitly typed arguments and default values
+ modifiers (public, static etc.) applied to method and member definitions
+ foreach(array_expression as $key [=> $value]) loops
+ differentiation between single-quoted strings and double-quoted interpolating strings
*/
// add the Array.indexOf method for JS engines that don't support it (e.g. IE)
// code from https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Global_Objects/Array/IndexOf
if (!Array.prototype.indexOf)
{
Array.prototype.indexOf = function(elt /*, from*/)
{
var len = this.length;
var from = Number(arguments[1]) || 0;
from = (from < 0)
? Math.ceil(from)
: Math.floor(from);
if (from < 0)
from += len;
for (; from < len; from++)
{
if (from in this &&
this[from] === elt)
return from;
}
return -1;
};
}
var PHPParser = Editor.Parser = (function() {
// Token types that can be considered to be atoms, part of operator expressions
var atomicTypes = {
"atom": true, "number": true, "variable": true, "string": true
};
// Constructor for the lexical context objects.
function PHPLexical(indented, column, type, align, prev, info) {
// indentation at start of this line
this.indented = indented;
// column at which this scope was opened
this.column = column;
// type of scope ('stat' (statement), 'form' (special form), '[', '{', or '(')
this.type = type;
// '[', '{', or '(' blocks that have any text after their opening
// character are said to be 'aligned' -- any lines below are
// indented all the way to the opening character.
if (align != null)
this.align = align;
// Parent scope, if any.
this.prev = prev;
this.info = info;
}
// PHP indentation rules
function indentPHP(lexical) {
return function(firstChars) {
var firstChar = firstChars && firstChars.charAt(0), type = lexical.type;
var closing = firstChar == type;
if (type == "form" && firstChar == "{")
return lexical.indented;
else if (type == "stat" || type == "form")
return lexical.indented + indentUnit;
else if (lexical.info == "switch" && !closing)
return lexical.indented + (/^(?:case|default)\b/.test(firstChars) ? indentUnit : 2 * indentUnit);
else if (lexical.align)
return lexical.column - (closing ? 1 : 0);
else
return lexical.indented + (closing ? 0 : indentUnit);
};
}
// The parser-iterator-producing function itself.
function parsePHP(input, basecolumn) {
// Wrap the input in a token stream
var tokens = tokenizePHP(input);
// The parser state. cc is a stack of actions that have to be
// performed to finish the current statement. For example we might
// know that we still need to find a closing parenthesis and a
// semicolon. Actions at the end of the stack go first. It is
// initialized with an infinitely looping action that consumes
// whole statements.
var cc = [statements];
// The lexical scope, used mostly for indentation.
var lexical = new PHPLexical((basecolumn || 0) - indentUnit, 0, "block", false);
// Current column, and the indentation at the start of the current
// line. Used to create lexical scope objects.
var column = 0;
var indented = 0;
// Variables which are used by the mark, cont, and pass functions
// below to communicate with the driver loop in the 'next' function.
var consume, marked;
// The iterator object.
var parser = {next: next, copy: copy};
// parsing is accomplished by calling next() repeatedly
function next(){
// Start by performing any 'lexical' actions (adjusting the
// lexical variable), or the operations below will be working
// with the wrong lexical state.
while(cc[cc.length - 1].lex)
cc.pop()();
// Fetch the next token.
var token = tokens.next();
// Adjust column and indented.
if (token.type == "whitespace" && column == 0)
indented = token.value.length;
column += token.value.length;
if (token.content == "\n"){
indented = column = 0;
// If the lexical scope's align property is still undefined at
// the end of the line, it is an un-aligned scope.
if (!("align" in lexical))
lexical.align = false;
// Newline tokens get an indentation function associated with
// them.
token.indentation = indentPHP(lexical);
}
// No more processing for meaningless tokens.
if (token.type == "whitespace" || token.type == "comment"
|| token.type == "string_not_terminated" )
return token;
// When a meaningful token is found and the lexical scope's
// align is undefined, it is an aligned scope.
if (!("align" in lexical))
lexical.align = true;
// Execute actions until one 'consumes' the token and we can
// return it. 'marked' is used to change the style of the current token.
while(true) {
consume = marked = false;
// Take and execute the topmost action.
var action = cc.pop();
action(token);
if (consume){
if (marked)
token.style = marked;
// Here we differentiate between local and global variables.
return token;
}
}
return 1; // Firebug workaround for http://code.google.com/p/fbug/issues/detail?id=1239#c1
}
// This makes a copy of the parser state. It stores all the
// stateful variables in a closure, and returns a function that
// will restore them when called with a new input stream. Note
// that the cc array has to be copied, because it is contantly
// being modified. Lexical objects are not mutated, so they can
// be shared between runs of the parser.
function copy(){
var _lexical = lexical, _cc = cc.concat([]), _tokenState = tokens.state;
return function copyParser(input){
lexical = _lexical;
cc = _cc.concat([]); // copies the array
column = indented = 0;
tokens = tokenizePHP(input, _tokenState);
return parser;
};
}
// Helper function for pushing a number of actions onto the cc
// stack in reverse order.
function push(fs){
for (var i = fs.length - 1; i >= 0; i--)
cc.push(fs[i]);
}
// cont and pass are used by the action functions to add other
// actions to the stack. cont will cause the current token to be
// consumed, pass will leave it for the next action.
function cont(){
push(arguments);
consume = true;
}
function pass(){
push(arguments);
consume = false;
}
// Used to change the style of the current token.
function mark(style){
marked = style;
}
// Add a lyer of style to the current token, for example syntax-error
function mark_add(style){
marked = marked + ' ' + style;
}
// Push a new lexical context of the given type.
function pushlex(type, info) {
var result = function pushlexing() {
lexical = new PHPLexical(indented, column, type, null, lexical, info)
};
result.lex = true;
return result;
}
// Pop off the current lexical context.
function poplex(){
if (lexical.prev)
lexical = lexical.prev;
}
poplex.lex = true;
// The 'lex' flag on these actions is used by the 'next' function
// to know they can (and have to) be ran before moving on to the
// next token.
// Creates an action that discards tokens until it finds one of
// the given type. This will ignore (and recover from) syntax errors.
function expect(wanted){
return function expecting(token){
if (token.type == wanted) cont(); // consume the token
else {
cont(arguments.callee); // continue expecting() - call itself
}
};
}
// Require a specific token type, or one of the tokens passed in the 'wanted' array
// Used to detect blatant syntax errors. 'execute' is used to pass extra code
// to be executed if the token is matched. For example, a '(' match could
// 'execute' a cont( compasep(funcarg), require(")") )
function require(wanted, execute){
return function requiring(token){
var ok;
var type = token.type;
if (typeof(wanted) == "string")
ok = (type == wanted) -1;
else
ok = wanted.indexOf(type);
if (ok >= 0) {
if (execute && typeof(execute[ok]) == "function") pass(execute[ok]);
else cont();
}
else {
if (!marked) mark(token.style);
mark_add("syntax-error");
cont(arguments.callee);
}
};
}
// Looks for a statement, and then calls itself.
function statements(token){
return pass(statement, statements);
}
// Dispatches various types of statements based on the type of the current token.
function statement(token){
var type = token.type;
if (type == "keyword a") cont(pushlex("form"), expression, altsyntax, statement, poplex);
else if (type == "keyword b") cont(pushlex("form"), altsyntax, statement, poplex);
else if (type == "{") cont(pushlex("}"), block, poplex);
else if (type == "function") funcdef();
// technically, "class implode {...}" is correct, but we'll flag that as an error because it overrides a predefined function
else if (type == "class") classdef();
else if (type == "foreach") cont(pushlex("form"), require("("), pushlex(")"), expression, require("as"), require("variable"), /* => $value */ expect(")"), altsyntax, poplex, statement, poplex);
else if (type == "for") cont(pushlex("form"), require("("), pushlex(")"), expression, require(";"), expression, require(";"), expression, require(")"), altsyntax, poplex, statement, poplex);
// public final function foo(), protected static $bar;
else if (type == "modifier") cont(require(["modifier", "variable", "function", "abstract"],
[null, commasep(require("variable")), funcdef, absfun]));
else if (type == "abstract") abs();
else if (type == "switch") cont(pushlex("form"), require("("), expression, require(")"), pushlex("}", "switch"), require([":", "{"]), block, poplex, poplex);
else if (type == "case") cont(expression, require(":"));
else if (type == "default") cont(require(":"));
else if (type == "catch") cont(pushlex("form"), require("("), require("t_string"), require("variable"), require(")"), statement, poplex);
else if (type == "const") cont(require("t_string")); // 'const static x=5' is a syntax error
// technically, "namespace implode {...}" is correct, but we'll flag that as an error because it overrides a predefined function
else if (type == "namespace") cont(namespacedef, require(";"));
// $variables may be followed by operators, () for variable function calls, or [] subscripts
else pass(pushlex("stat"), expression, require(";"), poplex);
}
// Dispatch expression types.
function expression(token){
var type = token.type;
if (atomicTypes.hasOwnProperty(type)) cont(maybeoperator);
else if (type == "<<<") cont(require("string"), maybeoperator); // heredoc/nowdoc
else if (type == "t_string") cont(maybe_double_colon, maybeoperator);
else if (type == "keyword c" || type == "operator") cont(expression);
// lambda
else if (type == "function") lambdadef();
// function call or parenthesized expression: $a = ($b + 1) * 2;
else if (type == "(") cont(pushlex(")"), commasep(expression), require(")"), poplex, maybeoperator);
}
// Called for places where operators, function calls, or subscripts are
// valid. Will skip on to the next action if none is found.
function maybeoperator(token){
var type = token.type;
if (type == "operator") {
if (token.content == "?") cont(expression, require(":"), expression); // ternary operator
else cont(expression);
}
else if (type == "(") cont(pushlex(")"), expression, commasep(expression), require(")"), poplex, maybeoperator /* $varfunc() + 3 */);
else if (type == "[") cont(pushlex("]"), expression, require("]"), maybeoperator /* for multidimensional arrays, or $func[$i]() */, poplex);
}
// A regular use of the double colon to specify a class, as in self::func() or myclass::$var;
// Differs from `namespace` or `use` in that only one class can be the parent; chains (A::B::$var) are a syntax error.
function maybe_double_colon(token) {
if (token.type == "t_double_colon")
// A::$var, A::func(), A::const
cont(require(["t_string", "variable"]), maybeoperator);
else {
// a t_string wasn't followed by ::, such as in a function call: foo()
pass(expression)
}
}
// the declaration or definition of a function
function funcdef() {
cont(require("t_string"), require("("), pushlex(")"), commasep(funcarg), require(")"), poplex, block);
}
// the declaration or definition of a lambda
function lambdadef() {
cont(require("("), pushlex(")"), commasep(funcarg), require(")"), maybe_lambda_use, poplex, require("{"), pushlex("}"), block, poplex);
}
// optional lambda 'use' statement
function maybe_lambda_use(token) {
if(token.type == "namespace") {
cont(require('('), commasep(funcarg), require(')'));
}
else {
pass(expression);
}
}
// the definition of a class
function classdef() {
cont(require("t_string"), expect("{"), pushlex("}"), block, poplex);
}
// either funcdef if the current token is "function", or the keyword "function" + funcdef
function absfun(token) {
if(token.type == "function") funcdef();
else cont(require(["function"], [funcdef]));
}
// the abstract class or function (with optional modifier)
function abs(token) {
cont(require(["modifier", "function", "class"], [absfun, funcdef, classdef]));
}
// Parses a comma-separated list of the things that are recognized
// by the 'what' argument.
function commasep(what){
function proceed(token) {
if (token.type == ",") cont(what, proceed);
}
return function commaSeparated() {
pass(what, proceed);
};
}
// Look for statements until a closing brace is found.
function block(token) {
if (token.type == "}") cont();
else pass(statement, block);
}
function empty_parens_if_array(token) {
if(token.content == "array")
cont(require("("), require(")"));
}
function maybedefaultparameter(token){
if (token.content == "=") cont(require(["t_string", "string", "number", "atom"], [empty_parens_if_array, null, null]));
}
function var_or_reference(token) {
if(token.type == "variable") cont(maybedefaultparameter);
else if(token.content == "&") cont(require("variable"), maybedefaultparameter);
}
// support for default arguments: http://us.php.net/manual/en/functions.arguments.php#functions.arguments.default
function funcarg(token){
// function foo(myclass $obj) {...} or function foo(myclass &objref) {...}
if (token.type == "t_string") cont(var_or_reference);
// function foo($var) {...} or function foo(&$ref) {...}
else var_or_reference(token);
}
// A namespace definition or use
function maybe_double_colon_def(token) {
if (token.type == "t_double_colon")
cont(namespacedef);
}
function namespacedef(token) {
pass(require("t_string"), maybe_double_colon_def);
}
function altsyntax(token){
if(token.content==':')
cont(altsyntaxBlock,poplex);
}
function altsyntaxBlock(token){
if (token.type == "altsyntaxend") cont(require(';'));
else pass(statement, altsyntaxBlock);
}
return parser;
}
return {make: parsePHP, electricChars: "{}:"};
})();
| JavaScript |
/*
Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
The copyrights embodied in the content of this file are licensed by
Yahoo! Inc. under the BSD (revised) open source license
@author Dan Vlad Dascalescu <dandv@yahoo-inc.com>
Based on parsehtmlmixed.js by Marijn Haverbeke.
*/
var PHPHTMLMixedParser = Editor.Parser = (function() {
var processingInstructions = ["<?php"];
if (!(PHPParser && CSSParser && JSParser && XMLParser))
throw new Error("PHP, CSS, JS, and XML parsers must be loaded for PHP+HTML mixed mode to work.");
XMLParser.configure({useHTMLKludges: true});
function parseMixed(stream) {
var htmlParser = XMLParser.make(stream), localParser = null,
inTag = false, lastAtt = null, phpParserState = null;
var iter = {next: top, copy: copy};
function top() {
var token = htmlParser.next();
if (token.content == "<")
inTag = true;
else if (token.style == "xml-tagname" && inTag === true)
inTag = token.content.toLowerCase();
else if (token.style == "xml-attname")
lastAtt = token.content;
else if (token.type == "xml-processing") {
// see if this opens a PHP block
for (var i = 0; i < processingInstructions.length; i++)
if (processingInstructions[i] == token.content) {
iter.next = local(PHPParser, "?>");
break;
}
}
else if (token.style == "xml-attribute" && token.content == "\"php\"" && inTag == "script" && lastAtt == "language")
inTag = "script/php";
// "xml-processing" tokens are ignored, because they should be handled by a specific local parser
else if (token.content == ">") {
if (inTag == "script/php")
iter.next = local(PHPParser, "</script>");
else if (inTag == "script")
iter.next = local(JSParser, "</script");
else if (inTag == "style")
iter.next = local(CSSParser, "</style");
lastAtt = null;
inTag = false;
}
return token;
}
function local(parser, tag) {
var baseIndent = htmlParser.indentation();
if (parser == PHPParser && phpParserState)
localParser = phpParserState(stream);
else
localParser = parser.make(stream, baseIndent + indentUnit);
return function() {
if (stream.lookAhead(tag, false, false, true)) {
if (parser == PHPParser) phpParserState = localParser.copy();
localParser = null;
iter.next = top;
return top(); // pass the ending tag to the enclosing parser
}
var token = localParser.next();
var lt = token.value.lastIndexOf("<"), sz = Math.min(token.value.length - lt, tag.length);
if (lt != -1 && token.value.slice(lt, lt + sz).toLowerCase() == tag.slice(0, sz) &&
stream.lookAhead(tag.slice(sz), false, false, true)) {
stream.push(token.value.slice(lt));
token.value = token.value.slice(0, lt);
}
if (token.indentation) {
var oldIndent = token.indentation;
token.indentation = function(chars) {
if (chars == "</")
return baseIndent;
else
return oldIndent(chars);
}
}
return token;
};
}
function copy() {
var _html = htmlParser.copy(), _local = localParser && localParser.copy(),
_next = iter.next, _inTag = inTag, _lastAtt = lastAtt, _php = phpParserState;
return function(_stream) {
stream = _stream;
htmlParser = _html(_stream);
localParser = _local && _local(_stream);
phpParserState = _php;
iter.next = _next;
inTag = _inTag;
lastAtt = _lastAtt;
return iter;
};
}
return iter;
}
return {
make: parseMixed,
electricChars: "{}/:",
configure: function(conf) {
if (conf.opening != null) processingInstructions = conf.opening;
}
};
})();
| JavaScript |
/*
Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
The copyrights embodied in the content of this file are licensed by
Yahoo! Inc. under the BSD (revised) open source license
@author Vlad Dan Dascalescu <dandv@yahoo-inc.com>
Tokenizer for PHP code
References:
+ http://php.net/manual/en/reserved.php
+ http://php.net/tokens
+ get_defined_constants(), get_defined_functions(), get_declared_classes()
executed on a realistic (not vanilla) PHP installation with typical LAMP modules.
Specifically, the PHP bundled with the Uniform Web Server (www.uniformserver.com).
*/
// add the forEach method for JS engines that don't support it (e.g. IE)
// code from https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference:Objects:Array:forEach
if (!Array.prototype.forEach)
{
Array.prototype.forEach = function(fun /*, thisp*/)
{
var len = this.length;
if (typeof fun != "function")
throw new TypeError();
var thisp = arguments[1];
for (var i = 0; i < len; i++)
{
if (i in this)
fun.call(thisp, this[i], i, this);
}
};
}
var tokenizePHP = (function() {
/* A map of PHP's reserved words (keywords, predefined classes, functions and
constants. Each token has a type ('keyword', 'operator' etc.) and a style.
The style corresponds to the CSS span class in phpcolors.css.
Keywords can be of three types:
a - takes an expression and forms a statement - e.g. if
b - takes just a statement - e.g. else
c - takes an optinoal expression, but no statement - e.g. return
This distinction gives the parser enough information to parse
correct code correctly (we don't care that much how we parse
incorrect code).
Reference: http://us.php.net/manual/en/reserved.php
*/
var keywords = function(){
function token(type, style){
return {type: type, style: style};
}
var result = {};
// for each(var element in ["...", "..."]) can pick up elements added to
// Array.prototype, so we'll use the loop structure below. See also
// http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for_each...in
// keywords that take an expression and form a statement
["if", "elseif", "while", "declare"].forEach(function(element, index, array) {
result[element] = token("keyword a", "php-keyword");
});
// keywords that take just a statement
["do", "else", "try" ].forEach(function(element, index, array) {
result[element] = token("keyword b", "php-keyword");
});
// keywords that take an optional expression, but no statement
["return", "break", "continue", // the expression is optional
"new", "clone", "throw" // the expression is mandatory
].forEach(function(element, index, array) {
result[element] = token("keyword c", "php-keyword");
});
["__CLASS__", "__DIR__", "__FILE__", "__FUNCTION__", "__METHOD__", "__NAMESPACE__"].forEach(function(element, index, array) {
result[element] = token("atom", "php-compile-time-constant");
});
["true", "false", "null"].forEach(function(element, index, array) {
result[element] = token("atom", "php-atom");
});
["and", "or", "xor", "instanceof"].forEach(function(element, index, array) {
result[element] = token("operator", "php-keyword php-operator");
});
["class", "interface"].forEach(function(element, index, array) {
result[element] = token("class", "php-keyword");
});
["namespace", "use", "extends", "implements"].forEach(function(element, index, array) {
result[element] = token("namespace", "php-keyword");
});
// reserved "language constructs"... http://php.net/manual/en/reserved.php
[ "die", "echo", "empty", "exit", "eval", "include", "include_once", "isset",
"list", "require", "require_once", "return", "print", "unset",
"array" // a keyword rather, but mandates a parenthesized parameter list
].forEach(function(element, index, array) {
result[element] = token("t_string", "php-reserved-language-construct");
});
result["switch"] = token("switch", "php-keyword");
result["case"] = token("case", "php-keyword");
result["default"] = token("default", "php-keyword");
result["catch"] = token("catch", "php-keyword");
result["function"] = token("function", "php-keyword");
// http://php.net/manual/en/control-structures.alternative-syntax.php must be followed by a ':'
["endif", "endwhile", "endfor", "endforeach", "endswitch", "enddeclare"].forEach(function(element, index, array) {
result[element] = token("altsyntaxend", "php-keyword");
});
result["const"] = token("const", "php-keyword");
["final", "private", "protected", "public", "global", "static"].forEach(function(element, index, array) {
result[element] = token("modifier", "php-keyword");
});
result["var"] = token("modifier", "php-keyword deprecated");
result["abstract"] = token("abstract", "php-keyword");
result["foreach"] = token("foreach", "php-keyword");
result["as"] = token("as", "php-keyword");
result["for"] = token("for", "php-keyword");
// PHP built-in functions - output of get_defined_functions()["internal"]
[ "zend_version", "func_num_args", "func_get_arg", "func_get_args", "strlen",
"strcmp", "strncmp", "strcasecmp", "strncasecmp", "each", "error_reporting",
"define", "defined", "get_class", "get_parent_class", "method_exists",
"property_exists", "class_exists", "interface_exists", "function_exists",
"get_included_files", "get_required_files", "is_subclass_of", "is_a",
"get_class_vars", "get_object_vars", "get_class_methods", "trigger_error",
"user_error", "set_error_handler", "restore_error_handler",
"set_exception_handler", "restore_exception_handler", "get_declared_classes",
"get_declared_interfaces", "get_defined_functions", "get_defined_vars",
"create_function", "get_resource_type", "get_loaded_extensions",
"extension_loaded", "get_extension_funcs", "get_defined_constants",
"debug_backtrace", "debug_print_backtrace", "bcadd", "bcsub", "bcmul", "bcdiv",
"bcmod", "bcpow", "bcsqrt", "bcscale", "bccomp", "bcpowmod", "jdtogregorian",
"gregoriantojd", "jdtojulian", "juliantojd", "jdtojewish", "jewishtojd",
"jdtofrench", "frenchtojd", "jddayofweek", "jdmonthname", "easter_date",
"easter_days", "unixtojd", "jdtounix", "cal_to_jd", "cal_from_jd",
"cal_days_in_month", "cal_info", "variant_set", "variant_add", "variant_cat",
"variant_sub", "variant_mul", "variant_and", "variant_div", "variant_eqv",
"variant_idiv", "variant_imp", "variant_mod", "variant_or", "variant_pow",
"variant_xor", "variant_abs", "variant_fix", "variant_int", "variant_neg",
"variant_not", "variant_round", "variant_cmp", "variant_date_to_timestamp",
"variant_date_from_timestamp", "variant_get_type", "variant_set_type",
"variant_cast", "com_create_guid", "com_event_sink", "com_print_typeinfo",
"com_message_pump", "com_load_typelib", "com_get_active_object", "ctype_alnum",
"ctype_alpha", "ctype_cntrl", "ctype_digit", "ctype_lower", "ctype_graph",
"ctype_print", "ctype_punct", "ctype_space", "ctype_upper", "ctype_xdigit",
"strtotime", "date", "idate", "gmdate", "mktime", "gmmktime", "checkdate",
"strftime", "gmstrftime", "time", "localtime", "getdate", "date_create",
"date_parse", "date_format", "date_modify", "date_timezone_get",
"date_timezone_set", "date_offset_get", "date_time_set", "date_date_set",
"date_isodate_set", "timezone_open", "timezone_name_get",
"timezone_name_from_abbr", "timezone_offset_get", "timezone_transitions_get",
"timezone_identifiers_list", "timezone_abbreviations_list",
"date_default_timezone_set", "date_default_timezone_get", "date_sunrise",
"date_sunset", "date_sun_info", "filter_input", "filter_var",
"filter_input_array", "filter_var_array", "filter_list", "filter_has_var",
"filter_id", "ftp_connect", "ftp_login", "ftp_pwd", "ftp_cdup", "ftp_chdir",
"ftp_exec", "ftp_raw", "ftp_mkdir", "ftp_rmdir", "ftp_chmod", "ftp_alloc",
"ftp_nlist", "ftp_rawlist", "ftp_systype", "ftp_pasv", "ftp_get", "ftp_fget",
"ftp_put", "ftp_fput", "ftp_size", "ftp_mdtm", "ftp_rename", "ftp_delete",
"ftp_site", "ftp_close", "ftp_set_option", "ftp_get_option", "ftp_nb_fget",
"ftp_nb_get", "ftp_nb_continue", "ftp_nb_put", "ftp_nb_fput", "ftp_quit",
"hash", "hash_file", "hash_hmac", "hash_hmac_file", "hash_init", "hash_update",
"hash_update_stream", "hash_update_file", "hash_final", "hash_algos", "iconv",
"ob_iconv_handler", "iconv_get_encoding", "iconv_set_encoding", "iconv_strlen",
"iconv_substr", "iconv_strpos", "iconv_strrpos", "iconv_mime_encode",
"iconv_mime_decode", "iconv_mime_decode_headers", "json_encode", "json_decode",
"odbc_autocommit", "odbc_binmode", "odbc_close", "odbc_close_all",
"odbc_columns", "odbc_commit", "odbc_connect", "odbc_cursor",
"odbc_data_source", "odbc_execute", "odbc_error", "odbc_errormsg", "odbc_exec",
"odbc_fetch_array", "odbc_fetch_object", "odbc_fetch_row", "odbc_fetch_into",
"odbc_field_len", "odbc_field_scale", "odbc_field_name", "odbc_field_type",
"odbc_field_num", "odbc_free_result", "odbc_gettypeinfo", "odbc_longreadlen",
"odbc_next_result", "odbc_num_fields", "odbc_num_rows", "odbc_pconnect",
"odbc_prepare", "odbc_result", "odbc_result_all", "odbc_rollback",
"odbc_setoption", "odbc_specialcolumns", "odbc_statistics", "odbc_tables",
"odbc_primarykeys", "odbc_columnprivileges", "odbc_tableprivileges",
"odbc_foreignkeys", "odbc_procedures", "odbc_procedurecolumns", "odbc_do",
"odbc_field_precision", "preg_match", "preg_match_all", "preg_replace",
"preg_replace_callback", "preg_split", "preg_quote", "preg_grep",
"preg_last_error", "session_name", "session_module_name", "session_save_path",
"session_id", "session_regenerate_id", "session_decode", "session_register",
"session_unregister", "session_is_registered", "session_encode",
"session_start", "session_destroy", "session_unset",
"session_set_save_handler", "session_cache_limiter", "session_cache_expire",
"session_set_cookie_params", "session_get_cookie_params",
"session_write_close", "session_commit", "spl_classes", "spl_autoload",
"spl_autoload_extensions", "spl_autoload_register", "spl_autoload_unregister",
"spl_autoload_functions", "spl_autoload_call", "class_parents",
"class_implements", "spl_object_hash", "iterator_to_array", "iterator_count",
"iterator_apply", "constant", "bin2hex", "sleep", "usleep", "flush",
"wordwrap", "htmlspecialchars", "htmlentities", "html_entity_decode",
"htmlspecialchars_decode", "get_html_translation_table", "sha1", "sha1_file",
"md5", "md5_file", "crc32", "iptcparse", "iptcembed", "getimagesize",
"image_type_to_mime_type", "image_type_to_extension", "phpinfo", "phpversion",
"phpcredits", "php_logo_guid", "php_real_logo_guid", "php_egg_logo_guid",
"zend_logo_guid", "php_sapi_name", "php_uname", "php_ini_scanned_files",
"strnatcmp", "strnatcasecmp", "substr_count", "strspn", "strcspn", "strtok",
"strtoupper", "strtolower", "strpos", "stripos", "strrpos", "strripos",
"strrev", "hebrev", "hebrevc", "nl2br", "basename", "dirname", "pathinfo",
"stripslashes", "stripcslashes", "strstr", "stristr", "strrchr", "str_shuffle",
"str_word_count", "str_split", "strpbrk", "substr_compare", "strcoll",
"substr", "substr_replace", "quotemeta", "ucfirst", "ucwords", "strtr",
"addslashes", "addcslashes", "rtrim", "str_replace", "str_ireplace",
"str_repeat", "count_chars", "chunk_split", "trim", "ltrim", "strip_tags",
"similar_text", "explode", "implode", "setlocale", "localeconv", "soundex",
"levenshtein", "chr", "ord", "parse_str", "str_pad", "chop", "strchr",
"sprintf", "printf", "vprintf", "vsprintf", "fprintf", "vfprintf", "sscanf",
"fscanf", "parse_url", "urlencode", "urldecode", "rawurlencode",
"rawurldecode", "http_build_query", "unlink", "exec", "system",
"escapeshellcmd", "escapeshellarg", "passthru", "shell_exec", "proc_open",
"proc_close", "proc_terminate", "proc_get_status", "rand", "srand",
"getrandmax", "mt_rand", "mt_srand", "mt_getrandmax", "getservbyname",
"getservbyport", "getprotobyname", "getprotobynumber", "getmyuid", "getmygid",
"getmypid", "getmyinode", "getlastmod", "base64_decode", "base64_encode",
"convert_uuencode", "convert_uudecode", "abs", "ceil", "floor", "round", "sin",
"cos", "tan", "asin", "acos", "atan", "atan2", "sinh", "cosh", "tanh", "pi",
"is_finite", "is_nan", "is_infinite", "pow", "exp", "log", "log10", "sqrt",
"hypot", "deg2rad", "rad2deg", "bindec", "hexdec", "octdec", "decbin",
"decoct", "dechex", "base_convert", "number_format", "fmod", "ip2long",
"long2ip", "getenv", "putenv", "microtime", "gettimeofday", "uniqid",
"quoted_printable_decode", "convert_cyr_string", "get_current_user",
"set_time_limit", "get_cfg_var", "magic_quotes_runtime",
"set_magic_quotes_runtime", "get_magic_quotes_gpc", "get_magic_quotes_runtime",
"import_request_variables", "error_log", "error_get_last", "call_user_func",
"call_user_func_array", "call_user_method", "call_user_method_array",
"serialize", "unserialize", "var_dump", "var_export", "debug_zval_dump",
"print_r", "memory_get_usage", "memory_get_peak_usage",
"register_shutdown_function", "register_tick_function",
"unregister_tick_function", "highlight_file", "show_source",
"highlight_string", "php_strip_whitespace", "ini_get", "ini_get_all",
"ini_set", "ini_alter", "ini_restore", "get_include_path", "set_include_path",
"restore_include_path", "setcookie", "setrawcookie", "header", "headers_sent",
"headers_list", "connection_aborted", "connection_status", "ignore_user_abort",
"parse_ini_file", "is_uploaded_file", "move_uploaded_file", "gethostbyaddr",
"gethostbyname", "gethostbynamel", "intval", "floatval", "doubleval", "strval",
"gettype", "settype", "is_null", "is_resource", "is_bool", "is_long",
"is_float", "is_int", "is_integer", "is_double", "is_real", "is_numeric",
"is_string", "is_array", "is_object", "is_scalar", "is_callable", "ereg",
"ereg_replace", "eregi", "eregi_replace", "split", "spliti", "join",
"sql_regcase", "dl", "pclose", "popen", "readfile", "rewind", "rmdir", "umask",
"fclose", "feof", "fgetc", "fgets", "fgetss", "fread", "fopen", "fpassthru",
"ftruncate", "fstat", "fseek", "ftell", "fflush", "fwrite", "fputs", "mkdir",
"rename", "copy", "tempnam", "tmpfile", "file", "file_get_contents",
"file_put_contents", "stream_select", "stream_context_create",
"stream_context_set_params", "stream_context_set_option",
"stream_context_get_options", "stream_context_get_default",
"stream_filter_prepend", "stream_filter_append", "stream_filter_remove",
"stream_socket_client", "stream_socket_server", "stream_socket_accept",
"stream_socket_get_name", "stream_socket_recvfrom", "stream_socket_sendto",
"stream_socket_enable_crypto", "stream_socket_shutdown",
"stream_copy_to_stream", "stream_get_contents", "fgetcsv", "fputcsv", "flock",
"get_meta_tags", "stream_set_write_buffer", "set_file_buffer",
"set_socket_blocking", "stream_set_blocking", "socket_set_blocking",
"stream_get_meta_data", "stream_get_line", "stream_wrapper_register",
"stream_register_wrapper", "stream_wrapper_unregister",
"stream_wrapper_restore", "stream_get_wrappers", "stream_get_transports",
"get_headers", "stream_set_timeout", "socket_set_timeout", "socket_get_status",
"realpath", "fsockopen", "pfsockopen", "pack", "unpack", "get_browser",
"crypt", "opendir", "closedir", "chdir", "getcwd", "rewinddir", "readdir",
"dir", "scandir", "glob", "fileatime", "filectime", "filegroup", "fileinode",
"filemtime", "fileowner", "fileperms", "filesize", "filetype", "file_exists",
"is_writable", "is_writeable", "is_readable", "is_executable", "is_file",
"is_dir", "is_link", "stat", "lstat", "chown", "chgrp", "chmod", "touch",
"clearstatcache", "disk_total_space", "disk_free_space", "diskfreespace",
"mail", "ezmlm_hash", "openlog", "syslog", "closelog",
"define_syslog_variables", "lcg_value", "metaphone", "ob_start", "ob_flush",
"ob_clean", "ob_end_flush", "ob_end_clean", "ob_get_flush", "ob_get_clean",
"ob_get_length", "ob_get_level", "ob_get_status", "ob_get_contents",
"ob_implicit_flush", "ob_list_handlers", "ksort", "krsort", "natsort",
"natcasesort", "asort", "arsort", "sort", "rsort", "usort", "uasort", "uksort",
"shuffle", "array_walk", "array_walk_recursive", "count", "end", "prev",
"next", "reset", "current", "key", "min", "max", "in_array", "array_search",
"extract", "compact", "array_fill", "array_fill_keys", "range",
"array_multisort", "array_push", "array_pop", "array_shift", "array_unshift",
"array_splice", "array_slice", "array_merge", "array_merge_recursive",
"array_keys", "array_values", "array_count_values", "array_reverse",
"array_reduce", "array_pad", "array_flip", "array_change_key_case",
"array_rand", "array_unique", "array_intersect", "array_intersect_key",
"array_intersect_ukey", "array_uintersect", "array_intersect_assoc",
"array_uintersect_assoc", "array_intersect_uassoc", "array_uintersect_uassoc",
"array_diff", "array_diff_key", "array_diff_ukey", "array_udiff",
"array_diff_assoc", "array_udiff_assoc", "array_diff_uassoc",
"array_udiff_uassoc", "array_sum", "array_product", "array_filter",
"array_map", "array_chunk", "array_combine", "array_key_exists", "pos",
"sizeof", "key_exists", "assert", "assert_options", "version_compare",
"str_rot13", "stream_get_filters", "stream_filter_register",
"stream_bucket_make_writeable", "stream_bucket_prepend",
"stream_bucket_append", "stream_bucket_new", "output_add_rewrite_var",
"output_reset_rewrite_vars", "sys_get_temp_dir", "token_get_all", "token_name",
"readgzfile", "gzrewind", "gzclose", "gzeof", "gzgetc", "gzgets", "gzgetss",
"gzread", "gzopen", "gzpassthru", "gzseek", "gztell", "gzwrite", "gzputs",
"gzfile", "gzcompress", "gzuncompress", "gzdeflate", "gzinflate", "gzencode",
"ob_gzhandler", "zlib_get_coding_type", "libxml_set_streams_context",
"libxml_use_internal_errors", "libxml_get_last_error", "libxml_clear_errors",
"libxml_get_errors", "dom_import_simplexml", "simplexml_load_file",
"simplexml_load_string", "simplexml_import_dom", "wddx_serialize_value",
"wddx_serialize_vars", "wddx_packet_start", "wddx_packet_end", "wddx_add_vars",
"wddx_deserialize", "xml_parser_create", "xml_parser_create_ns",
"xml_set_object", "xml_set_element_handler", "xml_set_character_data_handler",
"xml_set_processing_instruction_handler", "xml_set_default_handler",
"xml_set_unparsed_entity_decl_handler", "xml_set_notation_decl_handler",
"xml_set_external_entity_ref_handler", "xml_set_start_namespace_decl_handler",
"xml_set_end_namespace_decl_handler", "xml_parse", "xml_parse_into_struct",
"xml_get_error_code", "xml_error_string", "xml_get_current_line_number",
"xml_get_current_column_number", "xml_get_current_byte_index",
"xml_parser_free", "xml_parser_set_option", "xml_parser_get_option",
"utf8_encode", "utf8_decode", "xmlwriter_open_uri", "xmlwriter_open_memory",
"xmlwriter_set_indent", "xmlwriter_set_indent_string",
"xmlwriter_start_comment", "xmlwriter_end_comment",
"xmlwriter_start_attribute", "xmlwriter_end_attribute",
"xmlwriter_write_attribute", "xmlwriter_start_attribute_ns",
"xmlwriter_write_attribute_ns", "xmlwriter_start_element",
"xmlwriter_end_element", "xmlwriter_full_end_element",
"xmlwriter_start_element_ns", "xmlwriter_write_element",
"xmlwriter_write_element_ns", "xmlwriter_start_pi", "xmlwriter_end_pi",
"xmlwriter_write_pi", "xmlwriter_start_cdata", "xmlwriter_end_cdata",
"xmlwriter_write_cdata", "xmlwriter_text", "xmlwriter_write_raw",
"xmlwriter_start_document", "xmlwriter_end_document",
"xmlwriter_write_comment", "xmlwriter_start_dtd", "xmlwriter_end_dtd",
"xmlwriter_write_dtd", "xmlwriter_start_dtd_element",
"xmlwriter_end_dtd_element", "xmlwriter_write_dtd_element",
"xmlwriter_start_dtd_attlist", "xmlwriter_end_dtd_attlist",
"xmlwriter_write_dtd_attlist", "xmlwriter_start_dtd_entity",
"xmlwriter_end_dtd_entity", "xmlwriter_write_dtd_entity",
"xmlwriter_output_memory", "xmlwriter_flush", "gd_info", "imagearc",
"imageellipse", "imagechar", "imagecharup", "imagecolorat",
"imagecolorallocate", "imagepalettecopy", "imagecreatefromstring",
"imagecolorclosest", "imagecolordeallocate", "imagecolorresolve",
"imagecolorexact", "imagecolorset", "imagecolortransparent",
"imagecolorstotal", "imagecolorsforindex", "imagecopy", "imagecopymerge",
"imagecopymergegray", "imagecopyresized", "imagecreate",
"imagecreatetruecolor", "imageistruecolor", "imagetruecolortopalette",
"imagesetthickness", "imagefilledarc", "imagefilledellipse",
"imagealphablending", "imagesavealpha", "imagecolorallocatealpha",
"imagecolorresolvealpha", "imagecolorclosestalpha", "imagecolorexactalpha",
"imagecopyresampled", "imagegrabwindow", "imagegrabscreen", "imagerotate",
"imageantialias", "imagesettile", "imagesetbrush", "imagesetstyle",
"imagecreatefrompng", "imagecreatefromgif", "imagecreatefromjpeg",
"imagecreatefromwbmp", "imagecreatefromxbm", "imagecreatefromgd",
"imagecreatefromgd2", "imagecreatefromgd2part", "imagepng", "imagegif",
"imagejpeg", "imagewbmp", "imagegd", "imagegd2", "imagedestroy",
"imagegammacorrect", "imagefill", "imagefilledpolygon", "imagefilledrectangle",
"imagefilltoborder", "imagefontwidth", "imagefontheight", "imageinterlace",
"imageline", "imageloadfont", "imagepolygon", "imagerectangle",
"imagesetpixel", "imagestring", "imagestringup", "imagesx", "imagesy",
"imagedashedline", "imagettfbbox", "imagettftext", "imageftbbox",
"imagefttext", "imagepsloadfont", "imagepsfreefont", "imagepsencodefont",
"imagepsextendfont", "imagepsslantfont", "imagepstext", "imagepsbbox",
"imagetypes", "jpeg2wbmp", "png2wbmp", "image2wbmp", "imagelayereffect",
"imagecolormatch", "imagexbm", "imagefilter", "imageconvolution",
"mb_convert_case", "mb_strtoupper", "mb_strtolower", "mb_language",
"mb_internal_encoding", "mb_http_input", "mb_http_output", "mb_detect_order",
"mb_substitute_character", "mb_parse_str", "mb_output_handler",
"mb_preferred_mime_name", "mb_strlen", "mb_strpos", "mb_strrpos", "mb_stripos",
"mb_strripos", "mb_strstr", "mb_strrchr", "mb_stristr", "mb_strrichr",
"mb_substr_count", "mb_substr", "mb_strcut", "mb_strwidth", "mb_strimwidth",
"mb_convert_encoding", "mb_detect_encoding", "mb_list_encodings",
"mb_convert_kana", "mb_encode_mimeheader", "mb_decode_mimeheader",
"mb_convert_variables", "mb_encode_numericentity", "mb_decode_numericentity",
"mb_send_mail", "mb_get_info", "mb_check_encoding", "mb_regex_encoding",
"mb_regex_set_options", "mb_ereg", "mb_eregi", "mb_ereg_replace",
"mb_eregi_replace", "mb_split", "mb_ereg_match", "mb_ereg_search",
"mb_ereg_search_pos", "mb_ereg_search_regs", "mb_ereg_search_init",
"mb_ereg_search_getregs", "mb_ereg_search_getpos", "mb_ereg_search_setpos",
"mbregex_encoding", "mbereg", "mberegi", "mbereg_replace", "mberegi_replace",
"mbsplit", "mbereg_match", "mbereg_search", "mbereg_search_pos",
"mbereg_search_regs", "mbereg_search_init", "mbereg_search_getregs",
"mbereg_search_getpos", "mbereg_search_setpos", "mysql_connect",
"mysql_pconnect", "mysql_close", "mysql_select_db", "mysql_query",
"mysql_unbuffered_query", "mysql_db_query", "mysql_list_dbs",
"mysql_list_tables", "mysql_list_fields", "mysql_list_processes",
"mysql_error", "mysql_errno", "mysql_affected_rows", "mysql_insert_id",
"mysql_result", "mysql_num_rows", "mysql_num_fields", "mysql_fetch_row",
"mysql_fetch_array", "mysql_fetch_assoc", "mysql_fetch_object",
"mysql_data_seek", "mysql_fetch_lengths", "mysql_fetch_field",
"mysql_field_seek", "mysql_free_result", "mysql_field_name",
"mysql_field_table", "mysql_field_len", "mysql_field_type",
"mysql_field_flags", "mysql_escape_string", "mysql_real_escape_string",
"mysql_stat", "mysql_thread_id", "mysql_client_encoding", "mysql_ping",
"mysql_get_client_info", "mysql_get_host_info", "mysql_get_proto_info",
"mysql_get_server_info", "mysql_info", "mysql_set_charset", "mysql",
"mysql_fieldname", "mysql_fieldtable", "mysql_fieldlen", "mysql_fieldtype",
"mysql_fieldflags", "mysql_selectdb", "mysql_freeresult", "mysql_numfields",
"mysql_numrows", "mysql_listdbs", "mysql_listtables", "mysql_listfields",
"mysql_db_name", "mysql_dbname", "mysql_tablename", "mysql_table_name",
"mysqli_affected_rows", "mysqli_autocommit", "mysqli_change_user",
"mysqli_character_set_name", "mysqli_close", "mysqli_commit", "mysqli_connect",
"mysqli_connect_errno", "mysqli_connect_error", "mysqli_data_seek",
"mysqli_debug", "mysqli_disable_reads_from_master", "mysqli_disable_rpl_parse",
"mysqli_dump_debug_info", "mysqli_enable_reads_from_master",
"mysqli_enable_rpl_parse", "mysqli_embedded_server_end",
"mysqli_embedded_server_start", "mysqli_errno", "mysqli_error",
"mysqli_stmt_execute", "mysqli_execute", "mysqli_fetch_field",
"mysqli_fetch_fields", "mysqli_fetch_field_direct", "mysqli_fetch_lengths",
"mysqli_fetch_array", "mysqli_fetch_assoc", "mysqli_fetch_object",
"mysqli_fetch_row", "mysqli_field_count", "mysqli_field_seek",
"mysqli_field_tell", "mysqli_free_result", "mysqli_get_charset",
"mysqli_get_client_info", "mysqli_get_client_version", "mysqli_get_host_info",
"mysqli_get_proto_info", "mysqli_get_server_info", "mysqli_get_server_version",
"mysqli_get_warnings", "mysqli_init", "mysqli_info", "mysqli_insert_id",
"mysqli_kill", "mysqli_set_local_infile_default",
"mysqli_set_local_infile_handler", "mysqli_master_query",
"mysqli_more_results", "mysqli_multi_query", "mysqli_next_result",
"mysqli_num_fields", "mysqli_num_rows", "mysqli_options", "mysqli_ping",
"mysqli_prepare", "mysqli_report", "mysqli_query", "mysqli_real_connect",
"mysqli_real_escape_string", "mysqli_real_query", "mysqli_rollback",
"mysqli_rpl_parse_enabled", "mysqli_rpl_probe", "mysqli_rpl_query_type",
"mysqli_select_db", "mysqli_set_charset", "mysqli_stmt_attr_get",
"mysqli_stmt_attr_set", "mysqli_stmt_field_count", "mysqli_stmt_init",
"mysqli_stmt_prepare", "mysqli_stmt_result_metadata",
"mysqli_stmt_send_long_data", "mysqli_stmt_bind_param",
"mysqli_stmt_bind_result", "mysqli_stmt_fetch", "mysqli_stmt_free_result",
"mysqli_stmt_get_warnings", "mysqli_stmt_insert_id", "mysqli_stmt_reset",
"mysqli_stmt_param_count", "mysqli_send_query", "mysqli_slave_query",
"mysqli_sqlstate", "mysqli_ssl_set", "mysqli_stat",
"mysqli_stmt_affected_rows", "mysqli_stmt_close", "mysqli_stmt_data_seek",
"mysqli_stmt_errno", "mysqli_stmt_error", "mysqli_stmt_num_rows",
"mysqli_stmt_sqlstate", "mysqli_store_result", "mysqli_stmt_store_result",
"mysqli_thread_id", "mysqli_thread_safe", "mysqli_use_result",
"mysqli_warning_count", "mysqli_bind_param", "mysqli_bind_result",
"mysqli_client_encoding", "mysqli_escape_string", "mysqli_fetch",
"mysqli_param_count", "mysqli_get_metadata", "mysqli_send_long_data",
"mysqli_set_opt", "pdo_drivers", "socket_select", "socket_create",
"socket_create_listen", "socket_accept", "socket_set_nonblock",
"socket_set_block", "socket_listen", "socket_close", "socket_write",
"socket_read", "socket_getsockname", "socket_getpeername", "socket_connect",
"socket_strerror", "socket_bind", "socket_recv", "socket_send",
"socket_recvfrom", "socket_sendto", "socket_get_option", "socket_set_option",
"socket_shutdown", "socket_last_error", "socket_clear_error", "socket_getopt",
"socket_setopt", "eaccelerator_put", "eaccelerator_get", "eaccelerator_rm",
"eaccelerator_gc", "eaccelerator_lock", "eaccelerator_unlock",
"eaccelerator_caching", "eaccelerator_optimizer", "eaccelerator_clear",
"eaccelerator_clean", "eaccelerator_info", "eaccelerator_purge",
"eaccelerator_cached_scripts", "eaccelerator_removed_scripts",
"eaccelerator_list_keys", "eaccelerator_encode", "eaccelerator_load",
"_eaccelerator_loader_file", "_eaccelerator_loader_line",
"eaccelerator_set_session_handlers", "_eaccelerator_output_handler",
"eaccelerator_cache_page", "eaccelerator_rm_page", "eaccelerator_cache_output",
"eaccelerator_cache_result", "xdebug_get_stack_depth",
"xdebug_get_function_stack", "xdebug_print_function_stack",
"xdebug_get_declared_vars", "xdebug_call_class", "xdebug_call_function",
"xdebug_call_file", "xdebug_call_line", "xdebug_var_dump", "xdebug_debug_zval",
"xdebug_debug_zval_stdout", "xdebug_enable", "xdebug_disable",
"xdebug_is_enabled", "xdebug_break", "xdebug_start_trace", "xdebug_stop_trace",
"xdebug_get_tracefile_name", "xdebug_get_profiler_filename",
"xdebug_dump_aggr_profiling_data", "xdebug_clear_aggr_profiling_data",
"xdebug_memory_usage", "xdebug_peak_memory_usage", "xdebug_time_index",
"xdebug_start_error_collection", "xdebug_stop_error_collection",
"xdebug_get_collected_errors", "xdebug_start_code_coverage",
"xdebug_stop_code_coverage", "xdebug_get_code_coverage",
"xdebug_get_function_count", "xdebug_dump_superglobals",
"_", /* alias for gettext()*/
"get_called_class","class_alias","gc_collect_cycles","gc_enabled","gc_enable",
"gc_disable","date_create_from_format","date_parse_from_format",
"date_get_last_errors","date_add","date_sub","date_diff","date_timestamp_set",
"date_timestamp_get","timezone_location_get","timezone_version_get",
"date_interval_create_from_date_string","date_interval_format",
"libxml_disable_entity_loader","openssl_pkey_free","openssl_pkey_new",
"openssl_pkey_export","openssl_pkey_export_to_file","openssl_pkey_get_private",
"openssl_pkey_get_public","openssl_pkey_get_details","openssl_free_key",
"openssl_get_privatekey","openssl_get_publickey","openssl_x509_read",
"openssl_x509_free","openssl_x509_parse","openssl_x509_checkpurpose",
"openssl_x509_check_private_key","openssl_x509_export","openssl_x509_export_to_file",
"openssl_pkcs12_export","openssl_pkcs12_export_to_file","openssl_pkcs12_read",
"openssl_csr_new","openssl_csr_export","openssl_csr_export_to_file",
"openssl_csr_sign","openssl_csr_get_subject","openssl_csr_get_public_key",
"openssl_digest","openssl_encrypt","openssl_decrypt","openssl_cipher_iv_length",
"openssl_sign","openssl_verify","openssl_seal","openssl_open","openssl_pkcs7_verify",
"openssl_pkcs7_decrypt","openssl_pkcs7_sign","openssl_pkcs7_encrypt",
"openssl_private_encrypt","openssl_private_decrypt","openssl_public_encrypt",
"openssl_public_decrypt","openssl_get_md_methods","openssl_get_cipher_methods",
"openssl_dh_compute_key","openssl_random_pseudo_bytes","openssl_error_string",
"preg_filter","bzopen","bzread","bzwrite","bzflush","bzclose","bzerrno",
"bzerrstr","bzerror","bzcompress","bzdecompress","curl_init","curl_copy_handle",
"curl_version","curl_setopt","curl_setopt_array","curl_exec","curl_getinfo",
"curl_error","curl_errno","curl_close","curl_multi_init","curl_multi_add_handle",
"curl_multi_remove_handle","curl_multi_select","curl_multi_exec","curl_multi_getcontent",
"curl_multi_info_read","curl_multi_close","exif_read_data","read_exif_data",
"exif_tagname","exif_thumbnail","exif_imagetype","ftp_ssl_connect",
"imagecolorclosesthwb","imagecreatefromxpm","textdomain","gettext","dgettext",
"dcgettext","bindtextdomain","ngettext","dngettext","dcngettext",
"bind_textdomain_codeset","hash_copy","imap_open","imap_reopen","imap_close",
"imap_num_msg","imap_num_recent","imap_headers","imap_headerinfo",
"imap_rfc822_parse_headers","imap_rfc822_write_address","imap_rfc822_parse_adrlist",
"imap_body","imap_bodystruct","imap_fetchbody","imap_savebody","imap_fetchheader",
"imap_fetchstructure","imap_gc","imap_expunge","imap_delete","imap_undelete",
"imap_check","imap_listscan","imap_mail_copy","imap_mail_move","imap_mail_compose",
"imap_createmailbox","imap_renamemailbox","imap_deletemailbox","imap_subscribe",
"imap_unsubscribe","imap_append","imap_ping","imap_base64","imap_qprint","imap_8bit",
"imap_binary","imap_utf8","imap_status","imap_mailboxmsginfo","imap_setflag_full",
"imap_clearflag_full","imap_sort","imap_uid","imap_msgno","imap_list","imap_lsub",
"imap_fetch_overview","imap_alerts","imap_errors","imap_last_error","imap_search",
"imap_utf7_decode","imap_utf7_encode","imap_mime_header_decode","imap_thread",
"imap_timeout","imap_get_quota","imap_get_quotaroot","imap_set_quota","imap_setacl",
"imap_getacl","imap_mail","imap_header","imap_listmailbox","imap_getmailboxes",
"imap_scanmailbox","imap_listsubscribed","imap_getsubscribed","imap_fetchtext",
"imap_scan","imap_create","imap_rename","json_last_error","mb_encoding_aliases",
"mcrypt_ecb","mcrypt_cbc","mcrypt_cfb","mcrypt_ofb","mcrypt_get_key_size",
"mcrypt_get_block_size","mcrypt_get_cipher_name","mcrypt_create_iv","mcrypt_list_algorithms",
"mcrypt_list_modes","mcrypt_get_iv_size","mcrypt_encrypt","mcrypt_decrypt",
"mcrypt_module_open","mcrypt_generic_init","mcrypt_generic","mdecrypt_generic",
"mcrypt_generic_end","mcrypt_generic_deinit","mcrypt_enc_self_test",
"mcrypt_enc_is_block_algorithm_mode","mcrypt_enc_is_block_algorithm",
"mcrypt_enc_is_block_mode","mcrypt_enc_get_block_size","mcrypt_enc_get_key_size",
"mcrypt_enc_get_supported_key_sizes","mcrypt_enc_get_iv_size",
"mcrypt_enc_get_algorithms_name","mcrypt_enc_get_modes_name","mcrypt_module_self_test",
"mcrypt_module_is_block_algorithm_mode","mcrypt_module_is_block_algorithm",
"mcrypt_module_is_block_mode","mcrypt_module_get_algo_block_size",
"mcrypt_module_get_algo_key_size","mcrypt_module_get_supported_key_sizes",
"mcrypt_module_close","mysqli_refresh","posix_kill","posix_getpid","posix_getppid",
"posix_getuid","posix_setuid","posix_geteuid","posix_seteuid","posix_getgid",
"posix_setgid","posix_getegid","posix_setegid","posix_getgroups","posix_getlogin",
"posix_getpgrp","posix_setsid","posix_setpgid","posix_getpgid","posix_getsid",
"posix_uname","posix_times","posix_ctermid","posix_ttyname","posix_isatty",
"posix_getcwd","posix_mkfifo","posix_mknod","posix_access","posix_getgrnam",
"posix_getgrgid","posix_getpwnam","posix_getpwuid","posix_getrlimit",
"posix_get_last_error","posix_errno","posix_strerror","posix_initgroups",
"pspell_new","pspell_new_personal","pspell_new_config","pspell_check",
"pspell_suggest","pspell_store_replacement","pspell_add_to_personal",
"pspell_add_to_session","pspell_clear_session","pspell_save_wordlist",
"pspell_config_create","pspell_config_runtogether","pspell_config_mode",
"pspell_config_ignore","pspell_config_personal","pspell_config_dict_dir",
"pspell_config_data_dir","pspell_config_repl","pspell_config_save_repl",
"snmpget","snmpgetnext","snmpwalk","snmprealwalk","snmpwalkoid",
"snmp_get_quick_print","snmp_set_quick_print","snmp_set_enum_print",
"snmp_set_oid_output_format","snmp_set_oid_numeric_print","snmpset",
"snmp2_get","snmp2_getnext","snmp2_walk","snmp2_real_walk","snmp2_set",
"snmp3_get","snmp3_getnext","snmp3_walk","snmp3_real_walk","snmp3_set",
"snmp_set_valueretrieval","snmp_get_valueretrieval","snmp_read_mib",
"use_soap_error_handler","is_soap_fault","socket_create_pair","time_nanosleep",
"time_sleep_until","strptime","php_ini_loaded_file","money_format","lcfirst",
"nl_langinfo","str_getcsv","readlink","linkinfo","symlink","link","proc_nice",
"atanh","asinh","acosh","expm1","log1p","inet_ntop","inet_pton","getopt",
"sys_getloadavg","getrusage","quoted_printable_encode","forward_static_call",
"forward_static_call_array","header_remove","parse_ini_string","gethostname",
"dns_check_record","checkdnsrr","dns_get_mx","getmxrr","dns_get_record",
"stream_context_get_params","stream_context_set_default","stream_socket_pair",
"stream_supports_lock","stream_set_read_buffer","stream_resolve_include_path",
"stream_is_local","fnmatch","chroot","lchown","lchgrp","realpath_cache_size",
"realpath_cache_get","array_replace","array_replace_recursive","ftok","xmlrpc_encode",
"xmlrpc_decode","xmlrpc_decode_request","xmlrpc_encode_request","xmlrpc_get_type",
"xmlrpc_set_type","xmlrpc_is_fault","xmlrpc_server_create","xmlrpc_server_destroy",
"xmlrpc_server_register_method","xmlrpc_server_call_method",
"xmlrpc_parse_method_descriptions","xmlrpc_server_add_introspection_data",
"xmlrpc_server_register_introspection_callback","zip_open","zip_close",
"zip_read","zip_entry_open","zip_entry_close","zip_entry_read","zip_entry_filesize",
"zip_entry_name","zip_entry_compressedsize","zip_entry_compressionmethod",
"svn_checkout","svn_cat","svn_ls","svn_log","svn_auth_set_parameter",
"svn_auth_get_parameter","svn_client_version","svn_config_ensure","svn_diff",
"svn_cleanup","svn_revert","svn_resolved","svn_commit","svn_lock","svn_unlock",
"svn_add","svn_status","svn_update","svn_import","svn_info","svn_export",
"svn_copy","svn_switch","svn_blame","svn_delete","svn_mkdir","svn_move",
"svn_proplist","svn_propget","svn_repos_create","svn_repos_recover",
"svn_repos_hotcopy","svn_repos_open","svn_repos_fs",
"svn_repos_fs_begin_txn_for_commit","svn_repos_fs_commit_txn",
"svn_fs_revision_root","svn_fs_check_path","svn_fs_revision_prop",
"svn_fs_dir_entries","svn_fs_node_created_rev","svn_fs_youngest_rev",
"svn_fs_file_contents","svn_fs_file_length","svn_fs_txn_root","svn_fs_make_file",
"svn_fs_make_dir","svn_fs_apply_text","svn_fs_copy","svn_fs_delete",
"svn_fs_begin_txn2","svn_fs_is_dir","svn_fs_is_file","svn_fs_node_prop",
"svn_fs_change_node_prop","svn_fs_contents_changed","svn_fs_props_changed",
"svn_fs_abort_txn","sqlite_open","sqlite_popen","sqlite_close","sqlite_query",
"sqlite_exec","sqlite_array_query","sqlite_single_query","sqlite_fetch_array",
"sqlite_fetch_object","sqlite_fetch_single","sqlite_fetch_string",
"sqlite_fetch_all","sqlite_current","sqlite_column","sqlite_libversion",
"sqlite_libencoding","sqlite_changes","sqlite_last_insert_rowid",
"sqlite_num_rows","sqlite_num_fields","sqlite_field_name","sqlite_seek",
"sqlite_rewind","sqlite_next","sqlite_prev","sqlite_valid","sqlite_has_more",
"sqlite_has_prev","sqlite_escape_string","sqlite_busy_timeout","sqlite_last_error",
"sqlite_error_string","sqlite_unbuffered_query","sqlite_create_aggregate",
"sqlite_create_function","sqlite_factory","sqlite_udf_encode_binary",
"sqlite_udf_decode_binary","sqlite_fetch_column_types"
].forEach(function(element, index, array) {
result[element] = token("t_string", "php-predefined-function");
});
// output of get_defined_constants(). Differs significantly from http://php.net/manual/en/reserved.constants.php
[ "E_ERROR", "E_RECOVERABLE_ERROR", "E_WARNING", "E_PARSE", "E_NOTICE",
"E_STRICT", "E_CORE_ERROR", "E_CORE_WARNING", "E_COMPILE_ERROR",
"E_COMPILE_WARNING", "E_USER_ERROR", "E_USER_WARNING", "E_USER_NOTICE",
"E_ALL", "TRUE", "FALSE", "NULL", "ZEND_THREAD_SAFE", "PHP_VERSION", "PHP_OS",
"PHP_SAPI", "DEFAULT_INCLUDE_PATH", "PEAR_INSTALL_DIR", "PEAR_EXTENSION_DIR",
"PHP_EXTENSION_DIR", "PHP_PREFIX", "PHP_BINDIR", "PHP_LIBDIR", "PHP_DATADIR",
"PHP_SYSCONFDIR", "PHP_LOCALSTATEDIR", "PHP_CONFIG_FILE_PATH",
"PHP_CONFIG_FILE_SCAN_DIR", "PHP_SHLIB_SUFFIX", "PHP_EOL", "PHP_EOL",
"PHP_INT_MAX", "PHP_INT_SIZE", "PHP_OUTPUT_HANDLER_START",
"PHP_OUTPUT_HANDLER_CONT", "PHP_OUTPUT_HANDLER_END", "UPLOAD_ERR_OK",
"UPLOAD_ERR_INI_SIZE", "UPLOAD_ERR_FORM_SIZE", "UPLOAD_ERR_PARTIAL",
"UPLOAD_ERR_NO_FILE", "UPLOAD_ERR_NO_TMP_DIR", "UPLOAD_ERR_CANT_WRITE",
"UPLOAD_ERR_EXTENSION", "CAL_GREGORIAN", "CAL_JULIAN", "CAL_JEWISH",
"CAL_FRENCH", "CAL_NUM_CALS", "CAL_DOW_DAYNO", "CAL_DOW_SHORT", "CAL_DOW_LONG",
"CAL_MONTH_GREGORIAN_SHORT", "CAL_MONTH_GREGORIAN_LONG",
"CAL_MONTH_JULIAN_SHORT", "CAL_MONTH_JULIAN_LONG", "CAL_MONTH_JEWISH",
"CAL_MONTH_FRENCH", "CAL_EASTER_DEFAULT", "CAL_EASTER_ROMAN",
"CAL_EASTER_ALWAYS_GREGORIAN", "CAL_EASTER_ALWAYS_JULIAN",
"CAL_JEWISH_ADD_ALAFIM_GERESH", "CAL_JEWISH_ADD_ALAFIM",
"CAL_JEWISH_ADD_GERESHAYIM", "CLSCTX_INPROC_SERVER", "CLSCTX_INPROC_HANDLER",
"CLSCTX_LOCAL_SERVER", "CLSCTX_REMOTE_SERVER", "CLSCTX_SERVER", "CLSCTX_ALL",
"VT_NULL", "VT_EMPTY", "VT_UI1", "VT_I1", "VT_UI2", "VT_I2", "VT_UI4", "VT_I4",
"VT_R4", "VT_R8", "VT_BOOL", "VT_ERROR", "VT_CY", "VT_DATE", "VT_BSTR",
"VT_DECIMAL", "VT_UNKNOWN", "VT_DISPATCH", "VT_VARIANT", "VT_INT", "VT_UINT",
"VT_ARRAY", "VT_BYREF", "CP_ACP", "CP_MACCP", "CP_OEMCP", "CP_UTF7", "CP_UTF8",
"CP_SYMBOL", "CP_THREAD_ACP", "VARCMP_LT", "VARCMP_EQ", "VARCMP_GT",
"VARCMP_NULL", "NORM_IGNORECASE", "NORM_IGNORENONSPACE", "NORM_IGNORESYMBOLS",
"NORM_IGNOREWIDTH", "NORM_IGNOREKANATYPE", "DISP_E_DIVBYZERO",
"DISP_E_OVERFLOW", "DISP_E_BADINDEX", "MK_E_UNAVAILABLE", "INPUT_POST",
"INPUT_GET", "INPUT_COOKIE", "INPUT_ENV", "INPUT_SERVER", "INPUT_SESSION",
"INPUT_REQUEST", "FILTER_FLAG_NONE", "FILTER_REQUIRE_SCALAR",
"FILTER_REQUIRE_ARRAY", "FILTER_FORCE_ARRAY", "FILTER_NULL_ON_FAILURE",
"FILTER_VALIDATE_INT", "FILTER_VALIDATE_BOOLEAN", "FILTER_VALIDATE_FLOAT",
"FILTER_VALIDATE_REGEXP", "FILTER_VALIDATE_URL", "FILTER_VALIDATE_EMAIL",
"FILTER_VALIDATE_IP", "FILTER_DEFAULT", "FILTER_UNSAFE_RAW",
"FILTER_SANITIZE_STRING", "FILTER_SANITIZE_STRIPPED",
"FILTER_SANITIZE_ENCODED", "FILTER_SANITIZE_SPECIAL_CHARS",
"FILTER_SANITIZE_EMAIL", "FILTER_SANITIZE_URL", "FILTER_SANITIZE_NUMBER_INT",
"FILTER_SANITIZE_NUMBER_FLOAT", "FILTER_SANITIZE_MAGIC_QUOTES",
"FILTER_CALLBACK", "FILTER_FLAG_ALLOW_OCTAL", "FILTER_FLAG_ALLOW_HEX",
"FILTER_FLAG_STRIP_LOW", "FILTER_FLAG_STRIP_HIGH", "FILTER_FLAG_ENCODE_LOW",
"FILTER_FLAG_ENCODE_HIGH", "FILTER_FLAG_ENCODE_AMP",
"FILTER_FLAG_NO_ENCODE_QUOTES", "FILTER_FLAG_EMPTY_STRING_NULL",
"FILTER_FLAG_ALLOW_FRACTION", "FILTER_FLAG_ALLOW_THOUSAND",
"FILTER_FLAG_ALLOW_SCIENTIFIC", "FILTER_FLAG_SCHEME_REQUIRED",
"FILTER_FLAG_HOST_REQUIRED", "FILTER_FLAG_PATH_REQUIRED",
"FILTER_FLAG_QUERY_REQUIRED", "FILTER_FLAG_IPV4", "FILTER_FLAG_IPV6",
"FILTER_FLAG_NO_RES_RANGE", "FILTER_FLAG_NO_PRIV_RANGE", "FTP_ASCII",
"FTP_TEXT", "FTP_BINARY", "FTP_IMAGE", "FTP_AUTORESUME", "FTP_TIMEOUT_SEC",
"FTP_AUTOSEEK", "FTP_FAILED", "FTP_FINISHED", "FTP_MOREDATA", "HASH_HMAC",
"ICONV_IMPL", "ICONV_VERSION", "ICONV_MIME_DECODE_STRICT",
"ICONV_MIME_DECODE_CONTINUE_ON_ERROR", "ODBC_TYPE", "ODBC_BINMODE_PASSTHRU",
"ODBC_BINMODE_RETURN", "ODBC_BINMODE_CONVERT", "SQL_ODBC_CURSORS",
"SQL_CUR_USE_DRIVER", "SQL_CUR_USE_IF_NEEDED", "SQL_CUR_USE_ODBC",
"SQL_CONCURRENCY", "SQL_CONCUR_READ_ONLY", "SQL_CONCUR_LOCK",
"SQL_CONCUR_ROWVER", "SQL_CONCUR_VALUES", "SQL_CURSOR_TYPE",
"SQL_CURSOR_FORWARD_ONLY", "SQL_CURSOR_KEYSET_DRIVEN", "SQL_CURSOR_DYNAMIC",
"SQL_CURSOR_STATIC", "SQL_KEYSET_SIZE", "SQL_FETCH_FIRST", "SQL_FETCH_NEXT",
"SQL_CHAR", "SQL_VARCHAR", "SQL_LONGVARCHAR", "SQL_DECIMAL", "SQL_NUMERIC",
"SQL_BIT", "SQL_TINYINT", "SQL_SMALLINT", "SQL_INTEGER", "SQL_BIGINT",
"SQL_REAL", "SQL_FLOAT", "SQL_DOUBLE", "SQL_BINARY", "SQL_VARBINARY",
"SQL_LONGVARBINARY", "SQL_DATE", "SQL_TIME", "SQL_TIMESTAMP",
"PREG_PATTERN_ORDER", "PREG_SET_ORDER", "PREG_OFFSET_CAPTURE",
"PREG_SPLIT_NO_EMPTY", "PREG_SPLIT_DELIM_CAPTURE", "PREG_SPLIT_OFFSET_CAPTURE",
"PREG_GREP_INVERT", "PREG_NO_ERROR", "PREG_INTERNAL_ERROR",
"PREG_BACKTRACK_LIMIT_ERROR", "PREG_RECURSION_LIMIT_ERROR",
"PREG_BAD_UTF8_ERROR", "DATE_ATOM", "DATE_COOKIE", "DATE_ISO8601",
"DATE_RFC822", "DATE_RFC850", "DATE_RFC1036", "DATE_RFC1123", "DATE_RFC2822",
"DATE_RFC3339", "DATE_RSS", "DATE_W3C", "SUNFUNCS_RET_TIMESTAMP",
"SUNFUNCS_RET_STRING", "SUNFUNCS_RET_DOUBLE", "LIBXML_VERSION",
"LIBXML_DOTTED_VERSION", "LIBXML_NOENT", "LIBXML_DTDLOAD", "LIBXML_DTDATTR",
"LIBXML_DTDVALID", "LIBXML_NOERROR", "LIBXML_NOWARNING", "LIBXML_NOBLANKS",
"LIBXML_XINCLUDE", "LIBXML_NSCLEAN", "LIBXML_NOCDATA", "LIBXML_NONET",
"LIBXML_COMPACT", "LIBXML_NOXMLDECL", "LIBXML_NOEMPTYTAG", "LIBXML_ERR_NONE",
"LIBXML_ERR_WARNING", "LIBXML_ERR_ERROR", "LIBXML_ERR_FATAL",
"CONNECTION_ABORTED", "CONNECTION_NORMAL", "CONNECTION_TIMEOUT", "INI_USER",
"INI_PERDIR", "INI_SYSTEM", "INI_ALL", "PHP_URL_SCHEME", "PHP_URL_HOST",
"PHP_URL_PORT", "PHP_URL_USER", "PHP_URL_PASS", "PHP_URL_PATH",
"PHP_URL_QUERY", "PHP_URL_FRAGMENT", "M_E", "M_LOG2E", "M_LOG10E", "M_LN2",
"M_LN10", "M_PI", "M_PI_2", "M_PI_4", "M_1_PI", "M_2_PI", "M_SQRTPI",
"M_2_SQRTPI", "M_LNPI", "M_EULER", "M_SQRT2", "M_SQRT1_2", "M_SQRT3", "INF",
"NAN", "INFO_GENERAL", "INFO_CREDITS", "INFO_CONFIGURATION", "INFO_MODULES",
"INFO_ENVIRONMENT", "INFO_VARIABLES", "INFO_LICENSE", "INFO_ALL",
"CREDITS_GROUP", "CREDITS_GENERAL", "CREDITS_SAPI", "CREDITS_MODULES",
"CREDITS_DOCS", "CREDITS_FULLPAGE", "CREDITS_QA", "CREDITS_ALL",
"HTML_SPECIALCHARS", "HTML_ENTITIES", "ENT_COMPAT", "ENT_QUOTES",
"ENT_NOQUOTES", "STR_PAD_LEFT", "STR_PAD_RIGHT", "STR_PAD_BOTH",
"PATHINFO_DIRNAME", "PATHINFO_BASENAME", "PATHINFO_EXTENSION",
"PATHINFO_FILENAME", "CHAR_MAX", "LC_CTYPE", "LC_NUMERIC", "LC_TIME",
"LC_COLLATE", "LC_MONETARY", "LC_ALL", "SEEK_SET", "SEEK_CUR", "SEEK_END",
"LOCK_SH", "LOCK_EX", "LOCK_UN", "LOCK_NB", "STREAM_NOTIFY_CONNECT",
"STREAM_NOTIFY_AUTH_REQUIRED", "STREAM_NOTIFY_AUTH_RESULT",
"STREAM_NOTIFY_MIME_TYPE_IS", "STREAM_NOTIFY_FILE_SIZE_IS",
"STREAM_NOTIFY_REDIRECTED", "STREAM_NOTIFY_PROGRESS", "STREAM_NOTIFY_FAILURE",
"STREAM_NOTIFY_COMPLETED", "STREAM_NOTIFY_RESOLVE",
"STREAM_NOTIFY_SEVERITY_INFO", "STREAM_NOTIFY_SEVERITY_WARN",
"STREAM_NOTIFY_SEVERITY_ERR", "STREAM_FILTER_READ", "STREAM_FILTER_WRITE",
"STREAM_FILTER_ALL", "STREAM_CLIENT_PERSISTENT", "STREAM_CLIENT_ASYNC_CONNECT",
"STREAM_CLIENT_CONNECT", "STREAM_CRYPTO_METHOD_SSLv2_CLIENT",
"STREAM_CRYPTO_METHOD_SSLv3_CLIENT", "STREAM_CRYPTO_METHOD_SSLv23_CLIENT",
"STREAM_CRYPTO_METHOD_TLS_CLIENT", "STREAM_CRYPTO_METHOD_SSLv2_SERVER",
"STREAM_CRYPTO_METHOD_SSLv3_SERVER", "STREAM_CRYPTO_METHOD_SSLv23_SERVER",
"STREAM_CRYPTO_METHOD_TLS_SERVER", "STREAM_SHUT_RD", "STREAM_SHUT_WR",
"STREAM_SHUT_RDWR", "STREAM_PF_INET", "STREAM_PF_INET6", "STREAM_PF_UNIX",
"STREAM_IPPROTO_IP", "STREAM_IPPROTO_TCP", "STREAM_IPPROTO_UDP",
"STREAM_IPPROTO_ICMP", "STREAM_IPPROTO_RAW", "STREAM_SOCK_STREAM",
"STREAM_SOCK_DGRAM", "STREAM_SOCK_RAW", "STREAM_SOCK_SEQPACKET",
"STREAM_SOCK_RDM", "STREAM_PEEK", "STREAM_OOB", "STREAM_SERVER_BIND",
"STREAM_SERVER_LISTEN", "FILE_USE_INCLUDE_PATH", "FILE_IGNORE_NEW_LINES",
"FILE_SKIP_EMPTY_LINES", "FILE_APPEND", "FILE_NO_DEFAULT_CONTEXT",
"PSFS_PASS_ON", "PSFS_FEED_ME", "PSFS_ERR_FATAL", "PSFS_FLAG_NORMAL",
"PSFS_FLAG_FLUSH_INC", "PSFS_FLAG_FLUSH_CLOSE", "CRYPT_SALT_LENGTH",
"CRYPT_STD_DES", "CRYPT_EXT_DES", "CRYPT_MD5", "CRYPT_BLOWFISH",
"DIRECTORY_SEPARATOR", "PATH_SEPARATOR", "GLOB_BRACE", "GLOB_MARK",
"GLOB_NOSORT", "GLOB_NOCHECK", "GLOB_NOESCAPE", "GLOB_ERR", "GLOB_ONLYDIR",
"LOG_EMERG", "LOG_ALERT", "LOG_CRIT", "LOG_ERR", "LOG_WARNING", "LOG_NOTICE",
"LOG_INFO", "LOG_DEBUG", "LOG_KERN", "LOG_USER", "LOG_MAIL", "LOG_DAEMON",
"LOG_AUTH", "LOG_SYSLOG", "LOG_LPR", "LOG_NEWS", "LOG_UUCP", "LOG_CRON",
"LOG_AUTHPRIV", "LOG_PID", "LOG_CONS", "LOG_ODELAY", "LOG_NDELAY",
"LOG_NOWAIT", "LOG_PERROR", "EXTR_OVERWRITE", "EXTR_SKIP", "EXTR_PREFIX_SAME",
"EXTR_PREFIX_ALL", "EXTR_PREFIX_INVALID", "EXTR_PREFIX_IF_EXISTS",
"EXTR_IF_EXISTS", "EXTR_REFS", "SORT_ASC", "SORT_DESC", "SORT_REGULAR",
"SORT_NUMERIC", "SORT_STRING", "SORT_LOCALE_STRING", "CASE_LOWER",
"CASE_UPPER", "COUNT_NORMAL", "COUNT_RECURSIVE", "ASSERT_ACTIVE",
"ASSERT_CALLBACK", "ASSERT_BAIL", "ASSERT_WARNING", "ASSERT_QUIET_EVAL",
"STREAM_USE_PATH", "STREAM_IGNORE_URL", "STREAM_ENFORCE_SAFE_MODE",
"STREAM_REPORT_ERRORS", "STREAM_MUST_SEEK", "STREAM_URL_STAT_LINK",
"STREAM_URL_STAT_QUIET", "STREAM_MKDIR_RECURSIVE", "IMAGETYPE_GIF",
"IMAGETYPE_JPEG", "IMAGETYPE_PNG", "IMAGETYPE_SWF", "IMAGETYPE_PSD",
"IMAGETYPE_BMP", "IMAGETYPE_TIFF_II", "IMAGETYPE_TIFF_MM", "IMAGETYPE_JPC",
"IMAGETYPE_JP2", "IMAGETYPE_JPX", "IMAGETYPE_JB2", "IMAGETYPE_SWC",
"IMAGETYPE_IFF", "IMAGETYPE_WBMP", "IMAGETYPE_JPEG2000", "IMAGETYPE_XBM",
"T_INCLUDE", "T_INCLUDE_ONCE", "T_EVAL", "T_REQUIRE", "T_REQUIRE_ONCE",
"T_LOGICAL_OR", "T_LOGICAL_XOR", "T_LOGICAL_AND", "T_PRINT", "T_PLUS_EQUAL",
"T_MINUS_EQUAL", "T_MUL_EQUAL", "T_DIV_EQUAL", "T_CONCAT_EQUAL", "T_MOD_EQUAL",
"T_AND_EQUAL", "T_OR_EQUAL", "T_XOR_EQUAL", "T_SL_EQUAL", "T_SR_EQUAL",
"T_BOOLEAN_OR", "T_BOOLEAN_AND", "T_IS_EQUAL", "T_IS_NOT_EQUAL",
"T_IS_IDENTICAL", "T_IS_NOT_IDENTICAL", "T_IS_SMALLER_OR_EQUAL",
"T_IS_GREATER_OR_EQUAL", "T_SL", "T_SR", "T_INC", "T_DEC", "T_INT_CAST",
"T_DOUBLE_CAST", "T_STRING_CAST", "T_ARRAY_CAST", "T_OBJECT_CAST",
"T_BOOL_CAST", "T_UNSET_CAST", "T_NEW", "T_EXIT", "T_IF", "T_ELSEIF", "T_ELSE",
"T_ENDIF", "T_LNUMBER", "T_DNUMBER", "T_STRING", "T_STRING_VARNAME",
"T_VARIABLE", "T_NUM_STRING", "T_INLINE_HTML", "T_CHARACTER",
"T_BAD_CHARACTER", "T_ENCAPSED_AND_WHITESPACE", "T_CONSTANT_ENCAPSED_STRING",
"T_ECHO", "T_DO", "T_WHILE", "T_ENDWHILE", "T_FOR", "T_ENDFOR", "T_FOREACH",
"T_ENDFOREACH", "T_DECLARE", "T_ENDDECLARE", "T_AS", "T_SWITCH", "T_ENDSWITCH",
"T_CASE", "T_DEFAULT", "T_BREAK", "T_CONTINUE", "T_FUNCTION", "T_CONST",
"T_RETURN", "T_USE", "T_GLOBAL", "T_STATIC", "T_VAR", "T_UNSET", "T_ISSET",
"T_EMPTY", "T_CLASS", "T_EXTENDS", "T_INTERFACE", "T_IMPLEMENTS",
"T_OBJECT_OPERATOR", "T_DOUBLE_ARROW", "T_LIST", "T_ARRAY", "T_CLASS_C",
"T_FUNC_C", "T_METHOD_C", "T_LINE", "T_FILE", "T_COMMENT", "T_DOC_COMMENT",
"T_OPEN_TAG", "T_OPEN_TAG_WITH_ECHO", "T_CLOSE_TAG", "T_WHITESPACE",
"T_START_HEREDOC", "T_END_HEREDOC", "T_DOLLAR_OPEN_CURLY_BRACES",
"T_CURLY_OPEN", "T_PAAMAYIM_NEKUDOTAYIM", "T_DOUBLE_COLON", "T_ABSTRACT",
"T_CATCH", "T_FINAL", "T_INSTANCEOF", "T_PRIVATE", "T_PROTECTED", "T_PUBLIC",
"T_THROW", "T_TRY", "T_CLONE", "T_HALT_COMPILER", "FORCE_GZIP",
"FORCE_DEFLATE", "XML_ELEMENT_NODE", "XML_ATTRIBUTE_NODE", "XML_TEXT_NODE",
"XML_CDATA_SECTION_NODE", "XML_ENTITY_REF_NODE", "XML_ENTITY_NODE",
"XML_PI_NODE", "XML_COMMENT_NODE", "XML_DOCUMENT_NODE",
"XML_DOCUMENT_TYPE_NODE", "XML_DOCUMENT_FRAG_NODE", "XML_NOTATION_NODE",
"XML_HTML_DOCUMENT_NODE", "XML_DTD_NODE", "XML_ELEMENT_DECL_NODE",
"XML_ATTRIBUTE_DECL_NODE", "XML_ENTITY_DECL_NODE", "XML_NAMESPACE_DECL_NODE",
"XML_LOCAL_NAMESPACE", "XML_ATTRIBUTE_CDATA", "XML_ATTRIBUTE_ID",
"XML_ATTRIBUTE_IDREF", "XML_ATTRIBUTE_IDREFS", "XML_ATTRIBUTE_ENTITY",
"XML_ATTRIBUTE_NMTOKEN", "XML_ATTRIBUTE_NMTOKENS", "XML_ATTRIBUTE_ENUMERATION",
"XML_ATTRIBUTE_NOTATION", "DOM_PHP_ERR", "DOM_INDEX_SIZE_ERR",
"DOMSTRING_SIZE_ERR", "DOM_HIERARCHY_REQUEST_ERR", "DOM_WRONG_DOCUMENT_ERR",
"DOM_INVALID_CHARACTER_ERR", "DOM_NO_DATA_ALLOWED_ERR",
"DOM_NO_MODIFICATION_ALLOWED_ERR", "DOM_NOT_FOUND_ERR",
"DOM_NOT_SUPPORTED_ERR", "DOM_INUSE_ATTRIBUTE_ERR", "DOM_INVALID_STATE_ERR",
"DOM_SYNTAX_ERR", "DOM_INVALID_MODIFICATION_ERR", "DOM_NAMESPACE_ERR",
"DOM_INVALID_ACCESS_ERR", "DOM_VALIDATION_ERR", "XML_ERROR_NONE",
"XML_ERROR_NO_MEMORY", "XML_ERROR_SYNTAX", "XML_ERROR_NO_ELEMENTS",
"XML_ERROR_INVALID_TOKEN", "XML_ERROR_UNCLOSED_TOKEN",
"XML_ERROR_PARTIAL_CHAR", "XML_ERROR_TAG_MISMATCH",
"XML_ERROR_DUPLICATE_ATTRIBUTE", "XML_ERROR_JUNK_AFTER_DOC_ELEMENT",
"XML_ERROR_PARAM_ENTITY_REF", "XML_ERROR_UNDEFINED_ENTITY",
"XML_ERROR_RECURSIVE_ENTITY_REF", "XML_ERROR_ASYNC_ENTITY",
"XML_ERROR_BAD_CHAR_REF", "XML_ERROR_BINARY_ENTITY_REF",
"XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF", "XML_ERROR_MISPLACED_XML_PI",
"XML_ERROR_UNKNOWN_ENCODING", "XML_ERROR_INCORRECT_ENCODING",
"XML_ERROR_UNCLOSED_CDATA_SECTION", "XML_ERROR_EXTERNAL_ENTITY_HANDLING",
"XML_OPTION_CASE_FOLDING", "XML_OPTION_TARGET_ENCODING",
"XML_OPTION_SKIP_TAGSTART", "XML_OPTION_SKIP_WHITE", "XML_SAX_IMPL", "IMG_GIF",
"IMG_JPG", "IMG_JPEG", "IMG_PNG", "IMG_WBMP", "IMG_XPM", "IMG_COLOR_TILED",
"IMG_COLOR_STYLED", "IMG_COLOR_BRUSHED", "IMG_COLOR_STYLEDBRUSHED",
"IMG_COLOR_TRANSPARENT", "IMG_ARC_ROUNDED", "IMG_ARC_PIE", "IMG_ARC_CHORD",
"IMG_ARC_NOFILL", "IMG_ARC_EDGED", "IMG_GD2_RAW", "IMG_GD2_COMPRESSED",
"IMG_EFFECT_REPLACE", "IMG_EFFECT_ALPHABLEND", "IMG_EFFECT_NORMAL",
"IMG_EFFECT_OVERLAY", "GD_BUNDLED", "IMG_FILTER_NEGATE",
"IMG_FILTER_GRAYSCALE", "IMG_FILTER_BRIGHTNESS", "IMG_FILTER_CONTRAST",
"IMG_FILTER_COLORIZE", "IMG_FILTER_EDGEDETECT", "IMG_FILTER_GAUSSIAN_BLUR",
"IMG_FILTER_SELECTIVE_BLUR", "IMG_FILTER_EMBOSS", "IMG_FILTER_MEAN_REMOVAL",
"IMG_FILTER_SMOOTH", "PNG_NO_FILTER", "PNG_FILTER_NONE", "PNG_FILTER_SUB",
"PNG_FILTER_UP", "PNG_FILTER_AVG", "PNG_FILTER_PAETH", "PNG_ALL_FILTERS",
"MB_OVERLOAD_MAIL", "MB_OVERLOAD_STRING", "MB_OVERLOAD_REGEX", "MB_CASE_UPPER",
"MB_CASE_LOWER", "MB_CASE_TITLE", "MYSQL_ASSOC", "MYSQL_NUM", "MYSQL_BOTH",
"MYSQL_CLIENT_COMPRESS", "MYSQL_CLIENT_SSL", "MYSQL_CLIENT_INTERACTIVE",
"MYSQL_CLIENT_IGNORE_SPACE", "MYSQLI_READ_DEFAULT_GROUP",
"MYSQLI_READ_DEFAULT_FILE", "MYSQLI_OPT_CONNECT_TIMEOUT",
"MYSQLI_OPT_LOCAL_INFILE", "MYSQLI_INIT_COMMAND", "MYSQLI_CLIENT_SSL",
"MYSQLI_CLIENT_COMPRESS", "MYSQLI_CLIENT_INTERACTIVE",
"MYSQLI_CLIENT_IGNORE_SPACE", "MYSQLI_CLIENT_NO_SCHEMA",
"MYSQLI_CLIENT_FOUND_ROWS", "MYSQLI_STORE_RESULT", "MYSQLI_USE_RESULT",
"MYSQLI_ASSOC", "MYSQLI_NUM", "MYSQLI_BOTH",
"MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH", "MYSQLI_STMT_ATTR_CURSOR_TYPE",
"MYSQLI_CURSOR_TYPE_NO_CURSOR", "MYSQLI_CURSOR_TYPE_READ_ONLY",
"MYSQLI_CURSOR_TYPE_FOR_UPDATE", "MYSQLI_CURSOR_TYPE_SCROLLABLE",
"MYSQLI_STMT_ATTR_PREFETCH_ROWS", "MYSQLI_NOT_NULL_FLAG",
"MYSQLI_PRI_KEY_FLAG", "MYSQLI_UNIQUE_KEY_FLAG", "MYSQLI_MULTIPLE_KEY_FLAG",
"MYSQLI_BLOB_FLAG", "MYSQLI_UNSIGNED_FLAG", "MYSQLI_ZEROFILL_FLAG",
"MYSQLI_AUTO_INCREMENT_FLAG", "MYSQLI_TIMESTAMP_FLAG", "MYSQLI_SET_FLAG",
"MYSQLI_NUM_FLAG", "MYSQLI_PART_KEY_FLAG", "MYSQLI_GROUP_FLAG",
"MYSQLI_TYPE_DECIMAL", "MYSQLI_TYPE_TINY", "MYSQLI_TYPE_SHORT",
"MYSQLI_TYPE_LONG", "MYSQLI_TYPE_FLOAT", "MYSQLI_TYPE_DOUBLE",
"MYSQLI_TYPE_NULL", "MYSQLI_TYPE_TIMESTAMP", "MYSQLI_TYPE_LONGLONG",
"MYSQLI_TYPE_INT24", "MYSQLI_TYPE_DATE", "MYSQLI_TYPE_TIME",
"MYSQLI_TYPE_DATETIME", "MYSQLI_TYPE_YEAR", "MYSQLI_TYPE_NEWDATE",
"MYSQLI_TYPE_ENUM", "MYSQLI_TYPE_SET", "MYSQLI_TYPE_TINY_BLOB",
"MYSQLI_TYPE_MEDIUM_BLOB", "MYSQLI_TYPE_LONG_BLOB", "MYSQLI_TYPE_BLOB",
"MYSQLI_TYPE_VAR_STRING", "MYSQLI_TYPE_STRING", "MYSQLI_TYPE_CHAR",
"MYSQLI_TYPE_INTERVAL", "MYSQLI_TYPE_GEOMETRY", "MYSQLI_TYPE_NEWDECIMAL",
"MYSQLI_TYPE_BIT", "MYSQLI_RPL_MASTER", "MYSQLI_RPL_SLAVE", "MYSQLI_RPL_ADMIN",
"MYSQLI_NO_DATA", "MYSQLI_DATA_TRUNCATED", "MYSQLI_REPORT_INDEX",
"MYSQLI_REPORT_ERROR", "MYSQLI_REPORT_STRICT", "MYSQLI_REPORT_ALL",
"MYSQLI_REPORT_OFF", "AF_UNIX", "AF_INET", "AF_INET6", "SOCK_STREAM",
"SOCK_DGRAM", "SOCK_RAW", "SOCK_SEQPACKET", "SOCK_RDM", "MSG_OOB",
"MSG_WAITALL", "MSG_PEEK", "MSG_DONTROUTE", "SO_DEBUG", "SO_REUSEADDR",
"SO_KEEPALIVE", "SO_DONTROUTE", "SO_LINGER", "SO_BROADCAST", "SO_OOBINLINE",
"SO_SNDBUF", "SO_RCVBUF", "SO_SNDLOWAT", "SO_RCVLOWAT", "SO_SNDTIMEO",
"SO_RCVTIMEO", "SO_TYPE", "SO_ERROR", "SOL_SOCKET", "SOMAXCONN",
"PHP_NORMAL_READ", "PHP_BINARY_READ", "SOCKET_EINTR", "SOCKET_EBADF",
"SOCKET_EACCES", "SOCKET_EFAULT", "SOCKET_EINVAL", "SOCKET_EMFILE",
"SOCKET_EWOULDBLOCK", "SOCKET_EINPROGRESS", "SOCKET_EALREADY",
"SOCKET_ENOTSOCK", "SOCKET_EDESTADDRREQ", "SOCKET_EMSGSIZE",
"SOCKET_EPROTOTYPE", "SOCKET_ENOPROTOOPT", "SOCKET_EPROTONOSUPPORT",
"SOCKET_ESOCKTNOSUPPORT", "SOCKET_EOPNOTSUPP", "SOCKET_EPFNOSUPPORT",
"SOCKET_EAFNOSUPPORT", "SOCKET_EADDRINUSE", "SOCKET_EADDRNOTAVAIL",
"SOCKET_ENETDOWN", "SOCKET_ENETUNREACH", "SOCKET_ENETRESET",
"SOCKET_ECONNABORTED", "SOCKET_ECONNRESET", "SOCKET_ENOBUFS", "SOCKET_EISCONN",
"SOCKET_ENOTCONN", "SOCKET_ESHUTDOWN", "SOCKET_ETOOMANYREFS",
"SOCKET_ETIMEDOUT", "SOCKET_ECONNREFUSED", "SOCKET_ELOOP",
"SOCKET_ENAMETOOLONG", "SOCKET_EHOSTDOWN", "SOCKET_EHOSTUNREACH",
"SOCKET_ENOTEMPTY", "SOCKET_EPROCLIM", "SOCKET_EUSERS", "SOCKET_EDQUOT",
"SOCKET_ESTALE", "SOCKET_EREMOTE", "SOCKET_EDISCON", "SOCKET_SYSNOTREADY",
"SOCKET_VERNOTSUPPORTED", "SOCKET_NOTINITIALISED", "SOCKET_HOST_NOT_FOUND",
"SOCKET_TRY_AGAIN", "SOCKET_NO_RECOVERY", "SOCKET_NO_DATA",
"SOCKET_NO_ADDRESS", "SOL_TCP", "SOL_UDP", "EACCELERATOR_VERSION",
"EACCELERATOR_SHM_AND_DISK", "EACCELERATOR_SHM", "EACCELERATOR_SHM_ONLY",
"EACCELERATOR_DISK_ONLY", "EACCELERATOR_NONE", "XDEBUG_TRACE_APPEND",
"XDEBUG_TRACE_COMPUTERIZED", "XDEBUG_TRACE_HTML", "XDEBUG_CC_UNUSED",
"XDEBUG_CC_DEAD_CODE", "STDIN", "STDOUT", "STDERR", "DNS_HINFO",
"DNS_PTR", "SQLITE_EMPTY", "SVN_SHOW_UPDATES", "SVN_NO_IGNORE", "MSG_EOF",
"DNS_MX", "GD_EXTRA_VERSION", "PHP_VERSION_ID", "SQLITE_OK",
"LIBXML_LOADED_VERSION", "RADIXCHAR", "OPENSSL_VERSION_TEXT", "OPENSSL_VERSION_NUMBER",
"PCRE_VERSION", "CURLOPT_FILE", "CURLOPT_INFILE", "CURLOPT_URL", "CURLOPT_PROXY",
"CURLE_FUNCTION_NOT_FOUND", "SOCKET_ENOMSG", "CURLOPT_HTTPHEADER", "SOCKET_EIDRM",
"CURLOPT_PROGRESSFUNCTION", "SOCKET_ECHRNG", "SOCKET_EL2NSYNC", "SOCKET_EL3HLT",
"SOCKET_EL3RST", "SOCKET_ELNRNG", "SOCKET_ENOCSI", "SOCKET_EL2HLT", "SOCKET_EBADE",
"SOCKET_EXFULL", "CURLOPT_USERPWD", "CURLOPT_PROXYUSERPWD", "CURLOPT_RANGE",
"CURLOPT_TIMEOUT_MS", "CURLOPT_POSTFIELDS", "CURLOPT_REFERER", "CURLOPT_USERAGENT",
"CURLOPT_FTPPORT", "SOCKET_ERESTART", "SQLITE_CONSTRAINT", "SQLITE_MISMATCH",
"SQLITE_MISUSE", "CURLOPT_COOKIE", "CURLE_SSL_CERTPROBLEM", "CURLOPT_SSLCERT",
"CURLOPT_KEYPASSWD", "CURLOPT_WRITEHEADER", "CURLOPT_SSL_VERIFYHOST",
"CURLOPT_COOKIEFILE", "CURLE_HTTP_RANGE_ERROR", "CURLE_HTTP_POST_ERROR",
"CURLOPT_CUSTOMREQUEST", "CURLOPT_STDERR", "SOCKET_EBADR", "CURLOPT_RETURNTRANSFER",
"CURLOPT_QUOTE", "CURLOPT_POSTQUOTE", "CURLOPT_INTERFACE", "CURLOPT_KRB4LEVEL",
"SOCKET_ENODATA", "SOCKET_ESRMNT", "CURLOPT_WRITEFUNCTION", "CURLOPT_READFUNCTION",
"CURLOPT_HEADERFUNCTION", "SOCKET_EADV", "SOCKET_EPROTO", "SOCKET_EMULTIHOP",
"SOCKET_EBADMSG", "CURLOPT_FORBID_REUSE", "CURLOPT_RANDOM_FILE", "CURLOPT_EGDSOCKET",
"SOCKET_EREMCHG", "CURLOPT_CONNECTTIMEOUT_MS", "CURLOPT_CAINFO", "CURLOPT_CAPATH",
"CURLOPT_COOKIEJAR", "CURLOPT_SSL_CIPHER_LIST", "CURLOPT_BINARYTRANSFER",
"SQLITE_DONE", "CURLOPT_HTTP_VERSION", "CURLOPT_SSLKEY", "CURLOPT_SSLKEYTYPE",
"CURLOPT_SSLENGINE", "CURLOPT_SSLCERTTYPE", "CURLE_OUT_OF_MEMORY", "CURLOPT_ENCODING",
"CURLE_SSL_CIPHER", "SOCKET_EREMOTEIO", "CURLOPT_HTTP200ALIASES", "CURLAUTH_ANY",
"CURLAUTH_ANYSAFE", "CURLOPT_PRIVATE", "CURLINFO_EFFECTIVE_URL", "CURLINFO_HTTP_CODE",
"CURLINFO_HEADER_SIZE", "CURLINFO_REQUEST_SIZE", "CURLINFO_TOTAL_TIME",
"CURLINFO_NAMELOOKUP_TIME", "CURLINFO_CONNECT_TIME", "CURLINFO_PRETRANSFER_TIME",
"CURLINFO_SIZE_UPLOAD", "CURLINFO_SIZE_DOWNLOAD", "CURLINFO_SPEED_DOWNLOAD",
"CURLINFO_SPEED_UPLOAD", "CURLINFO_FILETIME", "CURLINFO_SSL_VERIFYRESULT",
"CURLINFO_CONTENT_LENGTH_DOWNLOAD", "CURLINFO_CONTENT_LENGTH_UPLOAD",
"CURLINFO_STARTTRANSFER_TIME", "CURLINFO_CONTENT_TYPE", "CURLINFO_REDIRECT_TIME",
"CURLINFO_REDIRECT_COUNT", "CURLINFO_PRIVATE", "CURLINFO_CERTINFO",
"SQLITE_PROTOCOL", "SQLITE_SCHEMA", "SQLITE_TOOBIG", "SQLITE_NOLFS",
"SQLITE_AUTH", "SQLITE_FORMAT", "SOCKET_ENOTTY", "SQLITE_NOTADB",
"SOCKET_ENOSPC", "SOCKET_ESPIPE", "SOCKET_EROFS", "SOCKET_EMLINK", "GD_RELEASE_VERSION",
"SOCKET_ENOLCK", "SOCKET_ENOSYS", "SOCKET_EUNATCH", "SOCKET_ENOANO", "SOCKET_EBADRQC",
"SOCKET_EBADSLT", "SOCKET_ENOSTR", "SOCKET_ETIME", "SOCKET_ENOSR", "SVN_REVISION_HEAD",
"XSD_ENTITY", "XSD_NOTATION", "CURLOPT_CERTINFO", "CURLOPT_POSTREDIR", "CURLOPT_SSH_AUTH_TYPES",
"CURLOPT_SSH_PUBLIC_KEYFILE", "CURLOPT_SSH_PRIVATE_KEYFILE", "CURLOPT_SSH_HOST_PUBLIC_KEY_MD5",
"CURLE_SSH", "CURLOPT_REDIR_PROTOCOLS", "CURLOPT_PROTOCOLS", "XSD_NONNEGATIVEINTEGER",
"XSD_BYTE","DNS_SRV","DNS_A6", "DNS_NAPTR", "DNS_AAAA", "FILTER_SANITIZE_FULL_SPECIAL_CHARS",
"ABDAY_1", "SVN_REVISION_UNSPECIFIED", "SVN_REVISION_BASE", "SVN_REVISION_COMMITTED",
"SVN_REVISION_PREV", "GD_VERSION", "MCRYPT_TRIPLEDES", "MCRYPT_ARCFOUR_IV", "MCRYPT_ARCFOUR",
"MCRYPT_BLOWFISH", "MCRYPT_BLOWFISH_COMPAT", "MCRYPT_CAST_128", "MCRYPT_CAST_256",
"MCRYPT_ENIGNA", "MCRYPT_DES", "MCRYPT_GOST", "MCRYPT_LOKI97", "MCRYPT_PANAMA",
"MCRYPT_RC2", "MCRYPT_RIJNDAEL_128", "MCRYPT_RIJNDAEL_192", "MCRYPT_RIJNDAEL_256",
"MCRYPT_SAFER64", "MCRYPT_SAFER128","MCRYPT_SAFERPLUS", "MCRYPT_SERPENT", "MCRYPT_THREEWAY",
"MCRYPT_TWOFISH", "MCRYPT_WAKE", "MCRYPT_XTEA", "MCRYPT_IDEA", "MCRYPT_MARS",
"MCRYPT_RC6", "MCRYPT_SKIPJACK", "MCRYPT_MODE_CBC", "MCRYPT_MODE_CFB", "MCRYPT_MODE_ECB",
"MCRYPT_MODE_NOFB", "MCRYPT_MODE_OFB", "MCRYPT_MODE_STREAM", "CL_EXPUNGE",
"SQLITE_ROW", "POSIX_S_IFBLK", "POSIX_S_IFSOCK", "XSD_IDREF", "ABDAY_2",
"ABDAY_3", "ABDAY_4", "ABDAY_5", "ABDAY_6", "ABDAY_7", "DAY_1", "DAY_2",
"DAY_3", "DAY_4", "DAY_5", "DAY_6", "DAY_7", "ABMON_1", "ABMON_2", "ABMON_3",
"ABMON_4", "ABMON_5", "ABMON_6", "ABMON_7","ABMON_8", "ABMON_9", "ABMON_10",
"ABMON_11", "ABMON_12", "MON_1", "MON_2", "MON_3", "MON_4", "MON_5", "MON_6",
"MON_7", "MON_8", "MON_9", "MON_10", "MON_11", "MON_12", "AM_STR", "PM_STR",
"D_T_FMT", "D_FMT", "T_FMT", "T_FMT_AMPM", "ERA", "ERA_D_T_FMT", "ERA_D_FMT",
"ERA_T_FMT", "ALT_DIGITS", "CRNCYSTR", "THOUSEP", "YESEXPR", "NOEXPR",
"SOCKET_ENOMEDIUM", "GLOB_AVAILABLE_FLAGS", "XSD_SHORT", "XSD_NMTOKENS",
"LOG_LOCAL3", "LOG_LOCAL4", "LOG_LOCAL5", "LOG_LOCAL6", "LOG_LOCAL7",
"DNS_ANY", "DNS_ALL", "SOCKET_ENOLINK", "SOCKET_ECOMM", "SOAP_FUNCTIONS_ALL",
"UNKNOWN_TYPE", "XSD_BASE64BINARY", "XSD_ANYURI", "XSD_QNAME", "SOCKET_EISNAM",
"SOCKET_EMEDIUMTYPE", "XSD_NCNAME", "XSD_ID", "XSD_ENTITIES", "XSD_INTEGER",
"XSD_NONPOSITIVEINTEGER", "XSD_NEGATIVEINTEGER", "XSD_LONG", "XSD_INT",
"XSD_UNSIGNEDLONG", "XSD_UNSIGNEDINT", "XSD_UNSIGNEDSHORT", "XSD_UNSIGNEDBYTE",
"XSD_POSITIVEINTEGER", "XSD_ANYTYPE", "XSD_ANYXML", "APACHE_MAP", "XSD_1999_TIMEINSTANT",
"XSD_NAMESPACE", "XSD_1999_NAMESPACE", "SOCKET_ENOTUNIQ", "SOCKET_EBADFD",
"SOCKET_ESTRPIPE", "T_GOTO", "T_NAMESPACE", "T_NS_C", "T_DIR", "T_NS_SEPARATOR",
"LIBXSLT_VERSION","LIBEXSLT_DOTTED_VERSION", "LIBEXSLT_VERSION", "SVN_AUTH_PARAM_DEFAULT_USERNAME",
"SVN_AUTH_PARAM_DEFAULT_PASSWORD", "SVN_AUTH_PARAM_NON_INTERACTIVE",
"SVN_AUTH_PARAM_DONT_STORE_PASSWORDS", "SVN_AUTH_PARAM_NO_AUTH_CACHE",
"SVN_AUTH_PARAM_SSL_SERVER_FAILURES", "SVN_AUTH_PARAM_SSL_SERVER_CERT_INFO",
"SVN_AUTH_PARAM_CONFIG", "SVN_AUTH_PARAM_SERVER_GROUP",
"SVN_AUTH_PARAM_CONFIG_DIR", "PHP_SVN_AUTH_PARAM_IGNORE_SSL_VERIFY_ERRORS",
"SVN_FS_CONFIG_FS_TYPE", "SVN_FS_TYPE_BDB", "SVN_FS_TYPE_FSFS", "SVN_PROP_REVISION_DATE",
"SVN_PROP_REVISION_ORIG_DATE", "SVN_PROP_REVISION_AUTHOR", "SVN_PROP_REVISION_LOG"
].forEach(function(element, index, array) {
result[element] = token("atom", "php-predefined-constant");
});
// PHP declared classes - output of get_declared_classes(). Differs from http://php.net/manual/en/reserved.classes.php
[ "stdClass", "Exception", "ErrorException", "COMPersistHelper", "com_exception",
"com_safearray_proxy", "variant", "com", "dotnet", "ReflectionException",
"Reflection", "ReflectionFunctionAbstract", "ReflectionFunction",
"ReflectionParameter", "ReflectionMethod", "ReflectionClass",
"ReflectionObject", "ReflectionProperty", "ReflectionExtension", "DateTime",
"DateTimeZone", "LibXMLError", "__PHP_Incomplete_Class", "php_user_filter",
"Directory", "SimpleXMLElement", "DOMException", "DOMStringList",
"DOMNameList", "DOMImplementationList", "DOMImplementationSource",
"DOMImplementation", "DOMNode", "DOMNameSpaceNode", "DOMDocumentFragment",
"DOMDocument", "DOMNodeList", "DOMNamedNodeMap", "DOMCharacterData", "DOMAttr",
"DOMElement", "DOMText", "DOMComment", "DOMTypeinfo", "DOMUserDataHandler",
"DOMDomError", "DOMErrorHandler", "DOMLocator", "DOMConfiguration",
"DOMCdataSection", "DOMDocumentType", "DOMNotation", "DOMEntity",
"DOMEntityReference", "DOMProcessingInstruction", "DOMStringExtend",
"DOMXPath", "RecursiveIteratorIterator", "IteratorIterator", "FilterIterator",
"RecursiveFilterIterator", "ParentIterator", "LimitIterator",
"CachingIterator", "RecursiveCachingIterator", "NoRewindIterator",
"AppendIterator", "InfiniteIterator", "RegexIterator",
"RecursiveRegexIterator", "EmptyIterator", "ArrayObject", "ArrayIterator",
"RecursiveArrayIterator", "SplFileInfo", "DirectoryIterator",
"RecursiveDirectoryIterator", "SplFileObject", "SplTempFileObject",
"SimpleXMLIterator", "LogicException", "BadFunctionCallException",
"BadMethodCallException", "DomainException", "InvalidArgumentException",
"LengthException", "OutOfRangeException", "RuntimeException",
"OutOfBoundsException", "OverflowException", "RangeException",
"UnderflowException", "UnexpectedValueException", "SplObjectStorage",
"XMLReader", "XMLWriter", "mysqli_sql_exception", "mysqli_driver", "mysqli",
"mysqli_warning", "mysqli_result", "mysqli_stmt", "PDOException", "PDO",
"PDOStatement", "PDORow","Closure", "DateInterval", "DatePeriod", "FilesystemIterator",
"GlobIterator", "MultipleIterator", "RecursiveTreeIterator", "SoapClient",
"SoapFault", "SoapHeader", "SoapParam", "SoapServer", "SoapVar", "SplDoublyLinkedList",
"SplFixedArray", "SplHeap", "SplMaxHeap", "SplMinHeap", "SplPriorityQueue",
"SplQueue", "SplStack", "SQLite3", "SQLite3Result", "SQLite3Stmt", "SQLiteDatabase",
"SQLiteException", "SQLiteResult", "SQLiteUnbuffered", "Svn", "SvnNode", "SvnWc",
"SvnWcSchedule", "XSLTProcessor", "ZipArchive",
].forEach(function(element, index, array) {
result[element] = token("t_string", "php-predefined-class");
});
return result;
}();
// Helper regexps
var isOperatorChar = /[+*&%\/=<>!?.|^@-]/;
var isHexDigit = /[0-9A-Fa-f]/;
var isWordChar = /[\w\$_\\]/;
// Wrapper around phpToken that helps maintain parser state (whether
// we are inside of a multi-line comment)
function phpTokenState(inside) {
return function(source, setState) {
var newInside = inside;
var type = phpToken(inside, source, function(c) {newInside = c;});
if (newInside != inside)
setState(phpTokenState(newInside));
return type;
};
}
// The token reader, inteded to be used by the tokenizer from
// tokenize.js (through phpTokenState). Advances the source stream
// over a token, and returns an object containing the type and style
// of that token.
function phpToken(inside, source, setInside) {
function readHexNumber(){
source.next(); // skip the 'x'
source.nextWhileMatches(isHexDigit);
return {type: "number", style: "php-atom"};
}
function readNumber() {
source.nextWhileMatches(/[0-9]/);
if (source.equals(".")){
source.next();
source.nextWhileMatches(/[0-9]/);
}
if (source.equals("e") || source.equals("E")){
source.next();
if (source.equals("-"))
source.next();
source.nextWhileMatches(/[0-9]/);
}
return {type: "number", style: "php-atom"};
}
// Read a word and look it up in the keywords array. If found, it's a
// keyword of that type; otherwise it's a PHP T_STRING.
function readWord() {
source.nextWhileMatches(isWordChar);
var word = source.get();
var known = keywords.hasOwnProperty(word) && keywords.propertyIsEnumerable(word) && keywords[word];
// since we called get(), tokenize::take won't get() anything. Thus, we must set token.content
return known ? {type: known.type, style: known.style, content: word} :
{type: "t_string", style: "php-t_string", content: word};
}
function readVariable() {
source.nextWhileMatches(isWordChar);
var word = source.get();
// in PHP, '$this' is a reserved word, but 'this' isn't. You can have function this() {...}
if (word == "$this")
return {type: "variable", style: "php-keyword", content: word};
else
return {type: "variable", style: "php-variable", content: word};
}
// Advance the stream until the given character (not preceded by a
// backslash) is encountered, or the end of the line is reached.
function nextUntilUnescaped(source, end) {
var escaped = false;
while(!source.endOfLine()){
var next = source.next();
if (next == end && !escaped)
return false;
escaped = next == "\\" && !escaped;
}
return escaped;
}
function readSingleLineComment() {
// read until the end of the line or until ?>, which terminates single-line comments
// `<?php echo 1; // comment ?> foo` will display "1 foo"
while(!source.lookAhead("?>") && !source.endOfLine())
source.next();
return {type: "comment", style: "php-comment"};
}
/* For multi-line comments, we want to return a comment token for
every line of the comment, but we also want to return the newlines
in them as regular newline tokens. We therefore need to save a
state variable ("inside") to indicate whether we are inside a
multi-line comment.
*/
function readMultilineComment(start){
var newInside = "/*";
var maybeEnd = (start == "*");
while (true) {
if (source.endOfLine())
break;
var next = source.next();
if (next == "/" && maybeEnd){
newInside = null;
break;
}
maybeEnd = (next == "*");
}
setInside(newInside);
return {type: "comment", style: "php-comment"};
}
// similar to readMultilineComment and nextUntilUnescaped
// unlike comments, strings are not stopped by ?>
function readMultilineString(start){
var newInside = start;
var escaped = false;
while (true) {
if (source.endOfLine())
break;
var next = source.next();
if (next == start && !escaped){
newInside = null; // we're outside of the string now
break;
}
escaped = (next == "\\" && !escaped);
}
setInside(newInside);
return {
type: newInside == null? "string" : "string_not_terminated",
style: (start == "'"? "php-string-single-quoted" : "php-string-double-quoted")
};
}
// http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
// See also 'nowdoc' on the page. Heredocs are not interrupted by the '?>' token.
function readHeredoc(identifier){
var token = {};
if (identifier == "<<<") {
// on our first invocation after reading the <<<, we must determine the closing identifier
if (source.equals("'")) {
// nowdoc
source.nextWhileMatches(isWordChar);
identifier = "'" + source.get() + "'";
source.next(); // consume the closing "'"
} else if (source.matches(/[A-Za-z_]/)) {
// heredoc
source.nextWhileMatches(isWordChar);
identifier = source.get();
} else {
// syntax error
setInside(null);
return { type: "error", style: "syntax-error" };
}
setInside(identifier);
token.type = "string_not_terminated";
token.style = identifier.charAt(0) == "'"? "php-string-single-quoted" : "php-string-double-quoted";
token.content = identifier;
} else {
token.style = identifier.charAt(0) == "'"? "php-string-single-quoted" : "php-string-double-quoted";
// consume a line of heredoc and check if it equals the closing identifier plus an optional semicolon
if (source.lookAhead(identifier, true) && (source.lookAhead(";\n") || source.endOfLine())) {
// the closing identifier can only appear at the beginning of the line
// note that even whitespace after the ";" is forbidden by the PHP heredoc syntax
token.type = "string";
token.content = source.get(); // don't get the ";" if there is one
setInside(null);
} else {
token.type = "string_not_terminated";
source.nextWhileMatches(/[^\n]/);
token.content = source.get();
}
}
return token;
}
function readOperator() {
source.nextWhileMatches(isOperatorChar);
return {type: "operator", style: "php-operator"};
}
function readStringSingleQuoted() {
var endBackSlash = nextUntilUnescaped(source, "'", false);
setInside(endBackSlash ? "'" : null);
return {type: "string", style: "php-string-single-quoted"};
}
function readStringDoubleQuoted() {
var endBackSlash = nextUntilUnescaped(source, "\"", false);
setInside(endBackSlash ? "\"": null);
return {type: "string", style: "php-string-double-quoted"};
}
// Fetch the next token. Dispatches on first character in the
// stream, or first two characters when the first is a slash.
switch (inside) {
case null:
case false: break;
case "'":
case "\"": return readMultilineString(inside);
case "/*": return readMultilineComment(source.next());
default: return readHeredoc(inside);
}
var ch = source.next();
if (ch == "'" || ch == "\"")
return readMultilineString(ch);
else if (ch == "#")
return readSingleLineComment();
else if (ch == "$")
return readVariable();
else if (ch == ":" && source.equals(":")) {
source.next();
// the T_DOUBLE_COLON can only follow a T_STRING (class name)
return {type: "t_double_colon", style: "php-operator"};
}
// with punctuation, the type of the token is the symbol itself
else if (/[\[\]{}\(\),;:]/.test(ch)) {
return {type: ch, style: "php-punctuation"};
}
else if (ch == "0" && (source.equals("x") || source.equals("X")))
return readHexNumber();
else if (/[0-9]/.test(ch))
return readNumber();
else if (ch == "/") {
if (source.equals("*"))
{ source.next(); return readMultilineComment(ch); }
else if (source.equals("/"))
return readSingleLineComment();
else
return readOperator();
}
else if (ch == "<") {
if (source.lookAhead("<<", true)) {
setInside("<<<");
return {type: "<<<", style: "php-punctuation"};
}
else
return readOperator();
}
else if (isOperatorChar.test(ch))
return readOperator();
else
return readWord();
}
// The external interface to the tokenizer.
return function(source, startState) {
return tokenizer(source, startState || phpTokenState(false, true));
};
})();
| JavaScript |
function waitForStyles() {
for (var i = 0; i < document.styleSheets.length; i++)
if (/googleapis/.test(document.styleSheets[i].href))
return document.body.className += " droid";
setTimeout(waitForStyles, 100);
}
setTimeout(function() {
if (/AppleWebKit/.test(navigator.userAgent) && /iP[oa]d|iPhone/.test(navigator.userAgent)) return;
var link = document.createElement("LINK");
link.type = "text/css";
link.rel = "stylesheet";
link.href = "http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans:bold";
document.documentElement.getElementsByTagName("HEAD")[0].appendChild(link);
waitForStyles();
}, 20);
| JavaScript |
CKFinder.addPlugin( 'fileeditor', function( api ) {
var regexExt = /^(.*)\.([^\.]+)$/,
regexTextExt = /^(txt|css|html|htm|js|asp|cfm|cfc|ascx|php|inc|xml|xslt|xsl)$/i,
regexCodeMirrorExt = /^(css|html|htm|js|xml|xsl|php)$/i,
codemirror,
file,
fileLoaded = false,
doc;
var codemirrorPath = CKFinder.getPluginPath('fileeditor') + 'codemirror/';
var codeMirrorParsers = {
css : 'parsecss.js',
js : [ 'tokenizejavascript.js', 'parsejavascript.js' ],
xml : 'parsexml.js',
php : ['parsexml.js', 'parsecss.js', 'tokenizejavascript.js', 'parsejavascript.js', '../contrib/php/js/tokenizephp.js', '../contrib/php/js/parsephp.js', '../contrib/php/js/parsephphtmlmixed.js']
};
var codeMirrorCss = {
css : codemirrorPath + 'css/csscolors.css',
js : codemirrorPath + 'css/jscolors.css',
xml : codemirrorPath + 'css/xmlcolors.css',
php : [ codemirrorPath + 'css/xmlcolors.css', codemirrorPath + 'css/jscolors.css', codemirrorPath + 'css/csscolors.css', codemirrorPath + 'contrib/php/css/phpcolors.css' ]
};
codeMirrorCss.xsl = codeMirrorCss.xml;
codeMirrorCss.htm = codeMirrorCss.xml;
codeMirrorCss.html = codeMirrorCss.xml;
codeMirrorParsers.xsl = codeMirrorParsers.xml;
codeMirrorParsers.htm = codeMirrorParsers.xml;
codeMirrorParsers.html = codeMirrorParsers.xml;
var isTextFile = function( file )
{
return regexTextExt.test( file.ext );
};
CKFinder.dialog.add( 'fileEditor', function( api )
{
var height, width;
var saveButton = (function()
{
return {
id : 'save',
label : api.lang.Fileeditor.save,
type : 'button',
onClick : function ( evt ) {
if ( !fileLoaded )
return true;
var dialog = evt.data.dialog;
var content = codemirror ? codemirror.getCode() : doc.getById( 'fileContent' ).getValue();
api.connector.sendCommandPost( "SaveFile", null, {
content : content,
fileName : file.name
},
function( xml ) {
if ( xml.checkError() )
return false;
api.openMsgDialog( '', api.lang.Fileeditor.fileSaveSuccess );
dialog.hide();
return undefined;
},
file.folder.type,
file.folder
);
return false;
}
};
})();
if ( api.inPopup )
{
width = api.document.documentElement.offsetWidth;
height = api.document.documentElement.offsetHeight;
}
else
{
var parentWindow = ( api.document.parentWindow || api.document.defaultView ).parent;
width = parentWindow.innerWidth ? parentWindow.innerWidth : parentWindow.document.documentElement.clientWidth;
height = parentWindow.innerHeight ? parentWindow.innerHeight : parentWindow.document.documentElement.clientHeight;
}
return {
title : api.getSelectedFile().name,
minWidth : parseInt( width, 10 ) * 0.6,
minHeight : parseInt( height, 10 ) * 0.7,
onHide : function() {
if ( fileLoaded )
{
var fileContent = doc.getById( 'fileContent' );
if ( fileContent )
fileContent.remove();
}
},
onShow : function() {
var dialog = this;
var cssWidth = parseInt( width, 10 ) * 0.6 - 10;
var cssHeight = parseInt( height, 10 ) * 0.7 - 20;
doc = dialog.getElement().getDocument();
var win = doc.getWindow();
doc.getById( 'fileArea' ).setHtml( '<div class="ckfinder_loader_32" style="margin: 100px auto 0 auto;text-align:center;"><p style="height:' + cssHeight + 'px;width:' + cssWidth + 'px;">' + api.lang.Fileeditor.loadingFile + '</p></div>' );
file = api.getSelectedFile();
var enableCodeMirror = regexCodeMirrorExt.test( file.ext );
this.setTitle( file.name );
if ( enableCodeMirror && win.$.CodeMirror === undefined )
{
var head= doc.$.getElementsByTagName( 'head' )[0];
var script= doc.$.createElement( 'script' );
script.type= 'text/javascript';
script.src = CKFinder.getPluginPath( 'fileeditor' ) + 'codemirror/js/codemirror.js';
head.appendChild( script );
}
// If CKFinder is runninng under a different domain than baseUrl, then the following call will fail:
// CKFinder.ajax.load( file.getUrl() + '?t=' + (new Date().getTime()), function( data )...
var url = api.connector.composeUrl( 'DownloadFile', { FileName : file.name, format : 'text', t : new Date().getTime() },
file.folder.type, file.folder );
CKFinder.ajax.load( url, function( data )
{
if ( data === null || ( file.size > 0 && data === '' ) )
{
api.openMsgDialog( '', api.lang.Fileeditor.fileOpenError );
dialog.hide();
return;
}
else
fileLoaded = true;
var fileArea = doc.getById( 'fileArea' );
fileArea.setStyle('height', '100%');
fileArea.setHtml( '<textarea id="fileContent" style="height:' + cssHeight + 'px; width:' + cssWidth + 'px"></textarea>' );
doc.getById( 'fileContent' ).setText( data );
codemirror = null;
if ( enableCodeMirror && win.$.CodeMirror !== undefined )
{
codemirror = win.$.CodeMirror.fromTextArea( doc.getById( 'fileContent').$,
{
height : cssHeight + 'px',
parserfile : codeMirrorParsers[ file.ext.toLowerCase() ],
stylesheet : codeMirrorCss[ file.ext.toLowerCase() ],
path : codemirrorPath + "js/"
}
);
// TODO get rid of ugly buttons and provide something better
var undoB = doc.createElement( "button", { attributes: { "label" : api.lang.common.undo } } );
undoB.on( 'click', function()
{
codemirror.undo();
});
undoB.setHtml( api.lang.common.undo );
undoB.appendTo( doc.getById( 'fileArea' ) );
var redoB = doc.createElement( 'button', { attributes: { "label" : api.lang.common.redo } } );
redoB.on('click', function()
{
codemirror.redo();
});
redoB.setHtml( api.lang.common.redo );
redoB.appendTo( doc.getById( 'fileArea' ) );
}
});
},
contents : [
{
id : 'tab1',
label : '',
title : '',
expand : true,
padding : 0,
elements :
[
{
type : 'html',
id : 'htmlLoader',
html : '' +
'<style type="text/css">' +
'.CodeMirror-wrapping {background:white;}' +
'</style>' +
'<div id="fileArea"></div>'
}
]
}
],
// TODO http://dev.fckeditor.net/ticket/4750
buttons : [ saveButton, CKFinder.dialog.cancelButton ]
};
} );
api.addFileContextMenuOption( { label : api.lang.Fileeditor.contextMenuName, command : "fileEditor" } , function( api, file )
{
api.openDialog( 'fileEditor' );
},
function ( file )
{
var maxSize = 1024;
if ( typeof (CKFinder.config.fileeditorMaxSize) != 'undefined' )
maxSize = CKFinder.config.fileeditorMaxSize;
// Disable for images, binary files, large files etc.
if ( isTextFile( file ) && file.size <= maxSize )
{
if ( file.folder.acl.fileDelete )
return true;
else
return -1;
}
return false;
});
} );
| JavaScript |
/**
* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*
* CKFinder 2.x - sample "dummy" plugin.
*
* To enable it, add the following line to config.js:
* config.extraPlugins = 'dummy';
*/
/**
* See http://docs.cksource.com/ckfinder_2.x_api/symbols/CKFinder.html#.addPlugin
*/
CKFinder.addPlugin( 'dummy', {
lang : [ 'en', 'pl' ],
appReady : function( api ) {
CKFinder.dialog.add( 'dummydialog', function( api )
{
// CKFinder.dialog.definition
var dialogDefinition =
{
title : api.lang.dummy.title,
minWidth : 390,
minHeight : 230,
onOk : function() {
// "this" is now a CKFinder.dialog object.
var value = this.getValueOf( 'tab1', 'textareaId' );
if ( !value ) {
api.openMsgDialog( '', api.lang.dummy.typeText );
return false;
}
else {
alert( "You have entered: " + value );
return true;
}
},
contents : [
{
id : 'tab1',
label : '',
title : '',
expand : true,
padding : 0,
elements :
[
{
type : 'html',
html : '<h3>' + api.lang.dummy.typeText + '</h3>'
},
{
type : 'textarea',
id : 'textareaId',
rows : 10,
cols : 40
}
]
}
],
buttons : [ CKFinder.dialog.cancelButton, CKFinder.dialog.okButton ]
};
return dialogDefinition;
} );
api.addFileContextMenuOption( { label : api.lang.dummy.menuItem, command : "dummycommand" } , function( api, file )
{
api.openDialog('dummydialog');
});
}
});
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKFinder.setPluginLang( 'dummy', 'pl',
{
dummy :
{
title : 'Testowe okienko',
menuItem : 'Otwórz okienko dummy',
typeText : 'Podaj jakiś tekst.'
}
});
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKFinder.setPluginLang( 'dummy', 'en',
{
dummy :
{
title : 'Dummy dialog',
menuItem : 'Open dummy dialog',
typeText : 'Please type some text.'
}
});
| JavaScript |
function com_stewartspeak_replacement(items) {
/*
Dynamic Heading Generator
By Stewart Rosenberger
http://www.stewartspeak.com/headings/
This script searches through a web page for specific or general elements
and replaces them with dynamically generated images, in conjunction with
a server-side script.
*/
var testURL = "test.png" ;
var doNotPrintImages = false;
var printerCSS = "replacement-print.css";
var hideFlicker = false;
var hideFlickerCSS = "replacement-screen.css";
var hideFlickerTimeout = 1000;
/* ---------------------------------------------------------------------------
For basic usage, you should not need to edit anything below this comment.
If you need to further customize this script's abilities, make sure
you're familiar with Javascript. And grab a soda or something.
*/
var imageLoaded = false;
var documentLoaded = false;
if(hideFlicker)
{
document.write('<link id="hide-flicker" rel="stylesheet" media="screen" href="' + hideFlickerCSS + '" />');
window.flickerCheck = function()
{
if(!imageLoaded)
setStyleSheetState('hide-flicker',false);
};
setTimeout('window.flickerCheck();',hideFlickerTimeout)
}
if(doNotPrintImages)
document.write('<link id="print-text" rel="stylesheet" media="print" href="' + printerCSS + '" />');
var test = new Image();
test.onload = function() { imageLoaded = true; if(documentLoaded) replacement(); };
test.src = testURL + "?date=" + (new Date()).getTime();
$(document).ready(function(){
replacement();
});
function replacement()
{
for(var i=0;i<items.length;i++)
{
var elements = getElementsBySelector(items[i].selector);
if(elements.length > 0) for(var j=0;j<elements.length;j++)
{
if(!elements[j])
continue ;
var text = extractText(elements[j]);
while(elements[j].hasChildNodes())
elements[j].removeChild(elements[j].firstChild);
var tokens = items[i].wordwrap ? text.split(' ') : [text] ;
for(var k=0;k<tokens.length;k++)
{
if(items[i].url.indexOf('?')==-1) {
var url = items[i].url + "?text="+escape(tokens[k]+' ')+"&selector="+escape(items[i].selector);
} else {
var url = items[i].url + "&text="+escape(tokens[k]+' ')+"&selector="+escape(items[i].selector);
}
var image = document.createElement("img");
image.className = "replacement";
image.alt = tokens[k] ;
image.src = url;
elements[j].appendChild(image);
}
if(doNotPrintImages)
{
var span = document.createElement("span");
span.style.display = 'none';
span.className = "print-text";
span.appendChild(document.createTextNode(text));
elements[j].appendChild(span);
}
}
}
if(hideFlicker)
setStyleSheetState('hide-flicker',false);
}
function addLoadHandler(handler)
{
if(window.addEventListener)
{
window.addEventListener("load",handler,false);
}
else if(window.attachEvent)
{
window.attachEvent("onload",handler);
}
else if(window.onload)
{
var oldHandler = window.onload;
window.onload = function piggyback()
{
oldHandler();
handler();
};
}
else
{
window.onload = handler;
}
}
function setStyleSheetState(id,enabled)
{
var sheet = document.getElementById(id);
if(sheet)
sheet.disabled = (!enabled);
}
function extractText(element)
{
if(typeof element == "string")
return element;
else if(typeof element == "undefined")
return element;
else if(element.innerText)
return element.innerText;
var text = "";
var kids = element.childNodes;
for(var i=0;i<kids.length;i++)
{
if(kids[i].nodeType == 1)
text += extractText(kids[i]);
else if(kids[i].nodeType == 3)
text += kids[i].nodeValue;
}
return text;
}
/*
Finds elements on page that match a given CSS selector rule. Some
complicated rules are not compatible.
Based on Simon Willison's excellent "getElementsBySelector" function.
Original code (with comments and description):
http://simon.incutio.com/archive/2003/03/25/getElementsBySelector
*/
function getElementsBySelector(selector)
{
var tokens = selector.split(' ');
var currentContext = new Array(document);
for(var i=0;i<tokens.length;i++)
{
token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');
if(token.indexOf('#') > -1)
{
var bits = token.split('#');
var tagName = bits[0];
var id = bits[1];
var element = document.getElementById(id);
if(tagName && element.nodeName.toLowerCase() != tagName)
return new Array();
currentContext = new Array(element);
continue;
}
if(token.indexOf('.') > -1)
{
var bits = token.split('.');
var tagName = bits[0];
var className = bits[1];
if(!tagName)
tagName = '*';
var found = new Array;
var foundCount = 0;
for(var h=0;h<currentContext.length;h++)
{
var elements;
if(tagName == '*')
elements = currentContext[h].all ? currentContext[h].all : currentContext[h].getElementsByTagName('*');
else
elements = currentContext[h].getElementsByTagName(tagName);
for(var j=0;j<elements.length;j++)
found[foundCount++] = elements[j];
}
currentContext = new Array;
var currentContextIndex = 0;
for(var k=0;k<found.length;k++)
{
if(found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b')))
currentContext[currentContextIndex++] = found[k];
}
continue;
}
if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/))
{
var tagName = RegExp.$1;
var attrName = RegExp.$2;
var attrOperator = RegExp.$3;
var attrValue = RegExp.$4;
if(!tagName)
tagName = '*';
var found = new Array;
var foundCount = 0;
for(var h=0;h<currentContext.length;h++)
{
var elements;
if(tagName == '*')
elements = currentContext[h].all ? currentContext[h].all : currentContext[h].getElementsByTagName('*');
else
elements = currentContext[h].getElementsByTagName(tagName);
for(var j=0;j<elements.length;j++)
found[foundCount++] = elements[j];
}
currentContext = new Array;
var currentContextIndex = 0;
var checkFunction;
switch(attrOperator)
{
case '=':
checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
break;
case '~':
checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
break;
case '|':
checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
break;
case '^':
checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
break;
case '$':
checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
break;
case '*':
checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
break;
default :
checkFunction = function(e) { return e.getAttribute(attrName); };
}
currentContext = new Array;
var currentContextIndex = 0;
for(var k=0;k<found.length;k++)
{
if(checkFunction(found[k]))
currentContext[currentContextIndex++] = found[k];
}
continue;
}
tagName = token;
var found = new Array;
var foundCount = 0;
for(var h=0;h<currentContext.length;h++)
{
var elements = currentContext[h].getElementsByTagName(tagName);
for(var j=0;j<elements.length; j++)
found[foundCount++] = elements[j];
}
currentContext = found;
}
return currentContext;
}
}// end of scope, execute code
function replaceSelector(selector,url,wordwrap)
{
if(typeof items == "undefined")
items = new Array();
items[items.length] = {selector: selector, url: url, wordwrap: wordwrap};
} | JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.skins.add( 'kama', (function()
{
var uiColorStylesheetId = 'cke_ui_color';
return {
editor : { css : [ 'editor.css' ] },
dialog : { css : [ 'dialog.css' ] },
richcombo : { canGroup: false },
templates : { css : [ 'templates.css' ] },
margins : [ 0, 0, 0, 0 ],
init : function( editor )
{
if ( editor.config.width && !isNaN( editor.config.width ) )
editor.config.width -= 12;
var uiColorMenus = [];
var uiColorRegex = /\$color/g;
var uiColorMenuCss = "/* UI Color Support */\
.cke_skin_kama .cke_menuitem .cke_icon_wrapper\
{\
background-color: $color !important;\
border-color: $color !important;\
}\
\
.cke_skin_kama .cke_menuitem a:hover .cke_icon_wrapper,\
.cke_skin_kama .cke_menuitem a:focus .cke_icon_wrapper,\
.cke_skin_kama .cke_menuitem a:active .cke_icon_wrapper\
{\
background-color: $color !important;\
border-color: $color !important;\
}\
\
.cke_skin_kama .cke_menuitem a:hover .cke_label,\
.cke_skin_kama .cke_menuitem a:focus .cke_label,\
.cke_skin_kama .cke_menuitem a:active .cke_label\
{\
background-color: $color !important;\
}\
\
.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_label,\
.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_label,\
.cke_skin_kama .cke_menuitem a.cke_disabled:active .cke_label\
{\
background-color: transparent !important;\
}\
\
.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_icon_wrapper,\
.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_icon_wrapper,\
.cke_skin_kama .cke_menuitem a.cke_disabled:active .cke_icon_wrapper\
{\
background-color: $color !important;\
border-color: $color !important;\
}\
\
.cke_skin_kama .cke_menuitem a.cke_disabled .cke_icon_wrapper\
{\
background-color: $color !important;\
border-color: $color !important;\
}\
\
.cke_skin_kama .cke_menuseparator\
{\
background-color: $color !important;\
}\
\
.cke_skin_kama .cke_menuitem a:hover,\
.cke_skin_kama .cke_menuitem a:focus,\
.cke_skin_kama .cke_menuitem a:active\
{\
background-color: $color !important;\
}";
// We have to split CSS declarations for webkit.
if ( CKEDITOR.env.webkit )
{
uiColorMenuCss = uiColorMenuCss.split( '}' ).slice( 0, -1 );
for ( var i = 0 ; i < uiColorMenuCss.length ; i++ )
uiColorMenuCss[ i ] = uiColorMenuCss[ i ].split( '{' );
}
function getStylesheet( document )
{
var node = document.getById( uiColorStylesheetId );
if ( !node )
{
node = document.getHead().append( 'style' );
node.setAttribute( "id", uiColorStylesheetId );
node.setAttribute( "type", "text/css" );
}
return node;
}
function updateStylesheets( styleNodes, styleContent, replace )
{
var r, i, content;
for ( var id = 0 ; id < styleNodes.length ; id++ )
{
if ( CKEDITOR.env.webkit )
{
for ( i = 0 ; i < styleContent.length ; i++ )
{
content = styleContent[ i ][ 1 ];
for ( r = 0 ; r < replace.length ; r++ )
content = content.replace( replace[ r ][ 0 ], replace[ r ][ 1 ] );
styleNodes[ id ].$.sheet.addRule( styleContent[ i ][ 0 ], content );
}
}
else
{
content = styleContent;
for ( r = 0 ; r < replace.length ; r++ )
content = content.replace( replace[ r ][ 0 ], replace[ r ][ 1 ] );
if ( CKEDITOR.env.ie )
styleNodes[ id ].$.styleSheet.cssText += content;
else
styleNodes[ id ].$.innerHTML += content;
}
}
}
var uiColorRegexp = /\$color/g;
CKEDITOR.tools.extend( editor,
{
uiColor: null,
getUiColor : function()
{
return this.uiColor;
},
setUiColor : function( color )
{
var cssContent,
uiStyle = getStylesheet( CKEDITOR.document ),
cssId = '.' + editor.id;
var cssSelectors =
[
cssId + " .cke_wrapper",
cssId + "_dialog .cke_dialog_contents",
cssId + "_dialog a.cke_dialog_tab",
cssId + "_dialog .cke_dialog_footer"
].join( ',' );
var cssProperties = "background-color: $color !important;";
if ( CKEDITOR.env.webkit )
cssContent = [ [ cssSelectors, cssProperties ] ];
else
cssContent = cssSelectors + '{' + cssProperties + '}';
return ( this.setUiColor =
function( color )
{
var replace = [ [ uiColorRegexp, color ] ];
editor.uiColor = color;
// Update general style.
updateStylesheets( [ uiStyle ], cssContent, replace );
// Update menu styles.
updateStylesheets( uiColorMenus, uiColorMenuCss, replace );
})( color );
}
});
editor.on( 'menuShow', function( event )
{
var panel = event.data[ 0 ];
var iframe = panel.element.getElementsByTag( 'iframe' ).getItem( 0 ).getFrameDocument();
// Add stylesheet if missing.
if ( !iframe.getById( 'cke_ui_color' ) )
{
var node = getStylesheet( iframe );
uiColorMenus.push( node );
var color = editor.getUiColor();
// Set uiColor for new menu.
if ( color )
updateStylesheets( [ node ], uiColorMenuCss, [ [ uiColorRegexp, color ] ] );
}
});
// Apply UI color if specified in config.
if ( editor.config.uiColor )
editor.setUiColor( editor.config.uiColor );
}
};
})() );
(function()
{
CKEDITOR.dialog ? dialogSetup() : CKEDITOR.on( 'dialogPluginReady', dialogSetup );
function dialogSetup()
{
CKEDITOR.dialog.on( 'resize', function( evt )
{
var data = evt.data,
width = data.width,
height = data.height,
dialog = data.dialog,
contents = dialog.parts.contents;
if ( data.skin != 'kama' )
return;
contents.setStyles(
{
width : width + 'px',
height : height + 'px'
});
});
}
})();
/**
* The base user interface color to be used by the editor. Not all skins are
* compatible with this setting.
* @name CKEDITOR.config.uiColor
* @type String
* @default '' (empty)
* @example
* // Using a color code.
* config.uiColor = '#AADC6E';
* @example
* // Using an HTML color name.
* config.uiColor = 'Gold';
*/
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.skins.add( 'v2', (function()
{
return {
editor : { css : [ 'editor.css' ] },
dialog : { css : [ 'dialog.css' ] },
separator : { canGroup: false },
templates : { css : [ 'templates.css' ] },
margins : [ 0, 14, 18, 14 ]
};
})() );
(function()
{
CKEDITOR.dialog ? dialogSetup() : CKEDITOR.on( 'dialogPluginReady', dialogSetup );
function dialogSetup()
{
CKEDITOR.dialog.on( 'resize', function( evt )
{
var data = evt.data,
width = data.width,
height = data.height,
dialog = data.dialog,
contents = dialog.parts.contents;
if ( data.skin != 'v2' )
return;
contents.setStyles(
{
width : width + 'px',
height : height + 'px'
});
if ( !CKEDITOR.env.ie || CKEDITOR.env.ie9Compat )
return;
// Fix the size of the elements which have flexible lengths.
setTimeout( function()
{
var innerDialog = dialog.parts.dialog.getChild( [ 0, 0, 0 ] ),
body = innerDialog.getChild( 0 ),
bodyWidth = body.getSize( 'width' );
height += body.getChild( 0 ).getSize( 'height' ) + 1;
// tc
var el = innerDialog.getChild( 2 );
el.setSize( 'width', bodyWidth );
// bc
el = innerDialog.getChild( 7 );
el.setSize( 'width', bodyWidth - 28 );
// ml
el = innerDialog.getChild( 4 );
el.setSize( 'height', height );
// mr
el = innerDialog.getChild( 5 );
el.setSize( 'height', height );
},
100 );
});
}
})();
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.skins.add( 'office2003', (function()
{
return {
editor : { css : [ 'editor.css' ] },
dialog : { css : [ 'dialog.css' ] },
separator : { canGroup: false },
templates : { css : [ 'templates.css' ] },
margins : [ 0, 14, 18, 14 ]
};
})() );
(function()
{
CKEDITOR.dialog ? dialogSetup() : CKEDITOR.on( 'dialogPluginReady', dialogSetup );
function dialogSetup()
{
CKEDITOR.dialog.on( 'resize', function( evt )
{
var data = evt.data,
width = data.width,
height = data.height,
dialog = data.dialog,
contents = dialog.parts.contents;
if ( data.skin != 'office2003' )
return;
contents.setStyles(
{
width : width + 'px',
height : height + 'px'
});
if ( !CKEDITOR.env.ie || CKEDITOR.env.ie9Compat )
return;
// Fix the size of the elements which have flexible lengths.
var fixSize = function()
{
var innerDialog = dialog.parts.dialog.getChild( [ 0, 0, 0 ] ),
body = innerDialog.getChild( 0 ),
bodyWidth = body.getSize( 'width' );
height += body.getChild( 0 ).getSize( 'height' ) + 1;
// tc
var el = innerDialog.getChild( 2 );
el.setSize( 'width', bodyWidth );
// bc
el = innerDialog.getChild( 7 );
el.setSize( 'width', bodyWidth - 28 );
// ml
el = innerDialog.getChild( 4 );
el.setSize( 'height', height );
// mr
el = innerDialog.getChild( 5 );
el.setSize( 'height', height );
};
setTimeout( fixSize, 100 );
// Ensure size is correct for RTL mode. (#4003)
if ( evt.editor.lang.dir == 'rtl' )
setTimeout( fixSize, 1000 );
});
}
})();
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Contains the second part of the {@link CKEDITOR} object
* definition, which defines the basic editor features to be available in
* the root ckeditor_basic.js file.
*/
if ( CKEDITOR.status == 'unloaded' )
{
(function()
{
CKEDITOR.event.implementOn( CKEDITOR );
/**
* Forces the full CKEditor core code, in the case only the basic code has been
* loaded (ckeditor_basic.js). This method self-destroys (becomes undefined) in
* the first call or as soon as the full code is available.
* @example
* // Check if the full core code has been loaded and load it.
* if ( CKEDITOR.loadFullCore )
* <b>CKEDITOR.loadFullCore()</b>;
*/
CKEDITOR.loadFullCore = function()
{
// If not the basic code is not ready it, just mark it to be loaded.
if ( CKEDITOR.status != 'basic_ready' )
{
CKEDITOR.loadFullCore._load = 1;
return;
}
// Destroy this function.
delete CKEDITOR.loadFullCore;
// Append the script to the head.
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = CKEDITOR.basePath + 'ckeditor.js';
document.getElementsByTagName( 'head' )[0].appendChild( script );
};
/**
* The time to wait (in seconds) to load the full editor code after the
* page load, if the "ckeditor_basic" file is used. If set to zero, the
* editor is loaded on demand, as soon as an instance is created.
*
* This value must be set on the page before the page load completion.
* @type Number
* @default 0 (zero)
* @example
* // Loads the full source after five seconds.
* CKEDITOR.loadFullCoreTimeout = 5;
*/
CKEDITOR.loadFullCoreTimeout = 0;
/**
* The class name used to identify <textarea> elements to be replace
* by CKEditor instances.
* @type String
* @default 'ckeditor'
* @example
* <b>CKEDITOR.replaceClass</b> = 'rich_editor';
*/
CKEDITOR.replaceClass = 'ckeditor';
/**
* Enables the replacement of all textareas with class name matching
* {@link CKEDITOR.replaceClass}.
* @type Boolean
* @default true
* @example
* // Disable the auto-replace feature.
* <b>CKEDITOR.replaceByClassEnabled</b> = false;
*/
CKEDITOR.replaceByClassEnabled = 1;
var createInstance = function( elementOrIdOrName, config, creationFunction, data )
{
if ( CKEDITOR.env.isCompatible )
{
// Load the full core.
if ( CKEDITOR.loadFullCore )
CKEDITOR.loadFullCore();
var editor = creationFunction( elementOrIdOrName, config, data );
CKEDITOR.add( editor );
return editor;
}
return null;
};
/**
* Replaces a <textarea> or a DOM element (DIV) with a CKEditor
* instance. For textareas, the initial value in the editor will be the
* textarea value. For DOM elements, their innerHTML will be used
* instead. We recommend using TEXTAREA and DIV elements only.
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
* ID or name.
* @param {Object} [config] The specific configurations to apply to this
* editor instance. Configurations set here will override global CKEditor
* settings.
* @returns {CKEDITOR.editor} The editor instance created.
* @example
* <textarea id="myfield" name="myfield"><:/textarea>
* ...
* <b>CKEDITOR.replace( 'myfield' )</b>;
* @example
* var textarea = document.body.appendChild( document.createElement( 'textarea' ) );
* <b>CKEDITOR.replace( textarea )</b>;
*/
CKEDITOR.replace = function( elementOrIdOrName, config )
{
return createInstance( elementOrIdOrName, config, CKEDITOR.editor.replace );
};
/**
* Creates a new editor instance inside a specific DOM element.
* @param {Object|String} elementOrId The DOM element or its ID.
* @param {Object} [config] The specific configurations to apply to this
* editor instance. Configurations set here will override global CKEditor
* settings.
* @param {String} [data] Since 3.3. Initial value for the instance.
* @returns {CKEDITOR.editor} The editor instance created.
* @example
* <div id="editorSpace"><:/div>
* ...
* <b>CKEDITOR.appendTo( 'editorSpace' )</b>;
*/
CKEDITOR.appendTo = function( elementOrId, config, data )
{
return createInstance( elementOrId, config, CKEDITOR.editor.appendTo, data );
};
// Documented at ckeditor.js.
CKEDITOR.add = function( editor )
{
// For now, just put the editor in the pending list. It will be
// processed as soon as the full code gets loaded.
var pending = this._.pending || ( this._.pending = [] );
pending.push( editor );
};
/**
* Replace all <textarea> elements available in the document with
* editor instances.
* @example
* // Replace all <textarea> elements in the page.
* CKEDITOR.replaceAll();
* @example
* // Replace all <textarea class="myClassName"> elements in the page.
* CKEDITOR.replaceAll( 'myClassName' );
* @example
* // Selectively replace <textarea> elements, based on custom assertions.
* CKEDITOR.replaceAll( function( textarea, config )
* {
* // Custom code to evaluate the replace, returning false
* // if it must not be done.
* // It also passes the "config" parameter, so the
* // developer can customize the instance.
* } );
*/
CKEDITOR.replaceAll = function()
{
var textareas = document.getElementsByTagName( 'textarea' );
for ( var i = 0 ; i < textareas.length ; i++ )
{
var config = null,
textarea = textareas[i];
// The "name" and/or "id" attribute must exist.
if ( !textarea.name && !textarea.id )
continue;
if ( typeof arguments[0] == 'string' )
{
// The textarea class name could be passed as the function
// parameter.
var classRegex = new RegExp( '(?:^|\\s)' + arguments[0] + '(?:$|\\s)' );
if ( !classRegex.test( textarea.className ) )
continue;
}
else if ( typeof arguments[0] == 'function' )
{
// An assertion function could be passed as the function parameter.
// It must explicitly return "false" to ignore a specific <textarea>.
config = {};
if ( arguments[0]( textarea, config ) === false )
continue;
}
this.replace( textarea, config );
}
};
(function()
{
var onload = function()
{
var loadFullCore = CKEDITOR.loadFullCore,
loadFullCoreTimeout = CKEDITOR.loadFullCoreTimeout;
// Replace all textareas with the default class name.
if ( CKEDITOR.replaceByClassEnabled )
CKEDITOR.replaceAll( CKEDITOR.replaceClass );
CKEDITOR.status = 'basic_ready';
if ( loadFullCore && loadFullCore._load )
loadFullCore();
else if ( loadFullCoreTimeout )
{
setTimeout( function()
{
if ( CKEDITOR.loadFullCore )
CKEDITOR.loadFullCore();
}
, loadFullCoreTimeout * 1000 );
}
};
if ( window.addEventListener )
window.addEventListener( 'load', onload, false );
else if ( window.attachEvent )
window.attachEvent( 'onload', onload );
})();
CKEDITOR.status = 'basic_loaded';
})();
}
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.dtd} object, which holds the DTD
* mapping for XHTML 1.0 Transitional. This file was automatically
* generated from the file: xhtml1-transitional.dtd.
*/
/**
* @namespace Holds and object representation of the HTML DTD to be used by the
* editor in its internal operations.<br />
* <br />
* Each element in the DTD is represented by a property in this object. Each
* property contains the list of elements that can be contained by the element.
* Text is represented by the "#" property.<br />
* <br />
* Several special grouping properties are also available. Their names start
* with the "$" character.
* @example
* // Check if "div" can be contained in a "p" element.
* alert( !!CKEDITOR.dtd[ 'p' ][ 'div' ] ); "false"
* @example
* // Check if "p" can be contained in a "div" element.
* alert( !!CKEDITOR.dtd[ 'div' ][ 'p' ] ); "true"
* @example
* // Check if "p" is a block element.
* alert( !!CKEDITOR.dtd.$block[ 'p' ] ); "true"
*/
CKEDITOR.dtd = (function()
{
var X = CKEDITOR.tools.extend,
A = {isindex:1,fieldset:1},
B = {input:1,button:1,select:1,textarea:1,label:1},
C = X({a:1},B),
D = X({iframe:1},C),
E = {hr:1,ul:1,menu:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,mark:1,time:1,meter:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1},
F = {ins:1,del:1,script:1,style:1},
G = X({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1,wbr:1},F),
H = X({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1,mark:1},G),
I = X({p:1},H),
J = X({iframe:1},H,B),
K = {img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,mark:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1},
L = X({a:1},J),
M = {tr:1},
N = {'#':1},
O = X({param:1},K),
P = X({form:1},A,D,E,I),
Q = {li:1},
R = {style:1,script:1},
S = {base:1,link:1,meta:1,title:1},
T = X(S,R),
U = {head:1,body:1},
V = {html:1};
var block = {address:1,blockquote:1,center:1,dir:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1};
return /** @lends CKEDITOR.dtd */ {
// The "$" items have been added manually.
// List of elements living outside body.
$nonBodyContent: X(V,U,S),
/**
* List of block elements, like "p" or "div".
* @type Object
* @example
*/
$block : block,
/**
* List of block limit elements.
* @type Object
* @example
*/
$blockLimit : { body:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,td:1,th:1,caption:1,form:1 },
/**
* List of inline (<span> like) elements.
*/
$inline : L, // Just like span.
/**
* list of elements that can be children at <body>.
*/
$body : X({script:1,style:1}, block),
$cdata : {script:1,style:1},
/**
* List of empty (self-closing) elements, like "br" or "img".
* @type Object
* @example
*/
$empty : {area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1,wbr:1},
/**
* List of list item elements, like "li" or "dd".
* @type Object
* @example
*/
$listItem : {dd:1,dt:1,li:1},
/**
* List of list root elements.
* @type Object
* @example
*/
$list: {ul:1,ol:1,dl:1},
/**
* Elements that accept text nodes, but are not possible to edit into
* the browser.
* @type Object
* @example
*/
$nonEditable : {applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1,param:1,audio:1,video:1},
/**
* List of block tags with each one a singleton element lives in the corresponding structure for description.
*/
$captionBlock : { caption:1, legend:1 },
/**
* List of elements that can be ignored if empty, like "b" or "span".
* @type Object
* @example
*/
$removeEmpty : {abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1,mark:1},
/**
* List of elements that have tabindex set to zero by default.
* @type Object
* @example
*/
$tabIndex : {a:1,area:1,button:1,input:1,object:1,select:1,textarea:1},
/**
* List of elements used inside the "table" element, like "tbody" or "td".
* @type Object
* @example
*/
$tableContent : {caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1},
html: U,
head: T,
style: N,
script: N,
body: P,
base: {},
link: {},
meta: {},
title: N,
col : {},
tr : {td:1,th:1},
img : {},
colgroup : {col:1},
noscript : P,
td : P,
br : {},
wbr : {},
th : P,
center : P,
kbd : L,
button : X(I,E),
basefont : {},
h5 : L,
h4 : L,
samp : L,
h6 : L,
ol : Q,
h1 : L,
h3 : L,
option : N,
h2 : L,
form : X(A,D,E,I),
select : {optgroup:1,option:1},
font : L,
ins : L,
menu : Q,
abbr : L,
label : L,
table : {thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1},
code : L,
tfoot : M,
cite : L,
li : P,
input : {},
iframe : P,
strong : L,
textarea : N,
noframes : P,
big : L,
small : L,
span : L,
hr : {},
dt : L,
sub : L,
optgroup : {option:1},
param : {},
bdo : L,
'var' : L,
div : P,
object : O,
sup : L,
dd : P,
strike : L,
area : {},
dir : Q,
map : X({area:1,form:1,p:1},A,F,E),
applet : O,
dl : {dt:1,dd:1},
del : L,
isindex : {},
fieldset : X({legend:1},K),
thead : M,
ul : Q,
acronym : L,
b : L,
a : J,
blockquote : P,
caption : L,
i : L,
u : L,
tbody : M,
s : L,
address : X(D,I),
tt : L,
legend : L,
q : L,
pre : X(G,C),
p : L,
em : L,
dfn : L,
//HTML5
section : P,
header : P,
footer : P,
nav : P,
article : P,
aside : P,
figure: P,
dialog : P,
hgroup : P,
mark : L,
time : L,
meter : L,
menu : L,
command : L,
keygen : L,
output : L,
progress : O,
audio : O,
video : O,
details : O,
datagrid : O,
datalist : O
};
})();
// PACKAGER_RENAME( CKEDITOR.dtd )
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* Creates a {@link CKEDITOR.htmlParser} class instance.
* @class Provides an "event like" system to parse strings of HTML data.
* @example
* var parser = new CKEDITOR.htmlParser();
* parser.onTagOpen = function( tagName, attributes, selfClosing )
* {
* alert( tagName );
* };
* parser.parse( '<p>Some <b>text</b>.</p>' );
*/
CKEDITOR.htmlParser = function()
{
this._ =
{
htmlPartsRegex : new RegExp( '<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:"[^"]*")|(?:\'[^\']*\')|[^"\'>])*)\\/?>))', 'g' )
};
};
(function()
{
var attribsRegex = /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,
emptyAttribs = {checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1};
CKEDITOR.htmlParser.prototype =
{
/**
* Function to be fired when a tag opener is found. This function
* should be overriden when using this class.
* @param {String} tagName The tag name. The name is guarantted to be
* lowercased.
* @param {Object} attributes An object containing all tag attributes. Each
* property in this object represent and attribute name and its
* value is the attribute value.
* @param {Boolean} selfClosing true if the tag closes itself, false if the
* tag doesn't.
* @example
* var parser = new CKEDITOR.htmlParser();
* parser.onTagOpen = function( tagName, attributes, selfClosing )
* {
* alert( tagName ); // e.g. "b"
* });
* parser.parse( "<!-- Example --><b>Hello</b>" );
*/
onTagOpen : function() {},
/**
* Function to be fired when a tag closer is found. This function
* should be overriden when using this class.
* @param {String} tagName The tag name. The name is guarantted to be
* lowercased.
* @example
* var parser = new CKEDITOR.htmlParser();
* parser.onTagClose = function( tagName )
* {
* alert( tagName ); // e.g. "b"
* });
* parser.parse( "<!-- Example --><b>Hello</b>" );
*/
onTagClose : function() {},
/**
* Function to be fired when text is found. This function
* should be overriden when using this class.
* @param {String} text The text found.
* @example
* var parser = new CKEDITOR.htmlParser();
* parser.onText = function( text )
* {
* alert( text ); // e.g. "Hello"
* });
* parser.parse( "<!-- Example --><b>Hello</b>" );
*/
onText : function() {},
/**
* Function to be fired when CDATA section is found. This function
* should be overriden when using this class.
* @param {String} cdata The CDATA been found.
* @example
* var parser = new CKEDITOR.htmlParser();
* parser.onCDATA = function( cdata )
* {
* alert( cdata ); // e.g. "var hello;"
* });
* parser.parse( "<script>var hello;</script>" );
*/
onCDATA : function() {},
/**
* Function to be fired when a commend is found. This function
* should be overriden when using this class.
* @param {String} comment The comment text.
* @example
* var parser = new CKEDITOR.htmlParser();
* parser.onComment = function( comment )
* {
* alert( comment ); // e.g. " Example "
* });
* parser.parse( "<!-- Example --><b>Hello</b>" );
*/
onComment : function() {},
/**
* Parses text, looking for HTML tokens, like tag openers or closers,
* or comments. This function fires the onTagOpen, onTagClose, onText
* and onComment function during its execution.
* @param {String} html The HTML to be parsed.
* @example
* var parser = new CKEDITOR.htmlParser();
* // The onTagOpen, onTagClose, onText and onComment should be overriden
* // at this point.
* parser.parse( "<!-- Example --><b>Hello</b>" );
*/
parse : function( html )
{
var parts,
tagName,
nextIndex = 0,
cdata; // The collected data inside a CDATA section.
while ( ( parts = this._.htmlPartsRegex.exec( html ) ) )
{
var tagIndex = parts.index;
if ( tagIndex > nextIndex )
{
var text = html.substring( nextIndex, tagIndex );
if ( cdata )
cdata.push( text );
else
this.onText( text );
}
nextIndex = this._.htmlPartsRegex.lastIndex;
/*
"parts" is an array with the following items:
0 : The entire match for opening/closing tags and comments.
1 : Group filled with the tag name for closing tags.
2 : Group filled with the comment text.
3 : Group filled with the tag name for opening tags.
4 : Group filled with the attributes part of opening tags.
*/
// Closing tag
if ( ( tagName = parts[ 1 ] ) )
{
tagName = tagName.toLowerCase();
if ( cdata && CKEDITOR.dtd.$cdata[ tagName ] )
{
// Send the CDATA data.
this.onCDATA( cdata.join('') );
cdata = null;
}
if ( !cdata )
{
this.onTagClose( tagName );
continue;
}
}
// If CDATA is enabled, just save the raw match.
if ( cdata )
{
cdata.push( parts[ 0 ] );
continue;
}
// Opening tag
if ( ( tagName = parts[ 3 ] ) )
{
tagName = tagName.toLowerCase();
// There are some tag names that can break things, so let's
// simply ignore them when parsing. (#5224)
if ( /="/.test( tagName ) )
continue;
var attribs = {},
attribMatch,
attribsPart = parts[ 4 ],
selfClosing = !!( attribsPart && attribsPart.charAt( attribsPart.length - 1 ) == '/' );
if ( attribsPart )
{
while ( ( attribMatch = attribsRegex.exec( attribsPart ) ) )
{
var attName = attribMatch[1].toLowerCase(),
attValue = attribMatch[2] || attribMatch[3] || attribMatch[4] || '';
if ( !attValue && emptyAttribs[ attName ] )
attribs[ attName ] = attName;
else
attribs[ attName ] = attValue;
}
}
this.onTagOpen( tagName, attribs, selfClosing );
// Open CDATA mode when finding the appropriate tags.
if ( !cdata && CKEDITOR.dtd.$cdata[ tagName ] )
cdata = [];
continue;
}
// Comment
if ( ( tagName = parts[ 2 ] ) )
this.onComment( tagName );
}
if ( html.length > nextIndex )
this.onText( html.substring( nextIndex, html.length ) );
}
};
})();
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.resourceManager} class, which is
* the base for resource managers, like plugins and themes.
*/
/**
* Base class for resource managers, like plugins and themes. This class is not
* intended to be used out of the CKEditor core code.
* @param {String} basePath The path for the resources folder.
* @param {String} fileName The name used for resource files.
* @namespace
* @example
*/
CKEDITOR.resourceManager = function( basePath, fileName )
{
/**
* The base directory containing all resources.
* @name CKEDITOR.resourceManager.prototype.basePath
* @type String
* @example
*/
this.basePath = basePath;
/**
* The name used for resource files.
* @name CKEDITOR.resourceManager.prototype.fileName
* @type String
* @example
*/
this.fileName = fileName;
/**
* Contains references to all resources that have already been registered
* with {@link #add}.
* @name CKEDITOR.resourceManager.prototype.registered
* @type Object
* @example
*/
this.registered = {};
/**
* Contains references to all resources that have already been loaded
* with {@link #load}.
* @name CKEDITOR.resourceManager.prototype.loaded
* @type Object
* @example
*/
this.loaded = {};
/**
* Contains references to all resources that have already been registered
* with {@link #addExternal}.
* @name CKEDITOR.resourceManager.prototype.externals
* @type Object
* @example
*/
this.externals = {};
/**
* @private
*/
this._ =
{
// List of callbacks waiting for plugins to be loaded.
waitingList : {}
};
};
CKEDITOR.resourceManager.prototype =
{
/**
* Registers a resource.
* @param {String} name The resource name.
* @param {Object} [definition] The resource definition.
* @example
* CKEDITOR.plugins.add( 'sample', { ... plugin definition ... } );
* @see CKEDITOR.pluginDefinition
*/
add : function( name, definition )
{
if ( this.registered[ name ] )
throw '[CKEDITOR.resourceManager.add] The resource name "' + name + '" is already registered.';
CKEDITOR.fire( name + CKEDITOR.tools.capitalize( this.fileName ) + 'Ready',
this.registered[ name ] = definition || {} );
},
/**
* Gets the definition of a specific resource.
* @param {String} name The resource name.
* @type Object
* @example
* var definition = <b>CKEDITOR.plugins.get( 'sample' )</b>;
*/
get : function( name )
{
return this.registered[ name ] || null;
},
/**
* Get the folder path for a specific loaded resource.
* @param {String} name The resource name.
* @type String
* @example
* alert( <b>CKEDITOR.plugins.getPath( 'sample' )</b> ); // "<editor path>/plugins/sample/"
*/
getPath : function( name )
{
var external = this.externals[ name ];
return CKEDITOR.getUrl( ( external && external.dir ) || this.basePath + name + '/' );
},
/**
* Get the file path for a specific loaded resource.
* @param {String} name The resource name.
* @type String
* @example
* alert( <b>CKEDITOR.plugins.getFilePath( 'sample' )</b> ); // "<editor path>/plugins/sample/plugin.js"
*/
getFilePath : function( name )
{
var external = this.externals[ name ];
return CKEDITOR.getUrl(
this.getPath( name ) +
( ( external && ( typeof external.file == 'string' ) ) ? external.file : this.fileName + '.js' ) );
},
/**
* Registers one or more resources to be loaded from an external path
* instead of the core base path.
* @param {String} names The resource names, separated by commas.
* @param {String} path The path of the folder containing the resource.
* @param {String} [fileName] The resource file name. If not provided, the
* default name is used; If provided with a empty string, will implicitly indicates that {@param path}
* is already the full path.
* @example
* // Loads a plugin from '/myplugin/samples/plugin.js'.
* CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/' );
* @example
* // Loads a plugin from '/myplugin/samples/my_plugin.js'.
* CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/', 'my_plugin.js' );
* @example
* // Loads a plugin from '/myplugin/samples/my_plugin.js'.
* CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/my_plugin.js', '' );
*/
addExternal : function( names, path, fileName )
{
names = names.split( ',' );
for ( var i = 0 ; i < names.length ; i++ )
{
var name = names[ i ];
this.externals[ name ] =
{
dir : path,
file : fileName
};
}
},
/**
* Loads one or more resources.
* @param {String|Array} name The name of the resource to load. It may be a
* string with a single resource name, or an array with several names.
* @param {Function} callback A function to be called when all resources
* are loaded. The callback will receive an array containing all
* loaded names.
* @param {Object} [scope] The scope object to be used for the callback
* call.
* @example
* <b>CKEDITOR.plugins.load</b>( 'myplugin', function( plugins )
* {
* alert( plugins['myplugin'] ); // "object"
* });
*/
load : function( names, callback, scope )
{
// Ensure that we have an array of names.
if ( !CKEDITOR.tools.isArray( names ) )
names = names ? [ names ] : [];
var loaded = this.loaded,
registered = this.registered,
urls = [],
urlsNames = {},
resources = {};
// Loop through all names.
for ( var i = 0 ; i < names.length ; i++ )
{
var name = names[ i ];
if ( !name )
continue;
// If not available yet.
if ( !loaded[ name ] && !registered[ name ] )
{
var url = this.getFilePath( name );
urls.push( url );
if ( !( url in urlsNames ) )
urlsNames[ url ] = [];
urlsNames[ url ].push( name );
}
else
resources[ name ] = this.get( name );
}
CKEDITOR.scriptLoader.load( urls, function( completed, failed )
{
if ( failed.length )
{
throw '[CKEDITOR.resourceManager.load] Resource name "' + urlsNames[ failed[ 0 ] ].join( ',' )
+ '" was not found at "' + failed[ 0 ] + '".';
}
for ( var i = 0 ; i < completed.length ; i++ )
{
var nameList = urlsNames[ completed[ i ] ];
for ( var j = 0 ; j < nameList.length ; j++ )
{
var name = nameList[ j ];
resources[ name ] = this.get( name );
loaded[ name ] = 1;
}
}
callback.call( scope, resources );
}
, this);
}
};
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.event} class, which serves as the
* base for classes and objects that require event handling features.
*/
if ( !CKEDITOR.event )
{
/**
* Creates an event class instance. This constructor is rearely used, being
* the {@link #.implementOn} function used in class prototypes directly
* instead.
* @class This is a base class for classes and objects that require event
* handling features.<br />
* <br />
* Do not confuse this class with {@link CKEDITOR.dom.event} which is
* instead used for DOM events. The CKEDITOR.event class implements the
* internal event system used by the CKEditor to fire API related events.
* @example
*/
CKEDITOR.event = function()
{};
/**
* Implements the {@link CKEDITOR.event} features in an object.
* @param {Object} targetObject The object into which implement the features.
* @example
* var myObject = { message : 'Example' };
* <b>CKEDITOR.event.implementOn( myObject }</b>;
* myObject.on( 'testEvent', function()
* {
* alert( this.message ); // "Example"
* });
* myObject.fire( 'testEvent' );
*/
CKEDITOR.event.implementOn = function( targetObject )
{
var eventProto = CKEDITOR.event.prototype;
for ( var prop in eventProto )
{
if ( targetObject[ prop ] == undefined )
targetObject[ prop ] = eventProto[ prop ];
}
};
CKEDITOR.event.prototype = (function()
{
// Returns the private events object for a given object.
var getPrivate = function( obj )
{
var _ = ( obj.getPrivate && obj.getPrivate() ) || obj._ || ( obj._ = {} );
return _.events || ( _.events = {} );
};
var eventEntry = function( eventName )
{
this.name = eventName;
this.listeners = [];
};
eventEntry.prototype =
{
// Get the listener index for a specified function.
// Returns -1 if not found.
getListenerIndex : function( listenerFunction )
{
for ( var i = 0, listeners = this.listeners ; i < listeners.length ; i++ )
{
if ( listeners[i].fn == listenerFunction )
return i;
}
return -1;
}
};
return /** @lends CKEDITOR.event.prototype */ {
/**
* Registers a listener to a specific event in the current object.
* @param {String} eventName The event name to which listen.
* @param {Function} listenerFunction The function listening to the
* event. A single {@link CKEDITOR.eventInfo} object instanced
* is passed to this function containing all the event data.
* @param {Object} [scopeObj] The object used to scope the listener
* call (the this object. If omitted, the current object is used.
* @param {Object} [listenerData] Data to be sent as the
* {@link CKEDITOR.eventInfo#listenerData} when calling the
* listener.
* @param {Number} [priority] The listener priority. Lower priority
* listeners are called first. Listeners with the same priority
* value are called in registration order. Defaults to 10.
* @example
* someObject.on( 'someEvent', function()
* {
* alert( this == someObject ); // "true"
* });
* @example
* someObject.on( 'someEvent', function()
* {
* alert( this == anotherObject ); // "true"
* }
* , anotherObject );
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( event.listenerData ); // "Example"
* }
* , null, 'Example' );
* @example
* someObject.on( 'someEvent', function() { ... } ); // 2nd called
* someObject.on( 'someEvent', function() { ... }, null, null, 100 ); // 3rd called
* someObject.on( 'someEvent', function() { ... }, null, null, 1 ); // 1st called
*/
on : function( eventName, listenerFunction, scopeObj, listenerData, priority )
{
// Get the event entry (create it if needed).
var events = getPrivate( this ),
event = events[ eventName ] || ( events[ eventName ] = new eventEntry( eventName ) );
if ( event.getListenerIndex( listenerFunction ) < 0 )
{
// Get the listeners.
var listeners = event.listeners;
// Fill the scope.
if ( !scopeObj )
scopeObj = this;
// Default the priority, if needed.
if ( isNaN( priority ) )
priority = 10;
var me = this;
// Create the function to be fired for this listener.
var listenerFirer = function( editor, publisherData, stopFn, cancelFn )
{
var ev =
{
name : eventName,
sender : this,
editor : editor,
data : publisherData,
listenerData : listenerData,
stop : stopFn,
cancel : cancelFn,
removeListener : function()
{
me.removeListener( eventName, listenerFunction );
}
};
listenerFunction.call( scopeObj, ev );
return ev.data;
};
listenerFirer.fn = listenerFunction;
listenerFirer.priority = priority;
// Search for the right position for this new listener, based on its
// priority.
for ( var i = listeners.length - 1 ; i >= 0 ; i-- )
{
// Find the item which should be before the new one.
if ( listeners[ i ].priority <= priority )
{
// Insert the listener in the array.
listeners.splice( i + 1, 0, listenerFirer );
return;
}
}
// If no position has been found (or zero length), put it in
// the front of list.
listeners.unshift( listenerFirer );
}
},
/**
* Fires an specific event in the object. All registered listeners are
* called at this point.
* @function
* @param {String} eventName The event name to fire.
* @param {Object} [data] Data to be sent as the
* {@link CKEDITOR.eventInfo#data} when calling the
* listeners.
* @param {CKEDITOR.editor} [editor] The editor instance to send as the
* {@link CKEDITOR.eventInfo#editor} when calling the
* listener.
* @returns {Boolean|Object} A booloan indicating that the event is to be
* canceled, or data returned by one of the listeners.
* @example
* someObject.on( 'someEvent', function() { ... } );
* someObject.on( 'someEvent', function() { ... } );
* <b>someObject.fire( 'someEvent' )</b>; // both listeners are called
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( event.data ); // "Example"
* });
* <b>someObject.fire( 'someEvent', 'Example' )</b>;
*/
fire : (function()
{
// Create the function that marks the event as stopped.
var stopped = false;
var stopEvent = function()
{
stopped = true;
};
// Create the function that marks the event as canceled.
var canceled = false;
var cancelEvent = function()
{
canceled = true;
};
return function( eventName, data, editor )
{
// Get the event entry.
var event = getPrivate( this )[ eventName ];
// Save the previous stopped and cancelled states. We may
// be nesting fire() calls.
var previousStopped = stopped,
previousCancelled = canceled;
// Reset the stopped and canceled flags.
stopped = canceled = false;
if ( event )
{
var listeners = event.listeners;
if ( listeners.length )
{
// As some listeners may remove themselves from the
// event, the original array length is dinamic. So,
// let's make a copy of all listeners, so we are
// sure we'll call all of them.
listeners = listeners.slice( 0 );
// Loop through all listeners.
for ( var i = 0 ; i < listeners.length ; i++ )
{
// Call the listener, passing the event data.
var retData = listeners[i].call( this, editor, data, stopEvent, cancelEvent );
if ( typeof retData != 'undefined' )
data = retData;
// No further calls is stopped or canceled.
if ( stopped || canceled )
break;
}
}
}
var ret = canceled || ( typeof data == 'undefined' ? false : data );
// Restore the previous stopped and canceled states.
stopped = previousStopped;
canceled = previousCancelled;
return ret;
};
})(),
/**
* Fires an specific event in the object, releasing all listeners
* registered to that event. The same listeners are not called again on
* successive calls of it or of {@link #fire}.
* @param {String} eventName The event name to fire.
* @param {Object} [data] Data to be sent as the
* {@link CKEDITOR.eventInfo#data} when calling the
* listeners.
* @param {CKEDITOR.editor} [editor] The editor instance to send as the
* {@link CKEDITOR.eventInfo#editor} when calling the
* listener.
* @returns {Boolean|Object} A booloan indicating that the event is to be
* canceled, or data returned by one of the listeners.
* @example
* someObject.on( 'someEvent', function() { ... } );
* someObject.fire( 'someEvent' ); // above listener called
* <b>someObject.fireOnce( 'someEvent' )</b>; // above listener called
* someObject.fire( 'someEvent' ); // no listeners called
*/
fireOnce : function( eventName, data, editor )
{
var ret = this.fire( eventName, data, editor );
delete getPrivate( this )[ eventName ];
return ret;
},
/**
* Unregisters a listener function from being called at the specified
* event. No errors are thrown if the listener has not been
* registered previously.
* @param {String} eventName The event name.
* @param {Function} listenerFunction The listener function to unregister.
* @example
* var myListener = function() { ... };
* someObject.on( 'someEvent', myListener );
* someObject.fire( 'someEvent' ); // myListener called
* <b>someObject.removeListener( 'someEvent', myListener )</b>;
* someObject.fire( 'someEvent' ); // myListener not called
*/
removeListener : function( eventName, listenerFunction )
{
// Get the event entry.
var event = getPrivate( this )[ eventName ];
if ( event )
{
var index = event.getListenerIndex( listenerFunction );
if ( index >= 0 )
event.listeners.splice( index, 1 );
}
},
/**
* Checks if there is any listener registered to a given event.
* @param {String} eventName The event name.
* @example
* var myListener = function() { ... };
* someObject.on( 'someEvent', myListener );
* alert( someObject.<b>hasListeners( 'someEvent' )</b> ); // "true"
* alert( someObject.<b>hasListeners( 'noEvent' )</b> ); // "false"
*/
hasListeners : function( eventName )
{
var event = getPrivate( this )[ eventName ];
return ( event && event.listeners.length > 0 ) ;
}
};
})();
}
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.scriptLoader} object, used to load scripts
* asynchronously.
*/
/**
* Load scripts asynchronously.
* @namespace
* @example
*/
CKEDITOR.scriptLoader = (function()
{
var uniqueScripts = {},
waitingList = {};
return /** @lends CKEDITOR.scriptLoader */ {
/**
* Loads one or more external script checking if not already loaded
* previously by this function.
* @param {String|Array} scriptUrl One or more URLs pointing to the
* scripts to be loaded.
* @param {Function} [callback] A function to be called when the script
* is loaded and executed. If a string is passed to "scriptUrl", a
* boolean parameter is passed to the callback, indicating the
* success of the load. If an array is passed instead, two array
* parameters are passed to the callback; the first contains the
* URLs that have been properly loaded, and the second the failed
* ones.
* @param {Object} [scope] The scope ("this" reference) to be used for
* the callback call. Default to {@link CKEDITOR}.
* @param {Boolean} [showBusy] Changes the cursor of the document while
+ * the script is loaded.
* @example
* CKEDITOR.scriptLoader.load( '/myscript.js' );
* @example
* CKEDITOR.scriptLoader.load( '/myscript.js', function( success )
* {
* // Alerts "true" if the script has been properly loaded.
* // HTTP error 404 should return "false".
* alert( success );
* });
* @example
* CKEDITOR.scriptLoader.load( [ '/myscript1.js', '/myscript2.js' ], function( completed, failed )
* {
* alert( 'Number of scripts loaded: ' + completed.length );
* alert( 'Number of failures: ' + failed.length );
* });
*/
load : function( scriptUrl, callback, scope, showBusy )
{
var isString = ( typeof scriptUrl == 'string' );
if ( isString )
scriptUrl = [ scriptUrl ];
if ( !scope )
scope = CKEDITOR;
var scriptCount = scriptUrl.length,
completed = [],
failed = [];
var doCallback = function( success )
{
if ( callback )
{
if ( isString )
callback.call( scope, success );
else
callback.call( scope, completed, failed );
}
};
if ( scriptCount === 0 )
{
doCallback( true );
return;
}
var checkLoaded = function( url, success )
{
( success ? completed : failed ).push( url );
if ( --scriptCount <= 0 )
{
showBusy && CKEDITOR.document.getDocumentElement().removeStyle( 'cursor' );
doCallback( success );
}
};
var onLoad = function( url, success )
{
// Mark this script as loaded.
uniqueScripts[ url ] = 1;
// Get the list of callback checks waiting for this file.
var waitingInfo = waitingList[ url ];
delete waitingList[ url ];
// Check all callbacks waiting for this file.
for ( var i = 0 ; i < waitingInfo.length ; i++ )
waitingInfo[ i ]( url, success );
};
var loadScript = function( url )
{
if ( uniqueScripts[ url ] )
{
checkLoaded( url, true );
return;
}
var waitingInfo = waitingList[ url ] || ( waitingList[ url ] = [] );
waitingInfo.push( checkLoaded );
// Load it only for the first request.
if ( waitingInfo.length > 1 )
return;
// Create the <script> element.
var script = new CKEDITOR.dom.element( 'script' );
script.setAttributes( {
type : 'text/javascript',
src : url } );
if ( callback )
{
if ( CKEDITOR.env.ie )
{
// FIXME: For IE, we are not able to return false on error (like 404).
/** @ignore */
script.$.onreadystatechange = function ()
{
if ( script.$.readyState == 'loaded' || script.$.readyState == 'complete' )
{
script.$.onreadystatechange = null;
onLoad( url, true );
}
};
}
else
{
/** @ignore */
script.$.onload = function()
{
// Some browsers, such as Safari, may call the onLoad function
// immediately. Which will break the loading sequence. (#3661)
setTimeout( function() { onLoad( url, true ); }, 0 );
};
// FIXME: Opera and Safari will not fire onerror.
/** @ignore */
script.$.onerror = function()
{
onLoad( url, false );
};
}
}
// Append it to <head>.
script.appendTo( CKEDITOR.document.getHead() );
CKEDITOR.fire( 'download', url ); // @Packager.RemoveLine
};
showBusy && CKEDITOR.document.getDocumentElement().setStyle( 'cursor', 'wait' );
for ( var i = 0 ; i < scriptCount ; i++ )
{
loadScript( scriptUrl[ i ] );
}
}
};
})();
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* Contains UI features related to an editor instance.
* @constructor
* @param {CKEDITOR.editor} editor The editor instance.
* @example
*/
CKEDITOR.ui = function( editor )
{
if ( editor.ui )
return editor.ui;
/**
* Object used to hold private stuff.
* @private
*/
this._ =
{
handlers : {},
items : {},
editor : editor
};
return this;
};
// PACKAGER_RENAME( CKEDITOR.ui )
CKEDITOR.ui.prototype =
{
/**
* Adds a UI item to the items collection. These items can be later used in
* the interface.
* @param {String} name The UI item name.
* @param {Object} type The item type.
* @param {Object} definition The item definition. The properties of this
* object depend on the item type.
* @example
* // Add a new button named "MyBold".
* editorInstance.ui.add( 'MyBold', CKEDITOR.UI_BUTTON,
* {
* label : 'My Bold',
* command : 'bold'
* });
*/
add : function( name, type, definition )
{
this._.items[ name ] =
{
type : type,
// The name of {@link CKEDITOR.command} which associate with this UI.
command : definition.command || null,
args : Array.prototype.slice.call( arguments, 2 )
};
},
/**
* Gets a UI object.
* @param {String} name The UI item hame.
* @example
*/
create : function( name )
{
var item = this._.items[ name ],
handler = item && this._.handlers[ item.type ],
command = item && item.command && this._.editor.getCommand( item.command );
var result = handler && handler.create.apply( this, item.args );
// Allow overrides from skin ui definitions..
item && ( result = CKEDITOR.tools.extend( result, this._.editor.skin[ item.type ], true ) );
// Add reference inside command object.
if ( command )
command.uiItems.push( result );
return result;
},
/**
* Adds a handler for a UI item type. The handler is responsible for
* transforming UI item definitions in UI objects.
* @param {Object} type The item type.
* @param {Object} handler The handler definition.
* @example
*/
addHandler : function( type, handler )
{
this._.handlers[ type ] = handler;
}
};
CKEDITOR.event.implementOn( CKEDITOR.ui );
/**
* (Virtual Class) Do not call this constructor. This class is not really part
* of the API. It just illustrates the features of hanlder objects to be
* passed to the {@link CKEDITOR.ui.prototype.addHandler} function.
* @name CKEDITOR.ui.handlerDefinition
* @constructor
* @example
*/
/**
* Transforms an item definition into an UI item object.
* @name CKEDITOR.handlerDefinition.prototype.create
* @function
* @param {Object} definition The item definition.
* @example
* editorInstance.ui.addHandler( CKEDITOR.UI_BUTTON,
* {
* create : function( definition )
* {
* return new CKEDITOR.ui.button( definition );
* }
* });
*/
/**
* Internal event fired when a new UI element is ready
* @name CKEDITOR.ui#ready
* @event
* @param {Object} element The new element
*/
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.themes} object, which is used to
* manage themes registration and loading.
*/
/**
* Manages themes registration and loading.
* @namespace
* @augments CKEDITOR.resourceManager
* @example
*/
CKEDITOR.themes = new CKEDITOR.resourceManager(
'_source/'+ // @Packager.RemoveLine
'themes/', 'theme' );
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.skins} object, which is used to
* manage skins loading.
*/
/**
* Manages skins loading.
* @namespace
* @example
*/
CKEDITOR.skins = (function()
{
// Holds the list of loaded skins.
var loaded = {},
paths = {};
var loadPart = function( editor, skinName, part, callback )
{
// Get the skin definition.
var skinDefinition = loaded[ skinName ];
if ( !editor.skin )
{
editor.skin = skinDefinition;
// Trigger init function if any.
if ( skinDefinition.init )
skinDefinition.init( editor );
}
var appendSkinPath = function( fileNames )
{
for ( var n = 0 ; n < fileNames.length ; n++ )
{
fileNames[ n ] = CKEDITOR.getUrl( paths[ skinName ] + fileNames[ n ] );
}
};
function fixCSSTextRelativePath( cssStyleText, baseUrl )
{
return cssStyleText.replace( /url\s*\(([\s'"]*)(.*?)([\s"']*)\)/g,
function( match, opener, path, closer )
{
if ( /^\/|^\w?:/.test( path ) )
return match;
else
return 'url(' + baseUrl + opener + path + closer + ')';
} );
}
// Get the part definition.
part = skinDefinition[ part ];
var partIsLoaded = !part || !!part._isLoaded;
// Call the callback immediately if already loaded.
if ( partIsLoaded )
callback && callback();
else
{
// Put the callback in a queue.
var pending = part._pending || ( part._pending = [] );
pending.push( callback );
// We may have more than one skin part load request. Just the first
// one must do the loading job.
if ( pending.length > 1 )
return;
// Check whether the "css" and "js" properties have been defined
// for that part.
var cssIsLoaded = !part.css || !part.css.length,
jsIsLoaded = !part.js || !part.js.length;
// This is the function that will trigger the callback calls on
// load.
var checkIsLoaded = function()
{
if ( cssIsLoaded && jsIsLoaded )
{
// Mark the part as loaded.
part._isLoaded = 1;
// Call all pending callbacks.
for ( var i = 0 ; i < pending.length ; i++ )
{
if ( pending[ i ] )
pending[ i ]();
}
}
};
// Load the "css" pieces.
if ( !cssIsLoaded )
{
var cssPart = part.css;
if ( CKEDITOR.tools.isArray( cssPart ) )
{
appendSkinPath( cssPart );
for ( var c = 0 ; c < cssPart.length ; c++ )
CKEDITOR.document.appendStyleSheet( cssPart[ c ] );
}
else
{
cssPart = fixCSSTextRelativePath(
cssPart, CKEDITOR.getUrl( paths[ skinName ] ) );
// Processing Inline CSS part.
CKEDITOR.document.appendStyleText( cssPart );
}
part.css = cssPart;
cssIsLoaded = 1;
}
// Load the "js" pieces.
if ( !jsIsLoaded )
{
appendSkinPath( part.js );
CKEDITOR.scriptLoader.load( part.js, function()
{
jsIsLoaded = 1;
checkIsLoaded();
});
}
// We may have nothing to load, so check it immediately.
checkIsLoaded();
}
};
return /** @lends CKEDITOR.skins */ {
/**
* Registers a skin definition.
* @param {String} skinName The skin name.
* @param {Object} skinDefinition The skin definition.
* @example
*/
add : function( skinName, skinDefinition )
{
loaded[ skinName ] = skinDefinition;
skinDefinition.skinPath = paths[ skinName ]
|| ( paths[ skinName ] =
CKEDITOR.getUrl(
'_source/' + // @Packager.RemoveLine
'skins/' + skinName + '/' ) );
},
/**
* Loads a skin part. Skins are defined in parts, which are basically
* separated CSS files. This function is mainly used by the core code and
* should not have much use out of it.
* @param {String} skinName The name of the skin to be loaded.
* @param {String} skinPart The skin part to be loaded. Common skin parts
* are "editor" and "dialog".
* @param {Function} [callback] A function to be called once the skin
* part files are loaded.
* @example
*/
load : function( editor, skinPart, callback )
{
var skinName = editor.skinName,
skinPath = editor.skinPath;
if ( loaded[ skinName ] )
loadPart( editor, skinName, skinPart, callback );
else
{
paths[ skinName ] = skinPath;
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( skinPath + 'skin.js' ), function()
{
loadPart( editor, skinName, skinPart, callback );
});
}
}
};
})();
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.plugins} object, which is used to
* manage plugins registration and loading.
*/
/**
* Manages plugins registration and loading.
* @namespace
* @augments CKEDITOR.resourceManager
* @example
*/
CKEDITOR.plugins = new CKEDITOR.resourceManager(
'_source/' + // @Packager.RemoveLine
'plugins/', 'plugin' );
// PACKAGER_RENAME( CKEDITOR.plugins )
CKEDITOR.plugins.load = CKEDITOR.tools.override( CKEDITOR.plugins.load, function( originalLoad )
{
return function( name, callback, scope )
{
var allPlugins = {};
var loadPlugins = function( names )
{
originalLoad.call( this, names, function( plugins )
{
CKEDITOR.tools.extend( allPlugins, plugins );
var requiredPlugins = [];
for ( var pluginName in plugins )
{
var plugin = plugins[ pluginName ],
requires = plugin && plugin.requires;
if ( requires )
{
for ( var i = 0 ; i < requires.length ; i++ )
{
if ( !allPlugins[ requires[ i ] ] )
requiredPlugins.push( requires[ i ] );
}
}
}
if ( requiredPlugins.length )
loadPlugins.call( this, requiredPlugins );
else
{
// Call the "onLoad" function for all plugins.
for ( pluginName in allPlugins )
{
plugin = allPlugins[ pluginName ];
if ( plugin.onLoad && !plugin.onLoad._called )
{
plugin.onLoad();
plugin.onLoad._called = 1;
}
}
// Call the callback.
if ( callback )
callback.call( scope || window, allPlugins );
}
}
, this);
};
loadPlugins.call( this, name );
};
});
/**
* Loads a specific language file, or auto detect it. A callback is
* then called when the file gets loaded.
* @param {String} pluginName The name of the plugin to which the provided translation
* should be attached.
* @param {String} languageCode The code of the language translation provided.
* @param {Object} languageEntries An object that contains pairs of label and
* the respective translation.
* @example
* CKEDITOR.plugins.setLang( 'myPlugin', 'en', {
* title : 'My plugin',
* selectOption : 'Please select an option'
* } );
*/
CKEDITOR.plugins.setLang = function( pluginName, languageCode, languageEntries )
{
var plugin = this.get( pluginName ),
pluginLangEntries = plugin.langEntries || ( plugin.langEntries = {} ),
pluginLang = plugin.lang || ( plugin.lang = [] );
if ( CKEDITOR.tools.indexOf( pluginLang, languageCode ) == -1 )
pluginLang.push( languageCode );
pluginLangEntries[ languageCode ] = languageEntries;
};
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.tools} object, which contains
* utility functions.
*/
(function()
{
var functions = [];
CKEDITOR.on( 'reset', function()
{
functions = [];
});
/**
* Utility functions.
* @namespace
* @example
*/
CKEDITOR.tools =
{
/**
* Compare the elements of two arrays.
* @param {Array} arrayA An array to be compared.
* @param {Array} arrayB The other array to be compared.
* @returns {Boolean} "true" is the arrays have the same lenght and
* their elements match.
* @example
* var a = [ 1, 'a', 3 ];
* var b = [ 1, 3, 'a' ];
* var c = [ 1, 'a', 3 ];
* var d = [ 1, 'a', 3, 4 ];
*
* alert( CKEDITOR.tools.arrayCompare( a, b ) ); // false
* alert( CKEDITOR.tools.arrayCompare( a, c ) ); // true
* alert( CKEDITOR.tools.arrayCompare( a, d ) ); // false
*/
arrayCompare : function( arrayA, arrayB )
{
if ( !arrayA && !arrayB )
return true;
if ( !arrayA || !arrayB || arrayA.length != arrayB.length )
return false;
for ( var i = 0 ; i < arrayA.length ; i++ )
{
if ( arrayA[ i ] != arrayB[ i ] )
return false;
}
return true;
},
/**
* Creates a deep copy of an object.
* Attention: there is no support for recursive references.
* @param {Object} object The object to be cloned.
* @returns {Object} The object clone.
* @example
* var obj =
* {
* name : 'John',
* cars :
* {
* Mercedes : { color : 'blue' },
* Porsche : { color : 'red' }
* }
* };
* var clone = CKEDITOR.tools.clone( obj );
* clone.name = 'Paul';
* clone.cars.Porsche.color = 'silver';
* alert( obj.name ); // John
* alert( clone.name ); // Paul
* alert( obj.cars.Porsche.color ); // red
* alert( clone.cars.Porsche.color ); // silver
*/
clone : function( obj )
{
var clone;
// Array.
if ( obj && ( obj instanceof Array ) )
{
clone = [];
for ( var i = 0 ; i < obj.length ; i++ )
clone[ i ] = this.clone( obj[ i ] );
return clone;
}
// "Static" types.
if ( obj === null
|| ( typeof( obj ) != 'object' )
|| ( obj instanceof String )
|| ( obj instanceof Number )
|| ( obj instanceof Boolean )
|| ( obj instanceof Date )
|| ( obj instanceof RegExp) )
{
return obj;
}
// Objects.
clone = new obj.constructor();
for ( var propertyName in obj )
{
var property = obj[ propertyName ];
clone[ propertyName ] = this.clone( property );
}
return clone;
},
/**
* Turn the first letter of string to upper-case.
* @param {String} str
*/
capitalize: function( str )
{
return str.charAt( 0 ).toUpperCase() + str.substring( 1 ).toLowerCase();
},
/**
* Copy the properties from one object to another. By default, properties
* already present in the target object <strong>are not</strong> overwritten.
* @param {Object} target The object to be extended.
* @param {Object} source[,souce(n)] The objects from which copy
* properties. Any number of objects can be passed to this function.
* @param {Boolean} [overwrite] If 'true' is specified it indicates that
* properties already present in the target object could be
* overwritten by subsequent objects.
* @param {Object} [properties] Only properties within the specified names
* list will be received from the source object.
* @returns {Object} the extended object (target).
* @example
* // Create the sample object.
* var myObject =
* {
* prop1 : true
* };
*
* // Extend the above object with two properties.
* CKEDITOR.tools.extend( myObject,
* {
* prop2 : true,
* prop3 : true
* } );
*
* // Alert "prop1", "prop2" and "prop3".
* for ( var p in myObject )
* alert( p );
*/
extend : function( target )
{
var argsLength = arguments.length,
overwrite, propertiesList;
if ( typeof ( overwrite = arguments[ argsLength - 1 ] ) == 'boolean')
argsLength--;
else if ( typeof ( overwrite = arguments[ argsLength - 2 ] ) == 'boolean' )
{
propertiesList = arguments [ argsLength -1 ];
argsLength-=2;
}
for ( var i = 1 ; i < argsLength ; i++ )
{
var source = arguments[ i ];
for ( var propertyName in source )
{
// Only copy existed fields if in overwrite mode.
if ( overwrite === true || target[ propertyName ] == undefined )
{
// Only copy specified fields if list is provided.
if ( !propertiesList || ( propertyName in propertiesList ) )
target[ propertyName ] = source[ propertyName ];
}
}
}
return target;
},
/**
* Creates an object which is an instance of a class which prototype is a
* predefined object. All properties defined in the source object are
* automatically inherited by the resulting object, including future
* changes to it.
* @param {Object} source The source object to be used as the prototype for
* the final object.
* @returns {Object} The resulting copy.
*/
prototypedCopy : function( source )
{
var copy = function()
{};
copy.prototype = source;
return new copy();
},
/**
* Checks if an object is an Array.
* @param {Object} object The object to be checked.
* @type Boolean
* @returns <i>true</i> if the object is an Array, otherwise <i>false</i>.
* @example
* alert( CKEDITOR.tools.isArray( [] ) ); // "true"
* alert( CKEDITOR.tools.isArray( 'Test' ) ); // "false"
*/
isArray : function( object )
{
return ( !!object && object instanceof Array );
},
/**
* Whether the object contains no properties of it's own.
* @param object
*/
isEmpty : function ( object )
{
for ( var i in object )
{
if ( object.hasOwnProperty( i ) )
return false;
}
return true;
},
/**
* Transforms a CSS property name to its relative DOM style name.
* @param {String} cssName The CSS property name.
* @returns {String} The transformed name.
* @example
* alert( CKEDITOR.tools.cssStyleToDomStyle( 'background-color' ) ); // "backgroundColor"
* alert( CKEDITOR.tools.cssStyleToDomStyle( 'float' ) ); // "cssFloat"
*/
cssStyleToDomStyle : ( function()
{
var test = document.createElement( 'div' ).style;
var cssFloat = ( typeof test.cssFloat != 'undefined' ) ? 'cssFloat'
: ( typeof test.styleFloat != 'undefined' ) ? 'styleFloat'
: 'float';
return function( cssName )
{
if ( cssName == 'float' )
return cssFloat;
else
{
return cssName.replace( /-./g, function( match )
{
return match.substr( 1 ).toUpperCase();
});
}
};
} )(),
/**
* Build the HTML snippet of a set of <style>/<link>.
* @param css {String|Array} Each of which are url (absolute) of a CSS file or
* a trunk of style text.
*/
buildStyleHtml : function ( css )
{
css = [].concat( css );
var item, retval = [];
for ( var i = 0; i < css.length; i++ )
{
item = css[ i ];
// Is CSS style text ?
if ( /@import|[{}]/.test(item) )
retval.push('<style>' + item + '</style>');
else
retval.push('<link type="text/css" rel=stylesheet href="' + item + '">');
}
return retval.join( '' );
},
/**
* Replace special HTML characters in a string with their relative HTML
* entity values.
* @param {String} text The string to be encoded.
* @returns {String} The encode string.
* @example
* alert( CKEDITOR.tools.htmlEncode( 'A > B & C < D' ) ); // "A &gt; B &amp; C &lt; D"
*/
htmlEncode : function( text )
{
var standard = function( text )
{
var span = new CKEDITOR.dom.element( 'span' );
span.setText( text );
return span.getHtml();
};
var fix1 = ( standard( '\n' ).toLowerCase() == '<br>' ) ?
function( text )
{
// #3874 IE and Safari encode line-break into <br>
return standard( text ).replace( /<br>/gi, '\n' );
} :
standard;
var fix2 = ( standard( '>' ) == '>' ) ?
function( text )
{
// WebKit does't encode the ">" character, which makes sense, but
// it's different than other browsers.
return fix1( text ).replace( />/g, '>' );
} :
fix1;
var fix3 = ( standard( ' ' ) == ' ' ) ?
function( text )
{
// #3785 IE8 changes spaces (>= 2) to
return fix2( text ).replace( / /g, ' ' );
} :
fix2;
this.htmlEncode = fix3;
return this.htmlEncode( text );
},
/**
* Replace special HTML characters in HTMLElement's attribute with their relative HTML entity values.
* @param {String} The attribute's value to be encoded.
* @returns {String} The encode value.
* @example
* element.setAttribute( 'title', '<a " b >' );
* alert( CKEDITOR.tools.htmlEncodeAttr( element.getAttribute( 'title' ) ); // ">a " b <"
*/
htmlEncodeAttr : function( text )
{
return text.replace( /"/g, '"' ).replace( /</g, '<' ).replace( />/g, '>' );
},
/**
* Gets a unique number for this CKEDITOR execution session. It returns
* progressive numbers starting at 1.
* @function
* @returns {Number} A unique number.
* @example
* alert( CKEDITOR.tools.<b>getNextNumber()</b> ); // "1" (e.g.)
* alert( CKEDITOR.tools.<b>getNextNumber()</b> ); // "2"
*/
getNextNumber : (function()
{
var last = 0;
return function()
{
return ++last;
};
})(),
/**
* Gets a unique ID for CKEditor's interface elements. It returns a
* string with the "cke_" prefix and a progressive number.
* @function
* @returns {String} A unique ID.
* @example
* alert( CKEDITOR.tools.<b>getNextId()</b> ); // "cke_1" (e.g.)
* alert( CKEDITOR.tools.<b>getNextId()</b> ); // "cke_2"
*/
getNextId : function()
{
return 'cke_' + this.getNextNumber();
},
/**
* Creates a function override.
* @param {Function} originalFunction The function to be overridden.
* @param {Function} functionBuilder A function that returns the new
* function. The original function reference will be passed to this
* function.
* @returns {Function} The new function.
* @example
* var example =
* {
* myFunction : function( name )
* {
* alert( 'Name: ' + name );
* }
* };
*
* example.myFunction = CKEDITOR.tools.override( example.myFunction, function( myFunctionOriginal )
* {
* return function( name )
* {
* alert( 'Override Name: ' + name );
* myFunctionOriginal.call( this, name );
* };
* });
*/
override : function( originalFunction, functionBuilder )
{
return functionBuilder( originalFunction );
},
/**
* Executes a function after specified delay.
* @param {Function} func The function to be executed.
* @param {Number} [milliseconds] The amount of time (millisecods) to wait
* to fire the function execution. Defaults to zero.
* @param {Object} [scope] The object to hold the function execution scope
* (the "this" object). By default the "window" object.
* @param {Object|Array} [args] A single object, or an array of objects, to
* pass as arguments to the function.
* @param {Object} [ownerWindow] The window that will be used to set the
* timeout. By default the current "window".
* @returns {Object} A value that can be used to cancel the function execution.
* @example
* CKEDITOR.tools.<b>setTimeout(
* function()
* {
* alert( 'Executed after 2 seconds' );
* },
* 2000 )</b>;
*/
setTimeout : function( func, milliseconds, scope, args, ownerWindow )
{
if ( !ownerWindow )
ownerWindow = window;
if ( !scope )
scope = ownerWindow;
return ownerWindow.setTimeout(
function()
{
if ( args )
func.apply( scope, [].concat( args ) ) ;
else
func.apply( scope ) ;
},
milliseconds || 0 );
},
/**
* Remove spaces from the start and the end of a string. The following
* characters are removed: space, tab, line break, line feed.
* @function
* @param {String} str The text from which remove the spaces.
* @returns {String} The modified string without the boundary spaces.
* @example
* alert( CKEDITOR.tools.trim( ' example ' ); // "example"
*/
trim : (function()
{
// We are not using \s because we don't want "non-breaking spaces" to be caught.
var trimRegex = /(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g;
return function( str )
{
return str.replace( trimRegex, '' ) ;
};
})(),
/**
* Remove spaces from the start (left) of a string. The following
* characters are removed: space, tab, line break, line feed.
* @function
* @param {String} str The text from which remove the spaces.
* @returns {String} The modified string excluding the removed spaces.
* @example
* alert( CKEDITOR.tools.ltrim( ' example ' ); // "example "
*/
ltrim : (function()
{
// We are not using \s because we don't want "non-breaking spaces" to be caught.
var trimRegex = /^[ \t\n\r]+/g;
return function( str )
{
return str.replace( trimRegex, '' ) ;
};
})(),
/**
* Remove spaces from the end (right) of a string. The following
* characters are removed: space, tab, line break, line feed.
* @function
* @param {String} str The text from which remove the spaces.
* @returns {String} The modified string excluding the removed spaces.
* @example
* alert( CKEDITOR.tools.ltrim( ' example ' ); // " example"
*/
rtrim : (function()
{
// We are not using \s because we don't want "non-breaking spaces" to be caught.
var trimRegex = /[ \t\n\r]+$/g;
return function( str )
{
return str.replace( trimRegex, '' ) ;
};
})(),
/**
* Returns the index of an element in an array.
* @param {Array} array The array to be searched.
* @param {Object} entry The element to be found.
* @returns {Number} The (zero based) index of the first entry that matches
* the entry, or -1 if not found.
* @example
* var letters = [ 'a', 'b', 0, 'c', false ];
* alert( CKEDITOR.tools.indexOf( letters, '0' ) ); "-1" because 0 !== '0'
* alert( CKEDITOR.tools.indexOf( letters, false ) ); "4" because 0 !== false
*/
indexOf :
// #2514: We should try to use Array.indexOf if it does exist.
( Array.prototype.indexOf ) ?
function( array, entry )
{
return array.indexOf( entry );
}
:
function( array, entry )
{
for ( var i = 0, len = array.length ; i < len ; i++ )
{
if ( array[ i ] === entry )
return i;
}
return -1;
},
/**
* Creates a function that will always execute in the context of a
* specified object.
* @param {Function} func The function to be executed.
* @param {Object} obj The object to which bind the execution context.
* @returns {Function} The function that can be used to execute the
* "func" function in the context of "obj".
* @example
* var obj = { text : 'My Object' };
*
* function alertText()
* {
* alert( this.text );
* }
*
* var newFunc = <b>CKEDITOR.tools.bind( alertText, obj )</b>;
* newFunc(); // Alerts "My Object".
*/
bind : function( func, obj )
{
return function() { return func.apply( obj, arguments ); };
},
/**
* Class creation based on prototype inheritance, with supports of the
* following features:
* <ul>
* <li> Static fields </li>
* <li> Private fields </li>
* <li> Public (prototype) fields </li>
* <li> Chainable base class constructor </li>
* </ul>
* @param {Object} definition The class definition object.
* @returns {Function} A class-like JavaScript function.
*/
createClass : function( definition )
{
var $ = definition.$,
baseClass = definition.base,
privates = definition.privates || definition._,
proto = definition.proto,
statics = definition.statics;
if ( privates )
{
var originalConstructor = $;
$ = function()
{
// Create (and get) the private namespace.
var _ = this._ || ( this._ = {} );
// Make some magic so "this" will refer to the main
// instance when coding private functions.
for ( var privateName in privates )
{
var priv = privates[ privateName ];
_[ privateName ] =
( typeof priv == 'function' ) ? CKEDITOR.tools.bind( priv, this ) : priv;
}
originalConstructor.apply( this, arguments );
};
}
if ( baseClass )
{
$.prototype = this.prototypedCopy( baseClass.prototype );
$.prototype.constructor = $;
$.prototype.base = function()
{
this.base = baseClass.prototype.base;
baseClass.apply( this, arguments );
this.base = arguments.callee;
};
}
if ( proto )
this.extend( $.prototype, proto, true );
if ( statics )
this.extend( $, statics, true );
return $;
},
/**
* Creates a function reference that can be called later using
* CKEDITOR.tools.callFunction. This approach is specially useful to
* make DOM attribute function calls to JavaScript defined functions.
* @param {Function} fn The function to be executed on call.
* @param {Object} [scope] The object to have the context on "fn" execution.
* @returns {Number} A unique reference to be used in conjuction with
* CKEDITOR.tools.callFunction.
* @example
* var ref = <b>CKEDITOR.tools.addFunction</b>(
* function()
* {
* alert( 'Hello!');
* });
* CKEDITOR.tools.callFunction( ref ); // Hello!
*/
addFunction : function( fn, scope )
{
return functions.push( function()
{
return fn.apply( scope || this, arguments );
}) - 1;
},
/**
* Removes the function reference created with {@see CKEDITOR.tools.addFunction}.
* @param {Number} ref The function reference created with
* CKEDITOR.tools.addFunction.
*/
removeFunction : function( ref )
{
functions[ ref ] = null;
},
/**
* Executes a function based on the reference created with
* CKEDITOR.tools.addFunction.
* @param {Number} ref The function reference created with
* CKEDITOR.tools.addFunction.
* @param {[Any,[Any,...]} params Any number of parameters to be passed
* to the executed function.
* @returns {Any} The return value of the function.
* @example
* var ref = CKEDITOR.tools.addFunction(
* function()
* {
* alert( 'Hello!');
* });
* <b>CKEDITOR.tools.callFunction( ref )</b>; // Hello!
*/
callFunction : function( ref )
{
var fn = functions[ ref ];
return fn && fn.apply( window, Array.prototype.slice.call( arguments, 1 ) );
},
/**
* Append the 'px' length unit to the size if it's missing.
* @param length
*/
cssLength : (function()
{
return function( length )
{
return length + ( !length || isNaN( Number( length ) ) ? '' : 'px' );
};
})(),
/**
* Convert the specified CSS length value to the calculated pixel length inside this page.
* <strong>Note:</strong> Percentage based value is left intact.
* @param {String} cssLength CSS length value.
*/
convertToPx : ( function ()
{
var calculator;
return function( cssLength )
{
if ( !calculator )
{
calculator = CKEDITOR.dom.element.createFromHtml(
'<div style="position:absolute;left:-9999px;' +
'top:-9999px;margin:0px;padding:0px;border:0px;"' +
'></div>', CKEDITOR.document );
CKEDITOR.document.getBody().append( calculator );
}
if ( !(/%$/).test( cssLength ) )
{
calculator.setStyle( 'width', cssLength );
return calculator.$.clientWidth;
}
return cssLength;
};
} )(),
/**
* String specified by {@param str} repeats {@param times} times.
* @param str
* @param times
*/
repeat : function( str, times )
{
return new Array( times + 1 ).join( str );
},
/**
* Return the first successfully executed function's return value that
* doesn't throw any exception.
*/
tryThese : function()
{
var returnValue;
for ( var i = 0, length = arguments.length; i < length; i++ )
{
var lambda = arguments[i];
try
{
returnValue = lambda();
break;
}
catch (e) {}
}
return returnValue;
},
/**
* Generate a combined key from a series of params.
* @param {String} subKey One or more string used as sub keys.
* @example
* var key = CKEDITOR.tools.genKey( 'key1', 'key2', 'key3' );
* alert( key ); // "key1-key2-key3".
*/
genKey : function()
{
return Array.prototype.slice.call( arguments ).join( '-' );
}
};
})();
// PACKAGER_RENAME( CKEDITOR.tools )
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.loader} objects, which is used to
* load core scripts and their dependencies from _source.
*/
if ( typeof CKEDITOR == 'undefined' )
CKEDITOR = {};
if ( !CKEDITOR.loader )
{
/**
* Load core scripts and their dependencies from _source.
* @namespace
* @example
*/
CKEDITOR.loader = (function()
{
// Table of script names and their dependencies.
var scripts =
{
'core/_bootstrap' : [ 'core/config', 'core/ckeditor', 'core/plugins', 'core/scriptloader', 'core/tools', /* The following are entries that we want to force loading at the end to avoid dependence recursion */ 'core/dom/comment', 'core/dom/elementpath', 'core/dom/text', 'core/dom/rangelist' ],
'core/ckeditor' : [ 'core/ckeditor_basic', 'core/dom', 'core/dtd', 'core/dom/document', 'core/dom/element', 'core/editor', 'core/event', 'core/htmlparser', 'core/htmlparser/element', 'core/htmlparser/fragment', 'core/htmlparser/filter', 'core/htmlparser/basicwriter', 'core/tools' ],
'core/ckeditor_base' : [],
'core/ckeditor_basic' : [ 'core/editor_basic', 'core/env', 'core/event' ],
'core/command' : [],
'core/config' : [ 'core/ckeditor_base' ],
'core/dom' : [],
'core/dom/comment' : [ 'core/dom/node' ],
'core/dom/document' : [ 'core/dom', 'core/dom/domobject', 'core/dom/window' ],
'core/dom/documentfragment' : [ 'core/dom/element' ],
'core/dom/element' : [ 'core/dom', 'core/dom/document', 'core/dom/domobject', 'core/dom/node', 'core/dom/nodelist', 'core/tools' ],
'core/dom/elementpath' : [ 'core/dom/element' ],
'core/dom/event' : [],
'core/dom/node' : [ 'core/dom/domobject', 'core/tools' ],
'core/dom/nodelist' : [ 'core/dom/node' ],
'core/dom/domobject' : [ 'core/dom/event' ],
'core/dom/range' : [ 'core/dom/document', 'core/dom/documentfragment', 'core/dom/element', 'core/dom/walker' ],
'core/dom/rangelist' : [ 'core/dom/range' ],
'core/dom/text' : [ 'core/dom/node', 'core/dom/domobject' ],
'core/dom/walker' : [ 'core/dom/node' ],
'core/dom/window' : [ 'core/dom/domobject' ],
'core/dtd' : [ 'core/tools' ],
'core/editor' : [ 'core/command', 'core/config', 'core/editor_basic', 'core/focusmanager', 'core/lang', 'core/plugins', 'core/skins', 'core/themes', 'core/tools', 'core/ui' ],
'core/editor_basic' : [ 'core/event' ],
'core/env' : [],
'core/event' : [],
'core/focusmanager' : [],
'core/htmlparser' : [],
'core/htmlparser/comment' : [ 'core/htmlparser' ],
'core/htmlparser/element' : [ 'core/htmlparser', 'core/htmlparser/fragment' ],
'core/htmlparser/fragment' : [ 'core/htmlparser', 'core/htmlparser/comment', 'core/htmlparser/text', 'core/htmlparser/cdata' ],
'core/htmlparser/text' : [ 'core/htmlparser' ],
'core/htmlparser/cdata' : [ 'core/htmlparser' ],
'core/htmlparser/filter' : [ 'core/htmlparser' ],
'core/htmlparser/basicwriter': [ 'core/htmlparser' ],
'core/lang' : [],
'core/plugins' : [ 'core/resourcemanager' ],
'core/resourcemanager' : [ 'core/scriptloader', 'core/tools' ],
'core/scriptloader' : [ 'core/dom/element', 'core/env' ],
'core/skins' : [ 'core/scriptloader' ],
'core/themes' : [ 'core/resourcemanager' ],
'core/tools' : [ 'core/env' ],
'core/ui' : []
};
var basePath = (function()
{
// This is a copy of CKEDITOR.basePath, but requires the script having
// "_source/core/loader.js".
if ( CKEDITOR && CKEDITOR.basePath )
return CKEDITOR.basePath;
// Find out the editor directory path, based on its <script> tag.
var path = '';
var scripts = document.getElementsByTagName( 'script' );
for ( var i = 0 ; i < scripts.length ; i++ )
{
var match = scripts[i].src.match( /(^|.*?[\\\/])(?:_source\/)?core\/loader.js(?:\?.*)?$/i );
if ( match )
{
path = match[1];
break;
}
}
// In IE (only) the script.src string is the raw valued entered in the
// HTML. Other browsers return the full resolved URL instead.
if ( path.indexOf('://') == -1 )
{
// Absolute path.
if ( path.indexOf( '/' ) === 0 )
path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
// Relative path.
else
path = location.href.match( /^[^\?]*\// )[0] + path;
}
return path;
})();
var timestamp = 'B8DJ5M3';
var getUrl = function( resource )
{
if ( CKEDITOR && CKEDITOR.getUrl )
return CKEDITOR.getUrl( resource );
return basePath + resource +
( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) +
't=' + timestamp;
};
var pendingLoad = [];
/** @lends CKEDITOR.loader */
return {
/**
* The list of loaded scripts in their loading order.
* @type Array
* @example
* // Alert the loaded script names.
* alert( <b>CKEDITOR.loader.loadedScripts</b> );
*/
loadedScripts : [],
loadPending : function()
{
var scriptName = pendingLoad.shift();
if ( !scriptName )
return;
var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = scriptSrc;
function onScriptLoaded()
{
// Append this script to the list of loaded scripts.
CKEDITOR.loader.loadedScripts.push( scriptName );
// Load the next.
CKEDITOR.loader.loadPending();
}
// We must guarantee the execution order of the scripts, so we
// need to load them one by one. (#4145)
// The following if/else block has been taken from the scriptloader core code.
if ( typeof(script.onreadystatechange) !== "undefined" )
{
/** @ignore */
script.onreadystatechange = function()
{
if ( script.readyState == 'loaded' || script.readyState == 'complete' )
{
script.onreadystatechange = null;
onScriptLoaded();
}
};
}
else
{
/** @ignore */
script.onload = function()
{
// Some browsers, such as Safari, may call the onLoad function
// immediately. Which will break the loading sequence. (#3661)
setTimeout( function() { onScriptLoaded( scriptName ); }, 0 );
};
}
document.body.appendChild( script );
},
/**
* Loads a specific script, including its dependencies. This is not a
* synchronous loading, which means that the code to be loaded will
* not necessarily be available after this call.
* @example
* CKEDITOR.loader.load( 'core/dom/element' );
*/
load : function( scriptName, defer )
{
// Check if the script has already been loaded.
if ( scriptName in this.loadedScripts )
return;
// Get the script dependencies list.
var dependencies = scripts[ scriptName ];
if ( !dependencies )
throw 'The script name"' + scriptName + '" is not defined.';
// Mark the script as loaded, even before really loading it, to
// avoid cross references recursion.
this.loadedScripts[ scriptName ] = true;
// Load all dependencies first.
for ( var i = 0 ; i < dependencies.length ; i++ )
this.load( dependencies[ i ], true );
var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
// Append the <script> element to the DOM.
// If the page is fully loaded, we can't use document.write
// but if the script is run while the body is loading then it's safe to use it
// Unfortunately, Firefox <3.6 doesn't support document.readyState, so it won't get this improvement
if ( document.body && (!document.readyState || document.readyState == 'complete') )
{
pendingLoad.push( scriptName );
if ( !defer )
this.loadPending();
}
else
{
// Append this script to the list of loaded scripts.
this.loadedScripts.push( scriptName );
document.write( '<script src="' + scriptSrc + '" type="text/javascript"><\/script>' );
}
}
};
})();
}
// Check if any script has been defined for autoload.
if ( CKEDITOR._autoLoad )
{
CKEDITOR.loader.load( CKEDITOR._autoLoad );
delete CKEDITOR._autoLoad;
}
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* Creates a command class instance.
* @class Represents a command that can be executed on an editor instance.
* @param {CKEDITOR.editor} editor The editor instance this command will be
* related to.
* @param {CKEDITOR.commandDefinition} commandDefinition The command
* definition.
* @augments CKEDITOR.event
* @example
* var command = new CKEDITOR.command( editor,
* {
* exec : function( editor )
* {
* alert( editor.document.getBody().getHtml() );
* }
* });
*/
CKEDITOR.command = function( editor, commandDefinition )
{
/**
* Lists UI items that are associated to this command. This list can be
* used to interact with the UI on command execution (by the execution code
* itself, for example).
* @type Array
* @example
* alert( 'Number of UI items associated to this command: ' + command.<b>uiItems</b>.length );
*/
this.uiItems = [];
/**
* Executes the command.
* @param {Object} [data] Any data to pass to the command. Depends on the
* command implementation and requirements.
* @returns {Boolean} A boolean indicating that the command has been
* successfully executed.
* @example
* command.<b>exec()</b>; // The command gets executed.
*/
this.exec = function( data )
{
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
return false;
if ( this.editorFocus ) // Give editor focus if necessary (#4355).
editor.focus();
return ( commandDefinition.exec.call( this, editor, data ) !== false );
};
CKEDITOR.tools.extend( this, commandDefinition,
// Defaults
/** @lends CKEDITOR.command.prototype */
{
/**
* The editor modes within which the command can be executed. The
* execution will have no action if the current mode is not listed
* in this property.
* @type Object
* @default { wysiwyg : 1 }
* @see CKEDITOR.editor.prototype.mode
* @example
* // Enable the command in both WYSIWYG and Source modes.
* command.<b>modes</b> = { wysiwyg : 1, source : 1 };
* @example
* // Enable the command in Source mode only.
* command.<b>modes</b> = { source : 1 };
*/
modes : { wysiwyg : 1 },
/**
* Indicates that the editor will get the focus before executing
* the command.
* @type Boolean
* @default true
* @example
* // Do not force the editor to have focus when executing the command.
* command.<b>editorFocus</b> = false;
*/
editorFocus : 1,
/**
* Indicates the editor state. Possible values are:
* <ul>
* <li>{@link CKEDITOR.TRISTATE_DISABLED}: the command is
* disabled. It's execution will have no effect. Same as
* {@link disable}.</li>
* <li>{@link CKEDITOR.TRISTATE_ON}: the command is enabled
* and currently active in the editor (for context sensitive commands,
* for example).</li>
* <li>{@link CKEDITOR.TRISTATE_OFF}: the command is enabled
* and currently inactive in the editor (for context sensitive
* commands, for example).</li>
* </ul>
* Do not set this property directly, using the {@link #setState}
* method instead.
* @type Number
* @default {@link CKEDITOR.TRISTATE_OFF}
* @example
* if ( command.<b>state</b> == CKEDITOR.TRISTATE_DISABLED )
* alert( 'This command is disabled' );
*/
state : CKEDITOR.TRISTATE_OFF
});
// Call the CKEDITOR.event constructor to initialize this instance.
CKEDITOR.event.call( this );
};
CKEDITOR.command.prototype =
{
/**
* Enables the command for execution. The command state (see
* {@link CKEDITOR.command.prototype.state}) available before disabling it
* is restored.
* @example
* command.<b>enable()</b>;
* command.exec(); // Execute the command.
*/
enable : function()
{
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
this.setState( ( !this.preserveState || ( typeof this.previousState == 'undefined' ) ) ? CKEDITOR.TRISTATE_OFF : this.previousState );
},
/**
* Disables the command for execution. The command state (see
* {@link CKEDITOR.command.prototype.state}) will be set to
* {@link CKEDITOR.TRISTATE_DISABLED}.
* @example
* command.<b>disable()</b>;
* command.exec(); // "false" - Nothing happens.
*/
disable : function()
{
this.setState( CKEDITOR.TRISTATE_DISABLED );
},
/**
* Sets the command state.
* @param {Number} newState The new state. See {@link #state}.
* @returns {Boolean} Returns "true" if the command state changed.
* @example
* command.<b>setState( CKEDITOR.TRISTATE_ON )</b>;
* command.exec(); // Execute the command.
* command.<b>setState( CKEDITOR.TRISTATE_DISABLED )</b>;
* command.exec(); // "false" - Nothing happens.
* command.<b>setState( CKEDITOR.TRISTATE_OFF )</b>;
* command.exec(); // Execute the command.
*/
setState : function( newState )
{
// Do nothing if there is no state change.
if ( this.state == newState )
return false;
this.previousState = this.state;
// Set the new state.
this.state = newState;
// Fire the "state" event, so other parts of the code can react to the
// change.
this.fire( 'state' );
return true;
},
/**
* Toggles the on/off (active/inactive) state of the command. This is
* mainly used internally by context sensitive commands.
* @example
* command.<b>toggleState()</b>;
*/
toggleState : function()
{
if ( this.state == CKEDITOR.TRISTATE_OFF )
this.setState( CKEDITOR.TRISTATE_ON );
else if ( this.state == CKEDITOR.TRISTATE_ON )
this.setState( CKEDITOR.TRISTATE_OFF );
}
};
CKEDITOR.event.implementOn( CKEDITOR.command.prototype, true );
/**
* Indicates the previous command state.
* @name CKEDITOR.command.prototype.previousState
* @type Number
* @see #state
* @example
* alert( command.<b>previousState</b> );
*/
/**
* Fired when the command state changes.
* @name CKEDITOR.command#state
* @event
* @example
* command.on( <b>'state'</b> , function( e )
* {
* // Alerts the new state.
* alert( this.state );
* });
*/
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.focusManager} class, which is used
* to handle the focus on editor instances..
*/
/**
* Creates a focusManager class instance.
* @class Manages the focus activity in an editor instance. This class is to be
* used mainly by UI elements coders when adding interface elements that need
* to set the focus state of the editor.
* @param {CKEDITOR.editor} editor The editor instance.
* @example
* var focusManager = <b>new CKEDITOR.focusManager( editor )</b>;
* focusManager.focus();
*/
CKEDITOR.focusManager = function( editor )
{
if ( editor.focusManager )
return editor.focusManager;
/**
* Indicates that the editor instance has focus.
* @type Boolean
* @example
* alert( CKEDITOR.instances.editor1.focusManager.hasFocus ); // e.g "true"
*/
this.hasFocus = false;
/**
* Object used to hold private stuff.
* @private
*/
this._ =
{
editor : editor
};
return this;
};
CKEDITOR.focusManager.prototype =
{
/**
* Used to indicate that the editor instance has the focus.<br />
* <br />
* Note that this function will not explicitelly set the focus in the
* editor (for example, making the caret blinking on it). Use
* {@link CKEDITOR.editor#focus} for it instead.
* @example
* var editor = CKEDITOR.instances.editor1;
* <b>editor.focusManager.focus()</b>;
*/
focus : function()
{
if ( this._.timer )
clearTimeout( this._.timer );
if ( !this.hasFocus )
{
// If another editor has the current focus, we first "blur" it. In
// this way the events happen in a more logical sequence, like:
// "focus 1" > "blur 1" > "focus 2"
// ... instead of:
// "focus 1" > "focus 2" > "blur 1"
if ( CKEDITOR.currentInstance )
CKEDITOR.currentInstance.focusManager.forceBlur();
var editor = this._.editor;
editor.container.getChild( 1 ).addClass( 'cke_focus' );
this.hasFocus = true;
editor.fire( 'focus' );
}
},
/**
* Used to indicate that the editor instance has lost the focus.<br />
* <br />
* Note that this functions acts asynchronously with a delay of 100ms to
* avoid subsequent blur/focus effects. If you want the "blur" to happen
* immediately, use the {@link #forceBlur} function instead.
* @example
* var editor = CKEDITOR.instances.editor1;
* <b>editor.focusManager.blur()</b>;
*/
blur : function()
{
var focusManager = this;
if ( focusManager._.timer )
clearTimeout( focusManager._.timer );
focusManager._.timer = setTimeout(
function()
{
delete focusManager._.timer;
focusManager.forceBlur();
}
, 100 );
},
/**
* Used to indicate that the editor instance has lost the focus. Unlike
* {@link #blur}, this function is synchronous, marking the instance as
* "blured" immediately.
* @example
* var editor = CKEDITOR.instances.editor1;
* <b>editor.focusManager.forceBlur()</b>;
*/
forceBlur : function()
{
if ( this.hasFocus )
{
var editor = this._.editor;
editor.container.getChild( 1 ).removeClass( 'cke_focus' );
this.hasFocus = false;
editor.fire( 'blur' );
}
}
};
/**
* Fired when the editor instance receives the input focus.
* @name CKEDITOR.editor#focus
* @event
* @param {CKEDITOR.editor} editor The editor instance.
* @example
* editor.on( 'focus', function( e )
* {
* alert( 'The editor named ' + e.editor.name + ' is now focused' );
* });
*/
/**
* Fired when the editor instance loses the input focus.
* @name CKEDITOR.editor#blur
* @event
* @param {CKEDITOR.editor} editor The editor instance.
* @example
* editor.on( 'blur', function( e )
* {
* alert( 'The editor named ' + e.editor.name + ' lost the focus' );
* });
*/
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.env} object, which constains
* environment and browser information.
*/
if ( !CKEDITOR.env )
{
/**
* @namespace Environment and browser information.
*/
CKEDITOR.env = (function()
{
var agent = navigator.userAgent.toLowerCase();
var opera = window.opera;
var env =
/** @lends CKEDITOR.env */
{
/**
* Indicates that CKEditor is running on Internet Explorer.
* @type Boolean
* @example
* if ( CKEDITOR.env.ie )
* alert( "I'm on IE!" );
*/
ie : /*@cc_on!@*/false,
/**
* Indicates that CKEditor is running on Opera.
* @type Boolean
* @example
* if ( CKEDITOR.env.opera )
* alert( "I'm on Opera!" );
*/
opera : ( !!opera && opera.version ),
/**
* Indicates that CKEditor is running on a WebKit based browser, like
* Safari.
* @type Boolean
* @example
* if ( CKEDITOR.env.webkit )
* alert( "I'm on WebKit!" );
*/
webkit : ( agent.indexOf( ' applewebkit/' ) > -1 ),
/**
* Indicates that CKEditor is running on Adobe AIR.
* @type Boolean
* @example
* if ( CKEDITOR.env.air )
* alert( "I'm on AIR!" );
*/
air : ( agent.indexOf( ' adobeair/' ) > -1 ),
/**
* Indicates that CKEditor is running on Macintosh.
* @type Boolean
* @example
* if ( CKEDITOR.env.mac )
* alert( "I love apples!" );
*/
mac : ( agent.indexOf( 'macintosh' ) > -1 ),
/**
* Indicates that CKEditor is running on a quirks mode environemnt.
* @type Boolean
* @example
* if ( CKEDITOR.env.quirks )
* alert( "Nooooo!" );
*/
quirks : ( document.compatMode == 'BackCompat' ),
/**
* Indicates that CKEditor is running on a mobile like environemnt.
* @type Boolean
* @example
* if ( CKEDITOR.env.mobile )
* alert( "I'm running with CKEditor today!" );
*/
mobile : ( agent.indexOf( 'mobile' ) > -1 ),
/**
* Indicates that CKEditor is running on Apple iPhone/iPad/iPod devices.
* @type Boolean
* @example
* if ( CKEDITOR.env.iOS )
* alert( "I like little apples!" );
*/
iOS : /(ipad|iphone|ipod)/.test(agent),
/**
* Indicates that the browser has a custom domain enabled. This has
* been set with "document.domain".
* @returns {Boolean} "true" if a custom domain is enabled.
* @example
* if ( CKEDITOR.env.isCustomDomain() )
* alert( "I'm in a custom domain!" );
*/
isCustomDomain : function()
{
if ( !this.ie )
return false;
var domain = document.domain,
hostname = window.location.hostname;
return domain != hostname &&
domain != ( '[' + hostname + ']' ); // IPv6 IP support (#5434)
},
/**
* Indicates that page is running under an encrypted connection.
* @returns {Boolean} "true" if the page has an encrypted connection.
* @example
* if ( CKEDITOR.env.secure )
* alert( "I'm in SSL!" );
*/
secure : location.protocol == 'https:'
};
/**
* Indicates that CKEditor is running on a Gecko based browser, like
* Firefox.
* @name CKEDITOR.env.gecko
* @type Boolean
* @example
* if ( CKEDITOR.env.gecko )
* alert( "I'm riding a gecko!" );
*/
env.gecko = ( navigator.product == 'Gecko' && !env.webkit && !env.opera );
var version = 0;
// Internet Explorer 6.0+
if ( env.ie )
{
version = parseFloat( agent.match( /msie (\d+)/ )[1] );
/**
* Indicates that CKEditor is running on Internet Explorer 8.
* @name CKEDITOR.env.ie8
* @type Boolean
* @example
* if ( CKEDITOR.env.ie8 )
* alert( "I'm on IE8!" );
*/
env.ie8 = !!document.documentMode;
/**
* Indicates that CKEditor is running on Internet Explorer 8 on
* standards mode.
* @name CKEDITOR.env.ie8Compat
* @type Boolean
* @example
* if ( CKEDITOR.env.ie8Compat )
* alert( "Now I'm on IE8, for real!" );
*/
env.ie8Compat = document.documentMode == 8;
/**
* Indicates that CKEditor is running on Internet Explorer 9's standards mode.
* @name CKEDITOR.env.ie9Compat
* @type Boolean
* @example
* if ( CKEDITOR.env.ie9Compat )
* alert( "IE9, the beauty of the web!" );
*/
env.ie9Compat = document.documentMode == 9;
/**
* Indicates that CKEditor is running on an IE7-like environment, which
* includes IE7 itself and IE8's IE7 document mode.
* @name CKEDITOR.env.ie7Compat
* @type Boolean
* @example
* if ( CKEDITOR.env.ie8Compat )
* alert( "I'm on IE7 or on an IE7 like IE8!" );
*/
env.ie7Compat = ( ( version == 7 && !document.documentMode )
|| document.documentMode == 7 );
/**
* Indicates that CKEditor is running on an IE6-like environment, which
* includes IE6 itself and IE7 and IE8 quirks mode.
* @name CKEDITOR.env.ie6Compat
* @type Boolean
* @example
* if ( CKEDITOR.env.ie6Compat )
* alert( "I'm on IE6 or quirks mode!" );
*/
env.ie6Compat = ( version < 7 || env.quirks );
}
// Gecko.
if ( env.gecko )
{
var geckoRelease = agent.match( /rv:([\d\.]+)/ );
if ( geckoRelease )
{
geckoRelease = geckoRelease[1].split( '.' );
version = geckoRelease[0] * 10000 + ( geckoRelease[1] || 0 ) * 100 + ( geckoRelease[2] || 0 ) * 1;
}
}
// Opera 9.50+
if ( env.opera )
version = parseFloat( opera.version() );
// Adobe AIR 1.0+
// Checked before Safari because AIR have the WebKit rich text editor
// features from Safari 3.0.4, but the version reported is 420.
if ( env.air )
version = parseFloat( agent.match( / adobeair\/(\d+)/ )[1] );
// WebKit 522+ (Safari 3+)
if ( env.webkit )
version = parseFloat( agent.match( / applewebkit\/(\d+)/ )[1] );
/**
* Contains the browser version.<br />
* <br />
* For gecko based browsers (like Firefox) it contains the revision
* number with first three parts concatenated with a padding zero
* (e.g. for revision 1.9.0.2 we have 10900).<br />
* <br />
* For webkit based browser (like Safari and Chrome) it contains the
* WebKit build version (e.g. 522).
* @name CKEDITOR.env.version
* @type Boolean
* @example
* if ( CKEDITOR.env.ie && <b>CKEDITOR.env.version</b> <= 6 )
* alert( "Ouch!" );
*/
env.version = version;
/**
* Indicates that CKEditor is running on a compatible browser.
* @name CKEDITOR.env.isCompatible
* @type Boolean
* @example
* if ( CKEDITOR.env.isCompatible )
* alert( "Your browser is pretty cool!" );
*/
env.isCompatible =
// White list of mobile devices that supports.
env.iOS && version >= 534 ||
!env.mobile && (
( env.ie && version >= 6 ) ||
( env.gecko && version >= 10801 ) ||
( env.opera && version >= 9.5 ) ||
( env.air && version >= 1 ) ||
( env.webkit && version >= 522 ) ||
false );
/**
* The CSS class to be appended on the main UI containers, making it
* easy to apply browser specific styles to it.
* @name CKEDITOR.env.cssClass
* @type String
* @example
* myDiv.className = CKEDITOR.env.cssClass;
*/
env.cssClass =
'cke_browser_' + (
env.ie ? 'ie' :
env.gecko ? 'gecko' :
env.opera ? 'opera' :
env.webkit ? 'webkit' :
'unknown' );
if ( env.quirks )
env.cssClass += ' cke_browser_quirks';
if ( env.ie )
{
env.cssClass += ' cke_browser_ie' + (
env.version < 7 ? '6' :
env.version >= 8 ? document.documentMode:
'7' );
if ( env.quirks )
env.cssClass += ' cke_browser_iequirks';
}
if ( env.gecko && version < 10900 )
env.cssClass += ' cke_browser_gecko18';
if ( env.air )
env.cssClass += ' cke_browser_air';
return env;
})();
}
// PACKAGER_RENAME( CKEDITOR.env )
// PACKAGER_RENAME( CKEDITOR.env.ie )
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the <code>{@link CKEDITOR.config}</code> object that stores the
* default configuration settings.
*/
/**
* Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
* and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
* settings to make the editor produce <code><p></code> tags when
* using the <em>Enter</em> key.
* @constant
*/
CKEDITOR.ENTER_P = 1;
/**
* Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
* and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
* settings to make the editor produce <code><br></code> tags when
* using the <em>Enter</em> key.
* @constant
*/
CKEDITOR.ENTER_BR = 2;
/**
* Used in conjunction with <code>{@link CKEDITOR.config.enterMode}</code>
* and <code>{@link CKEDITOR.config.shiftEnterMode}</code> configuration
* settings to make the editor produce <code><div></code> tags when
* using the <em>Enter</em> key.
* @constant
*/
CKEDITOR.ENTER_DIV = 3;
/**
* @namespace Stores default configuration settings. Changes to this object are
* reflected in all editor instances, if not specified otherwise for a particular
* instance.
*/
CKEDITOR.config =
{
/**
* The URL path for the custom configuration file to be loaded. If not
* overloaded with inline configuration, it defaults to the <code>config.js</code>
* file present in the root of the CKEditor installation directory.<br /><br />
*
* CKEditor will recursively load custom configuration files defined inside
* other custom configuration files.
* @type String
* @default <code>'<em><CKEditor folder></em>/config.js'</code>
* @example
* // Load a specific configuration file.
* CKEDITOR.replace( 'myfield', { customConfig : '/myconfig.js' } );
* @example
* // Do not load any custom configuration file.
* CKEDITOR.replace( 'myfield', { customConfig : '' } );
*/
customConfig : 'config.js',
/**
* Whether the replaced element (usually a <code><textarea></code>)
* is to be updated automatically when posting the form containing the editor.
* @type Boolean
* @default <code>true</code>
* @example
* config.autoUpdateElement = true;
*/
autoUpdateElement : true,
/**
* The base href URL used to resolve relative and absolute URLs in the
* editor content.
* @type String
* @default <code>''</code> (empty)
* @example
* config.baseHref = 'http://www.example.com/path/';
*/
baseHref : '',
/**
* The CSS file(s) to be used to apply style to editor contents. It should
* reflect the CSS used in the final pages where the contents are to be
* used.
* @type String|Array
* @default <code>'<em><CKEditor folder></em>/contents.css'</code>
* @example
* config.contentsCss = '/css/mysitestyles.css';
* config.contentsCss = ['/css/mysitestyles.css', '/css/anotherfile.css'];
*/
contentsCss : CKEDITOR.basePath + 'contents.css',
/**
* The writing direction of the language used to create the editor
* contents. Allowed values are:
* <ul>
* <li><code>'ui'</code> – indicates that content direction will be the same as the user interface language direction;</li>
* <li><code>'ltr'</code> – for Left-To-Right language (like English);</li>
* <li><code>'rtl'</code> – for Right-To-Left languages (like Arabic).</li>
* </ul>
* @default <code>'ui'</code>
* @type String
* @example
* config.contentsLangDirection = 'rtl';
*/
contentsLangDirection : 'ui',
/**
* Language code of the writing language which is used to create the editor
* contents.
* @default Same value as editor UI language.
* @type String
* @example
* config.contentsLanguage = 'fr';
*/
contentsLanguage : '',
/**
* The user interface language localization to use. If left empty, the editor
* will automatically be localized to the user language. If the user language is not supported,
* the language specified in the <code>{@link CKEDITOR.config.defaultLanguage}</code>
* configuration setting is used.
* @default <code>''</code> (empty)
* @type String
* @example
* // Load the German interface.
* config.language = 'de';
*/
language : '',
/**
* The language to be used if the <code>{@link CKEDITOR.config.language}</code>
* setting is left empty and it is not possible to localize the editor to the user language.
* @default <code>'en'</code>
* @type String
* @example
* config.defaultLanguage = 'it';
*/
defaultLanguage : 'en',
/**
* Sets the behavior of the <em>Enter</em> key. It also determines other behavior
* rules of the editor, like whether the <code><br></code> element is to be used
* as a paragraph separator when indenting text.
* The allowed values are the following constants that cause the behavior outlined below:
* <ul>
* <li><code>{@link CKEDITOR.ENTER_P}</code> (1) – new <code><p></code> paragraphs are created;</li>
* <li><code>{@link CKEDITOR.ENTER_BR}</code> (2) – lines are broken with <code><br></code> elements;</li>
* <li><code>{@link CKEDITOR.ENTER_DIV}</code> (3) – new <code><div></code> blocks are created.</li>
* </ul>
* <strong>Note</strong>: It is recommended to use the
* <code>{@link CKEDITOR.ENTER_P}</code> setting because of its semantic value and
* correctness. The editor is optimized for this setting.
* @type Number
* @default <code>{@link CKEDITOR.ENTER_P}</code>
* @example
* // Not recommended.
* config.enterMode = CKEDITOR.ENTER_BR;
*/
enterMode : CKEDITOR.ENTER_P,
/**
* Force the use of <code>{@link CKEDITOR.config.enterMode}</code> as line break regardless
* of the context. If, for example, <code>{@link CKEDITOR.config.enterMode}</code> is set
* to <code>{@link CKEDITOR.ENTER_P}</code>, pressing the <em>Enter</em> key inside a
* <code><div></code> element will create a new paragraph with <code><p></code>
* instead of a <code><div></code>.
* @since 3.2.1
* @type Boolean
* @default <code>false</code>
* @example
* // Not recommended.
* config.forceEnterMode = true;
*/
forceEnterMode : false,
/**
* Similarly to the <code>{@link CKEDITOR.config.enterMode}</code> setting, it defines the behavior
* of the <em>Shift+Enter</em> key combination.
* The allowed values are the following constants the behavior outlined below:
* <ul>
* <li><code>{@link CKEDITOR.ENTER_P}</code> (1) – new <code><p></code> paragraphs are created;</li>
* <li><code>{@link CKEDITOR.ENTER_BR}</code> (2) – lines are broken with <code><br></code> elements;</li>
* <li><code>{@link CKEDITOR.ENTER_DIV}</code> (3) – new <code><div></code> blocks are created.</li>
* </ul>
* @type Number
* @default <code>{@link CKEDITOR.ENTER_BR}</code>
* @example
* config.shiftEnterMode = CKEDITOR.ENTER_P;
*/
shiftEnterMode : CKEDITOR.ENTER_BR,
/**
* A comma separated list of plugins that are not related to editor
* instances. Reserved for plugins that extend the core code only.<br /><br />
*
* There are no ways to override this setting except by editing the source
* code of CKEditor (<code>_source/core/config.js</code>).
* @type String
* @example
*/
corePlugins : '',
/**
* Sets the <code>DOCTYPE</code> to be used when loading the editor content as HTML.
* @type String
* @default <code>'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'</code>
* @example
* // Set the DOCTYPE to the HTML 4 (Quirks) mode.
* config.docType = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
*/
docType : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
/**
* Sets the <code>id</code> attribute to be used on the <code>body</code> element
* of the editing area. This can be useful when you intend to reuse the original CSS
* file you are using on your live website and want to assign the editor the same ID
* as the section that will include the contents. In this way ID-specific CSS rules will
* be enabled.
* @since 3.1
* @type String
* @default <code>''</code> (empty)
* @example
* config.bodyId = 'contents_id';
*/
bodyId : '',
/**
* Sets the <code>class</code> attribute to be used on the <code>body</code> element
* of the editing area. This can be useful when you intend to reuse the original CSS
* file you are using on your live website and want to assign the editor the same class
* as the section that will include the contents. In this way class-specific CSS rules will
* be enabled.
* @since 3.1
* @type String
* @default <code>''</code> (empty)
* @example
* config.bodyClass = 'contents';
*/
bodyClass : '',
/**
* Indicates whether the contents to be edited are being input as a full
* HTML page. A full page includes the <code><html></code>,
* <code><head></code>, and <code><body></code> elements.
* The final output will also reflect this setting, including the
* <code><body></code> contents only if this setting is disabled.
* @since 3.1
* @type Boolean
* @default <code>false</code>
* @example
* config.fullPage = true;
*/
fullPage : false,
/**
* The height of the editing area (that includes the editor content),
* in relative or absolute units, e.g. <code>30px</code>, <code>5em</code>.
* <strong>Note:</strong> Percentage units, like <code>30%</code>, are not supported yet.
* @type Number|String
* @default <code>'200'</code>
* @example
* config.height = 500;
* config.height = '25em';
* config.height = '300px';
*/
height : 200,
/**
* Comma separated list of plugins to be loaded and initialized for an editor
* instance. This setting should rarely be changed. It is recommended to use the
* <code>{@link CKEDITOR.config.extraPlugins}</code> and
* <code>{@link CKEDITOR.config.removePlugins}</code> for customization purposes instead.
* @type String
* @example
*/
plugins :
'about,' +
'a11yhelp,' +
'basicstyles,' +
'bidi,' +
'blockquote,' +
'button,' +
'clipboard,' +
'colorbutton,' +
'colordialog,' +
'contextmenu,' +
'dialogadvtab,' +
'div,' +
'elementspath,' +
'enterkey,' +
'entities,' +
'filebrowser,' +
'find,' +
'flash,' +
'font,' +
'format,' +
'forms,' +
'horizontalrule,' +
'htmldataprocessor,' +
'iframe,' +
'image,' +
'indent,' +
'justify,' +
'keystrokes,' +
'link,' +
'list,' +
'liststyle,' +
'maximize,' +
'newpage,' +
'pagebreak,' +
'pastefromword,' +
'pastetext,' +
'popup,' +
'preview,' +
'print,' +
'removeformat,' +
'resize,' +
'save,' +
'scayt,' +
'smiley,' +
'showblocks,' +
'showborders,' +
'sourcearea,' +
'stylescombo,' +
'table,' +
'tabletools,' +
'specialchar,' +
'tab,' +
'templates,' +
'toolbar,' +
'undo,' +
'wysiwygarea,' +
'wsc',
/**
* A list of additional plugins to be loaded. This setting makes it easier
* to add new plugins without having to touch and potentially break the
* <code>{@link CKEDITOR.config.plugins}</code> setting.
* @type String
* @example
* config.extraPlugins = 'myplugin,anotherplugin';
*/
extraPlugins : '',
/**
* A list of plugins that must not be loaded. This setting makes it possible
* to avoid loading some plugins defined in the <code>{@link CKEDITOR.config.plugins}</code>
* setting, without having to touch it and potentially break it.
* @type String
* @example
* config.removePlugins = 'elementspath,save,font';
*/
removePlugins : '',
/**
* List of regular expressions to be executed on input HTML,
* indicating HTML source code that when matched, must <strong>not</strong> be available in the WYSIWYG
* mode for editing.
* @type Array
* @default <code>[]</code> (empty array)
* @example
* config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP code
* config.protectedSource.push( /<%[\s\S]*?%>/g ); // ASP code
* config.protectedSource.push( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ); // ASP.Net code
*/
protectedSource : [],
/**
* The editor <code>tabindex</code> value.
* @type Number
* @default <code>0</code> (zero)
* @example
* config.tabIndex = 1;
*/
tabIndex : 0,
/**
* The theme to be used to build the user interface.
* @type String
* @default <code>'default'</code>
* @see CKEDITOR.config.skin
* @example
* config.theme = 'default';
*/
theme : 'default',
/**
* The skin to load. It may be the name of the skin folder inside the
* editor installation path, or the name and the path separated by a comma.
* @type String
* @default <code>'default'</code>
* @example
* config.skin = 'v2';
* @example
* config.skin = 'myskin,/customstuff/myskin/';
*/
skin : 'kama',
/**
* The editor width in CSS-defined units or an integer denoting a value in pixels.
* @type String|Number
* @default <code>''</code> (empty)
* @example
* config.width = 850;
* @example
* config.width = '75%';
*/
width : '',
/**
* The base Z-index for floating dialog windows and popups.
* @type Number
* @default <code>10000</code>
* @example
* config.baseFloatZIndex = 2000
*/
baseFloatZIndex : 10000
};
/**
* Indicates that some of the editor features, like alignment and text
* direction, should use the "computed value" of the feature to indicate its
* on/off state instead of using the "real value".<br />
* <br />
* If enabled in a Left-To-Right written document, the "Left Justify"
* alignment button will be shown as active, even if the alignment style is not
* explicitly applied to the current paragraph in the editor.
* @name CKEDITOR.config.useComputedState
* @type Boolean
* @default <code>true</code>
* @since 3.4
* @example
* config.useComputedState = false;
*/
// PACKAGER_RENAME( CKEDITOR.config )
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
if ( !CKEDITOR.editor )
{
/**
* No element is linked to the editor instance.
* @constant
* @example
*/
CKEDITOR.ELEMENT_MODE_NONE = 0;
/**
* The element is to be replaced by the editor instance.
* @constant
* @example
*/
CKEDITOR.ELEMENT_MODE_REPLACE = 1;
/**
* The editor is to be created inside the element.
* @constant
* @example
*/
CKEDITOR.ELEMENT_MODE_APPENDTO = 2;
/**
* Creates an editor class instance. This constructor should be rarely
* used, in favor of the {@link CKEDITOR} editor creation functions.
* @ class Represents an editor instance.
* @param {Object} instanceConfig Configuration values for this specific
* instance.
* @param {CKEDITOR.dom.element} [element] The element linked to this
* instance.
* @param {Number} [mode] The mode in which the element is linked to this
* instance. See {@link #elementMode}.
* @param {String} [data] Since 3.3. Initial value for the instance.
* @augments CKEDITOR.event
* @example
*/
CKEDITOR.editor = function( instanceConfig, element, mode, data )
{
this._ =
{
// Save the config to be processed later by the full core code.
instanceConfig : instanceConfig,
element : element,
data : data
};
/**
* The mode in which the {@link #element} is linked to this editor
* instance. It can be any of the following values:
* <ul>
* <li>{@link CKEDITOR.ELEMENT_MODE_NONE}: No element is linked to the
* editor instance.</li>
* <li>{@link CKEDITOR.ELEMENT_MODE_REPLACE}: The element is to be
* replaced by the editor instance.</li>
* <li>{@link CKEDITOR.ELEMENT_MODE_APPENDTO}: The editor is to be
* created inside the element.</li>
* </ul>
* @name CKEDITOR.editor.prototype.elementMode
* @type Number
* @example
* var editor = CKEDITOR.replace( 'editor1' );
* alert( <b>editor.elementMode</b> ); "1"
*/
this.elementMode = mode || CKEDITOR.ELEMENT_MODE_NONE;
// Call the CKEDITOR.event constructor to initialize this instance.
CKEDITOR.event.call( this );
this._init();
};
/**
* Replaces a <textarea> or a DOM element (DIV) with a CKEditor
* instance. For textareas, the initial value in the editor will be the
* textarea value. For DOM elements, their innerHTML will be used
* instead. We recommend using TEXTAREA and DIV elements only. Do not use
* this function directly. Use {@link CKEDITOR.replace} instead.
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
* ID or name.
* @param {Object} [config] The specific configurations to apply to this
* editor instance. Configurations set here will override global CKEditor
* settings.
* @returns {CKEDITOR.editor} The editor instance created.
* @example
*/
CKEDITOR.editor.replace = function( elementOrIdOrName, config )
{
var element = elementOrIdOrName;
if ( typeof element != 'object' )
{
// Look for the element by id. We accept any kind of element here.
element = document.getElementById( elementOrIdOrName );
// Elements that should go into head are unacceptable (#6791).
if ( element && element.tagName.toLowerCase() in {style:1,script:1,base:1,link:1,meta:1,title:1} )
element = null;
// If not found, look for elements by name. In this case we accept only
// textareas.
if ( !element )
{
var i = 0,
textareasByName = document.getElementsByName( elementOrIdOrName );
while ( ( element = textareasByName[ i++ ] ) && element.tagName.toLowerCase() != 'textarea' )
{ /*jsl:pass*/ }
}
if ( !element )
throw '[CKEDITOR.editor.replace] The element with id or name "' + elementOrIdOrName + '" was not found.';
}
// Do not replace the textarea right now, just hide it. The effective
// replacement will be done by the _init function.
element.style.visibility = 'hidden';
// Create the editor instance.
return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_REPLACE );
};
/**
* Creates a new editor instance inside a specific DOM element. Do not use
* this function directly. Use {@link CKEDITOR.appendTo} instead.
* @param {Object|String} elementOrId The DOM element or its ID.
* @param {Object} [config] The specific configurations to apply to this
* editor instance. Configurations set here will override global CKEditor
* settings.
* @param {String} [data] Since 3.3. Initial value for the instance.
* @returns {CKEDITOR.editor} The editor instance created.
* @example
*/
CKEDITOR.editor.appendTo = function( elementOrId, config, data )
{
var element = elementOrId;
if ( typeof element != 'object' )
{
element = document.getElementById( elementOrId );
if ( !element )
throw '[CKEDITOR.editor.appendTo] The element with id "' + elementOrId + '" was not found.';
}
// Create the editor instance.
return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO, data );
};
CKEDITOR.editor.prototype =
{
/**
* Initializes the editor instance. This function will be overriden by the
* full CKEDITOR.editor implementation (editor.js).
* @private
*/
_init : function()
{
var pending = CKEDITOR.editor._pending || ( CKEDITOR.editor._pending = [] );
pending.push( this );
},
// Both fire and fireOnce will always pass this editor instance as the
// "editor" param in CKEDITOR.event.fire. So, we override it to do that
// automaticaly.
/** @ignore */
fire : function( eventName, data )
{
return CKEDITOR.event.prototype.fire.call( this, eventName, data, this );
},
/** @ignore */
fireOnce : function( eventName, data )
{
return CKEDITOR.event.prototype.fireOnce.call( this, eventName, data, this );
}
};
// "Inherit" (copy actually) from CKEDITOR.event.
CKEDITOR.event.implementOn( CKEDITOR.editor.prototype, true );
}
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.editor} class, which represents an
* editor instance.
*/
(function()
{
// The counter for automatic instance names.
var nameCounter = 0;
var getNewName = function()
{
var name = 'editor' + ( ++nameCounter );
return ( CKEDITOR.instances && CKEDITOR.instances[ name ] ) ? getNewName() : name;
};
// ##### START: Config Privates
// These function loads custom configuration files and cache the
// CKEDITOR.editorConfig functions defined on them, so there is no need to
// download them more than once for several instances.
var loadConfigLoaded = {};
var loadConfig = function( editor )
{
var customConfig = editor.config.customConfig;
// Check if there is a custom config to load.
if ( !customConfig )
return false;
customConfig = CKEDITOR.getUrl( customConfig );
var loadedConfig = loadConfigLoaded[ customConfig ] || ( loadConfigLoaded[ customConfig ] = {} );
// If the custom config has already been downloaded, reuse it.
if ( loadedConfig.fn )
{
// Call the cached CKEDITOR.editorConfig defined in the custom
// config file for the editor instance depending on it.
loadedConfig.fn.call( editor, editor.config );
// If there is no other customConfig in the chain, fire the
// "configLoaded" event.
if ( CKEDITOR.getUrl( editor.config.customConfig ) == customConfig || !loadConfig( editor ) )
editor.fireOnce( 'customConfigLoaded' );
}
else
{
// Load the custom configuration file.
CKEDITOR.scriptLoader.load( customConfig, function()
{
// If the CKEDITOR.editorConfig function has been properly
// defined in the custom configuration file, cache it.
if ( CKEDITOR.editorConfig )
loadedConfig.fn = CKEDITOR.editorConfig;
else
loadedConfig.fn = function(){};
// Call the load config again. This time the custom
// config is already cached and so it will get loaded.
loadConfig( editor );
});
}
return true;
};
var initConfig = function( editor, instanceConfig )
{
// Setup the lister for the "customConfigLoaded" event.
editor.on( 'customConfigLoaded', function()
{
if ( instanceConfig )
{
// Register the events that may have been set at the instance
// configuration object.
if ( instanceConfig.on )
{
for ( var eventName in instanceConfig.on )
{
editor.on( eventName, instanceConfig.on[ eventName ] );
}
}
// Overwrite the settings from the in-page config.
CKEDITOR.tools.extend( editor.config, instanceConfig, true );
delete editor.config.on;
}
onConfigLoaded( editor );
});
// The instance config may override the customConfig setting to avoid
// loading the default ~/config.js file.
if ( instanceConfig && instanceConfig.customConfig != undefined )
editor.config.customConfig = instanceConfig.customConfig;
// Load configs from the custom configuration files.
if ( !loadConfig( editor ) )
editor.fireOnce( 'customConfigLoaded' );
};
// ##### END: Config Privates
var onConfigLoaded = function( editor )
{
// Set config related properties.
var skin = editor.config.skin.split( ',' ),
skinName = skin[ 0 ],
skinPath = CKEDITOR.getUrl( skin[ 1 ] || (
'_source/' + // @Packager.RemoveLine
'skins/' + skinName + '/' ) );
/**
* The name of the skin used by this editor instance. The skin name can
* be set through the <code>{@link CKEDITOR.config.skin}</code> setting.
* @name CKEDITOR.editor.prototype.skinName
* @type String
* @example
* alert( editor.skinName ); // E.g. "kama"
*/
editor.skinName = skinName;
/**
* The full URL of the skin directory.
* @name CKEDITOR.editor.prototype.skinPath
* @type String
* @example
* alert( editor.skinPath ); // E.g. "http://example.com/ckeditor/skins/kama/"
*/
editor.skinPath = skinPath;
/**
* The CSS class name used for skin identification purposes.
* @name CKEDITOR.editor.prototype.skinClass
* @type String
* @example
* alert( editor.skinClass ); // E.g. "cke_skin_kama"
*/
editor.skinClass = 'cke_skin_' + skinName;
/**
* The <a href="http://en.wikipedia.org/wiki/Tabbing_navigation">tabbing
* navigation</a> order that has been calculated for this editor
* instance. This can be set by the <code>{@link CKEDITOR.config.tabIndex}</code>
* setting or taken from the <code>tabindex</code> attribute of the
* <code>{@link #element}</code> associated with the editor.
* @name CKEDITOR.editor.prototype.tabIndex
* @type Number
* @default 0 (zero)
* @example
* alert( editor.tabIndex ); // E.g. "0"
*/
editor.tabIndex = editor.config.tabIndex || editor.element.getAttribute( 'tabindex' ) || 0;
/**
* Indicates the read-only state of this editor. This is a read-only property.
* @name CKEDITOR.editor.prototype.readOnly
* @type Boolean
* @since 3.6
* @see CKEDITOR.editor#setReadOnly
*/
editor.readOnly = !!( editor.config.readOnly || editor.element.getAttribute( 'disabled' ) );
// Fire the "configLoaded" event.
editor.fireOnce( 'configLoaded' );
// Load language file.
loadSkin( editor );
};
var loadLang = function( editor )
{
CKEDITOR.lang.load( editor.config.language, editor.config.defaultLanguage, function( languageCode, lang )
{
/**
* The code for the language resources that have been loaded
* for the user interface elements of this editor instance.
* @name CKEDITOR.editor.prototype.langCode
* @type String
* @example
* alert( editor.langCode ); // E.g. "en"
*/
editor.langCode = languageCode;
/**
* An object that contains all language strings used by the editor
* interface.
* @name CKEDITOR.editor.prototype.lang
* @type CKEDITOR.lang
* @example
* alert( editor.lang.bold ); // E.g. "Negrito" (if the language is set to Portuguese)
*/
// As we'll be adding plugin specific entries that could come
// from different language code files, we need a copy of lang,
// not a direct reference to it.
editor.lang = CKEDITOR.tools.prototypedCopy( lang );
// We're not able to support RTL in Firefox 2 at this time.
if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 && editor.lang.dir == 'rtl' )
editor.lang.dir = 'ltr';
editor.fire( 'langLoaded' );
var config = editor.config;
config.contentsLangDirection == 'ui' && ( config.contentsLangDirection = editor.lang.dir );
loadPlugins( editor );
});
};
var loadPlugins = function( editor )
{
var config = editor.config,
plugins = config.plugins,
extraPlugins = config.extraPlugins,
removePlugins = config.removePlugins;
if ( extraPlugins )
{
// Remove them first to avoid duplications.
var removeRegex = new RegExp( '(?:^|,)(?:' + extraPlugins.replace( /\s*,\s*/g, '|' ) + ')(?=,|$)' , 'g' );
plugins = plugins.replace( removeRegex, '' );
plugins += ',' + extraPlugins;
}
if ( removePlugins )
{
removeRegex = new RegExp( '(?:^|,)(?:' + removePlugins.replace( /\s*,\s*/g, '|' ) + ')(?=,|$)' , 'g' );
plugins = plugins.replace( removeRegex, '' );
}
// Load the Adobe AIR plugin conditionally.
CKEDITOR.env.air && ( plugins += ',adobeair' );
// Load all plugins defined in the "plugins" setting.
CKEDITOR.plugins.load( plugins.split( ',' ), function( plugins )
{
// The list of plugins.
var pluginsArray = [];
// The language code to get loaded for each plugin. Null
// entries will be appended for plugins with no language files.
var languageCodes = [];
// The list of URLs to language files.
var languageFiles = [];
/**
* An object that contains references to all plugins used by this
* editor instance.
* @name CKEDITOR.editor.prototype.plugins
* @type Object
* @example
* alert( editor.plugins.dialog.path ); // E.g. "http://example.com/ckeditor/plugins/dialog/"
*/
editor.plugins = plugins;
// Loop through all plugins, to build the list of language
// files to get loaded.
for ( var pluginName in plugins )
{
var plugin = plugins[ pluginName ],
pluginLangs = plugin.lang,
pluginPath = CKEDITOR.plugins.getPath( pluginName ),
lang = null;
// Set the plugin path in the plugin.
plugin.path = pluginPath;
// If the plugin has "lang".
if ( pluginLangs )
{
// Resolve the plugin language. If the current language
// is not available, get the first one (default one).
lang = ( CKEDITOR.tools.indexOf( pluginLangs, editor.langCode ) >= 0 ? editor.langCode : pluginLangs[ 0 ] );
if ( !plugin.langEntries || !plugin.langEntries[ lang ] )
{
// Put the language file URL into the list of files to
// get downloaded.
languageFiles.push( CKEDITOR.getUrl( pluginPath + 'lang/' + lang + '.js' ) );
}
else
{
CKEDITOR.tools.extend( editor.lang, plugin.langEntries[ lang ] );
lang = null;
}
}
// Save the language code, so we know later which
// language has been resolved to this plugin.
languageCodes.push( lang );
pluginsArray.push( plugin );
}
// Load all plugin specific language files in a row.
CKEDITOR.scriptLoader.load( languageFiles, function()
{
// Initialize all plugins that have the "beforeInit" and "init" methods defined.
var methods = [ 'beforeInit', 'init', 'afterInit' ];
for ( var m = 0 ; m < methods.length ; m++ )
{
for ( var i = 0 ; i < pluginsArray.length ; i++ )
{
var plugin = pluginsArray[ i ];
// Uses the first loop to update the language entries also.
if ( m === 0 && languageCodes[ i ] && plugin.lang )
CKEDITOR.tools.extend( editor.lang, plugin.langEntries[ languageCodes[ i ] ] );
// Call the plugin method (beforeInit and init).
if ( plugin[ methods[ m ] ] )
plugin[ methods[ m ] ]( editor );
}
}
// Load the editor skin.
editor.fire( 'pluginsLoaded' );
loadTheme( editor );
});
});
};
var loadSkin = function( editor )
{
CKEDITOR.skins.load( editor, 'editor', function()
{
loadLang( editor );
});
};
var loadTheme = function( editor )
{
var theme = editor.config.theme;
CKEDITOR.themes.load( theme, function()
{
/**
* The theme used by this editor instance.
* @name CKEDITOR.editor.prototype.theme
* @type CKEDITOR.theme
* @example
* alert( editor.theme ); // E.g. "http://example.com/ckeditor/themes/default/"
*/
var editorTheme = editor.theme = CKEDITOR.themes.get( theme );
editorTheme.path = CKEDITOR.themes.getPath( theme );
editorTheme.build( editor );
if ( editor.config.autoUpdateElement )
attachToForm( editor );
});
};
var attachToForm = function( editor )
{
var element = editor.element;
// If are replacing a textarea, we must
if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE && element.is( 'textarea' ) )
{
var form = element.$.form && new CKEDITOR.dom.element( element.$.form );
if ( form )
{
function onSubmit()
{
editor.updateElement();
}
form.on( 'submit',onSubmit );
// Setup the submit function because it doesn't fire the
// "submit" event.
if ( !form.$.submit.nodeName && !form.$.submit.length )
{
form.$.submit = CKEDITOR.tools.override( form.$.submit, function( originalSubmit )
{
return function()
{
editor.updateElement();
// For IE, the DOM submit function is not a
// function, so we need thid check.
if ( originalSubmit.apply )
originalSubmit.apply( this, arguments );
else
originalSubmit();
};
});
}
// Remove 'submit' events registered on form element before destroying.(#3988)
editor.on( 'destroy', function()
{
form.removeListener( 'submit', onSubmit );
} );
}
}
};
function updateCommands()
{
var command,
commands = this._.commands,
mode = this.mode;
if ( !mode )
return;
for ( var name in commands )
{
command = commands[ name ];
command[ command.startDisabled ? 'disable' :
this.readOnly && !command.readOnly ? 'disable' : command.modes[ mode ] ? 'enable' : 'disable' ]();
}
}
/**
* Initializes the editor instance. This function is called by the editor
* contructor (<code>editor_basic.js</code>).
* @private
*/
CKEDITOR.editor.prototype._init = function()
{
// Get the properties that have been saved in the editor_base
// implementation.
var element = CKEDITOR.dom.element.get( this._.element ),
instanceConfig = this._.instanceConfig;
delete this._.element;
delete this._.instanceConfig;
this._.commands = {};
this._.styles = [];
/**
* The DOM element that was replaced by this editor instance. This
* element stores the editor data on load and post.
* @name CKEDITOR.editor.prototype.element
* @type CKEDITOR.dom.element
* @example
* var editor = CKEDITOR.instances.editor1;
* alert( <strong>editor.element</strong>.getName() ); // E.g. "textarea"
*/
this.element = element;
/**
* The editor instance name. It may be the replaced element ID, name, or
* a default name using the progressive counter (<code>editor1</code>,
* <code>editor2</code>, ...).
* @name CKEDITOR.editor.prototype.name
* @type String
* @example
* var editor = CKEDITOR.instances.editor1;
* alert( <strong>editor.name</strong> ); // "editor1"
*/
this.name = ( element && ( this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
&& ( element.getId() || element.getNameAtt() ) )
|| getNewName();
if ( this.name in CKEDITOR.instances )
throw '[CKEDITOR.editor] The instance "' + this.name + '" already exists.';
/**
* A unique random string assigned to each editor instance on the page.
* @name CKEDITOR.editor.prototype.id
* @type String
*/
this.id = CKEDITOR.tools.getNextId();
/**
* The configurations for this editor instance. It inherits all
* settings defined in <code>(@link CKEDITOR.config}</code>, combined with settings
* loaded from custom configuration files and those defined inline in
* the page when creating the editor.
* @name CKEDITOR.editor.prototype.config
* @type Object
* @example
* var editor = CKEDITOR.instances.editor1;
* alert( <strong>editor.config.theme</strong> ); // E.g. "default"
*/
this.config = CKEDITOR.tools.prototypedCopy( CKEDITOR.config );
/**
* The namespace containing UI features related to this editor instance.
* @name CKEDITOR.editor.prototype.ui
* @type CKEDITOR.ui
* @example
*/
this.ui = new CKEDITOR.ui( this );
/**
* Controls the focus state of this editor instance. This property
* is rarely used for normal API operations. It is mainly
* intended for developers adding UI elements to the editor interface.
* @name CKEDITOR.editor.prototype.focusManager
* @type CKEDITOR.focusManager
* @example
*/
this.focusManager = new CKEDITOR.focusManager( this );
CKEDITOR.fire( 'instanceCreated', null, this );
this.on( 'mode', updateCommands, null, null, 1 );
this.on( 'readOnly', updateCommands, null, null, 1 );
initConfig( this, instanceConfig );
};
})();
CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
/** @lends CKEDITOR.editor.prototype */
{
/**
* Adds a command definition to the editor instance. Commands added with
* this function can be executed later with the <code>{@link #execCommand}</code> method.
* @param {String} commandName The indentifier name of the command.
* @param {CKEDITOR.commandDefinition} commandDefinition The command definition.
* @example
* editorInstance.addCommand( 'sample',
* {
* exec : function( editor )
* {
* alert( 'Executing a command for the editor name "' + editor.name + '"!' );
* }
* });
*/
addCommand : function( commandName, commandDefinition )
{
return this._.commands[ commandName ] = new CKEDITOR.command( this, commandDefinition );
},
/**
* Adds a piece of CSS code to the editor which will be applied to the WYSIWYG editing document.
* This CSS would not be added to the output, and is there mainly for editor-specific editing requirements.
* Note: This function should be called before the editor is loaded to take effect.
* @param css {String} CSS text.
* @example
* editorInstance.addCss( 'body { background-color: grey; }' );
*/
addCss : function( css )
{
this._.styles.push( css );
},
/**
* Destroys the editor instance, releasing all resources used by it.
* If the editor replaced an element, the element will be recovered.
* @param {Boolean} [noUpdate] If the instance is replacing a DOM
* element, this parameter indicates whether or not to update the
* element with the instance contents.
* @example
* alert( CKEDITOR.instances.editor1 ); // E.g "object"
* <strong>CKEDITOR.instances.editor1.destroy()</strong>;
* alert( CKEDITOR.instances.editor1 ); // "undefined"
*/
destroy : function( noUpdate )
{
if ( !noUpdate )
this.updateElement();
this.fire( 'destroy' );
this.theme && this.theme.destroy( this );
CKEDITOR.remove( this );
CKEDITOR.fire( 'instanceDestroyed', null, this );
},
/**
* Executes a command associated with the editor.
* @param {String} commandName The indentifier name of the command.
* @param {Object} [data] Data to be passed to the command.
* @returns {Boolean} <code>true</code> if the command was executed
* successfully, otherwise <code>false</code>.
* @see CKEDITOR.editor.addCommand
* @example
* editorInstance.execCommand( 'bold' );
*/
execCommand : function( commandName, data )
{
var command = this.getCommand( commandName );
var eventData =
{
name: commandName,
commandData: data,
command: command
};
if ( command && command.state != CKEDITOR.TRISTATE_DISABLED )
{
if ( this.fire( 'beforeCommandExec', eventData ) !== true )
{
eventData.returnValue = command.exec( eventData.commandData );
// Fire the 'afterCommandExec' immediately if command is synchronous.
if ( !command.async && this.fire( 'afterCommandExec', eventData ) !== true )
return eventData.returnValue;
}
}
// throw 'Unknown command name "' + commandName + '"';
return false;
},
/**
* Gets one of the registered commands. Note that after registering a
* command definition with <code>{@link #addCommand}</code>, it is
* transformed internally into an instance of
* <code>{@link CKEDITOR.command}</code>, which will then be returned
* by this function.
* @param {String} commandName The name of the command to be returned.
* This is the same name that is used to register the command with
* <code>addCommand</code>.
* @returns {CKEDITOR.command} The command object identified by the
* provided name.
*/
getCommand : function( commandName )
{
return this._.commands[ commandName ];
},
/**
* Gets the editor data. The data will be in raw format. It is the same
* data that is posted by the editor.
* @type String
* @returns (String) The editor data.
* @example
* if ( CKEDITOR.instances.editor1.<strong>getData()</strong> == '' )
* alert( 'There is no data available' );
*/
getData : function()
{
this.fire( 'beforeGetData' );
var eventData = this._.data;
if ( typeof eventData != 'string' )
{
var element = this.element;
if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
eventData = element.is( 'textarea' ) ? element.getValue() : element.getHtml();
else
eventData = '';
}
eventData = { dataValue : eventData };
// Fire "getData" so data manipulation may happen.
this.fire( 'getData', eventData );
return eventData.dataValue;
},
/**
* Gets the "raw data" currently available in the editor. This is a
* fast method which returns the data as is, without processing, so it is
* not recommended to use it on resulting pages. Instead it can be used
* combined with the <code>{@link #loadSnapshot}</code> method in order
* to be able to automatically save the editor data from time to time
* while the user is using the editor, to avoid data loss, without risking
* performance issues.
* @see CKEDITOR.editor.getData
* @example
* alert( editor.getSnapshot() );
*/
getSnapshot : function()
{
var data = this.fire( 'getSnapshot' );
if ( typeof data != 'string' )
{
var element = this.element;
if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
data = element.is( 'textarea' ) ? element.getValue() : element.getHtml();
}
return data;
},
/**
* Loads "raw data" into the editor. The data is loaded with processing
* straight to the editing area. It should not be used as a way to load
* any kind of data, but instead in combination with
* <code>{@link #getSnapshot}</code> produced data.
* @see CKEDITOR.editor.setData
* @example
* var data = editor.getSnapshot();
* editor.<strong>loadSnapshot( data )</strong>;
*/
loadSnapshot : function( snapshot )
{
this.fire( 'loadSnapshot', snapshot );
},
/**
* Sets the editor data. The data must be provided in the raw format (HTML).<br />
* <br />
* Note that this method is asynchronous. The <code>callback</code> parameter must
* be used if interaction with the editor is needed after setting the data.
* @param {String} data HTML code to replace the curent content in the
* editor.
* @param {Function} callback Function to be called after the <code>setData</code>
* is completed.
*@param {Boolean} internal Whether to suppress any event firing when copying data
* internally inside the editor.
* @example
* CKEDITOR.instances.editor1.<strong>setData</strong>( '<p>This is the editor data.</p>' );
* @example
* CKEDITOR.instances.editor1.<strong>setData</strong>( '<p>Some other editor data.</p>', function()
* {
* this.checkDirty(); // true
* });
*/
setData : function( data , callback, internal )
{
if( callback )
{
this.on( 'dataReady', function( evt )
{
evt.removeListener();
callback.call( evt.editor );
} );
}
// Fire "setData" so data manipulation may happen.
var eventData = { dataValue : data };
!internal && this.fire( 'setData', eventData );
this._.data = eventData.dataValue;
!internal && this.fire( 'afterSetData', eventData );
},
/**
* Puts or restores the editor into read-only state. When in read-only,
* the user is not able to change the editor contents, but can still use
* some editor features. This function sets the <code>{@link CKEDITOR.config.readOnly}</code>
* property of the editor, firing the <code>{@link CKEDITOR.editor#readOnly}</code> event.<br><br>
* <strong>Note:</strong> the current editing area will be reloaded.
* @param {Boolean} [isReadOnly] Indicates that the editor must go
* read-only (<code>true</code>, default) or be restored and made editable
* (<code>false</code>).
* @since 3.6
*/
setReadOnly : function( isReadOnly )
{
isReadOnly = ( isReadOnly == undefined ) || isReadOnly;
if ( this.readOnly != isReadOnly )
{
this.readOnly = isReadOnly;
// Fire the readOnly event so the editor features can update
// their state accordingly.
this.fire( 'readOnly' );
}
},
/**
* Inserts HTML code into the currently selected position in the editor in WYSIWYG mode.
* @param {String} data HTML code to be inserted into the editor.
* @example
* CKEDITOR.instances.editor1.<strong>insertHtml( '<p>This is a new paragraph.</p>' )</strong>;
*/
insertHtml : function( data )
{
this.fire( 'insertHtml', data );
},
/**
* Insert text content into the currently selected position in the
* editor in WYSIWYG mode. The styles of the selected element will be applied to the inserted text.
* Spaces around the text will be leaving untouched.
* <strong>Note:</strong> two subsequent line-breaks will introduce one paragraph. This depends on <code>{@link CKEDITOR.config.enterMode}</code>;
* A single line-break will be instead translated into one <br />.
* @since 3.5
* @param {String} text Text to be inserted into the editor.
* @example
* CKEDITOR.instances.editor1.<strong>insertText( ' line1 \n\n line2' )</strong>;
*/
insertText : function( text )
{
this.fire( 'insertText', text );
},
/**
* Inserts an element into the currently selected position in the
* editor in WYSIWYG mode.
* @param {CKEDITOR.dom.element} element The element to be inserted
* into the editor.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( '<img src="hello.png" border="0" title="Hello" />' );
* CKEDITOR.instances.editor1.<strong>insertElement( element )</strong>;
*/
insertElement : function( element )
{
this.fire( 'insertElement', element );
},
/**
* Checks whether the current editor contents contain changes when
* compared to the contents loaded into the editor at startup, or to
* the contents available in the editor when <code>{@link #resetDirty}</code>
* was called.
* @returns {Boolean} "true" is the contents contain changes.
* @example
* function beforeUnload( e )
* {
* if ( CKEDITOR.instances.editor1.<strong>checkDirty()</strong> )
* return e.returnValue = "You will lose the changes made in the editor.";
* }
*
* if ( window.addEventListener )
* window.addEventListener( 'beforeunload', beforeUnload, false );
* else
* window.attachEvent( 'onbeforeunload', beforeUnload );
*/
checkDirty : function()
{
return ( this.mayBeDirty && this._.previousValue !== this.getSnapshot() );
},
/**
* Resets the "dirty state" of the editor so subsequent calls to
* <code>{@link #checkDirty}</code> will return <code>false</code> if the user will not
* have made further changes to the contents.
* @example
* alert( editor.checkDirty() ); // E.g. "true"
* editor.<strong>resetDirty()</strong>;
* alert( editor.checkDirty() ); // "false"
*/
resetDirty : function()
{
if ( this.mayBeDirty )
this._.previousValue = this.getSnapshot();
},
/**
* Updates the <code><textarea></code> element that was replaced by the editor with
* the current data available in the editor.
* @see CKEDITOR.editor.element
* @example
* CKEDITOR.instances.editor1.updateElement();
* alert( document.getElementById( 'editor1' ).value ); // The current editor data.
*/
updateElement : function()
{
var element = this.element;
if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
{
var data = this.getData();
if ( this.config.htmlEncodeOutput )
data = CKEDITOR.tools.htmlEncode( data );
if ( element.is( 'textarea' ) )
element.setValue( data );
else
element.setHtml( data );
}
}
});
CKEDITOR.on( 'loaded', function()
{
// Run the full initialization for pending editors.
var pending = CKEDITOR.editor._pending;
if ( pending )
{
delete CKEDITOR.editor._pending;
for ( var i = 0 ; i < pending.length ; i++ )
pending[ i ]._init();
}
});
/**
* Whether to escape HTML when the editor updates the original input element.
* @name CKEDITOR.config.htmlEncodeOutput
* @since 3.1
* @type Boolean
* @default false
* @example
* config.htmlEncodeOutput = true;
*/
/**
* If <code>true</code>, makes the editor start in read-only state. Otherwise, it will check
* if the linked <code><textarea></code> element has the <code>disabled</code> attribute.
* @name CKEDITOR.config.readOnly
* @see CKEDITOR.editor#setReadOnly
* @type Boolean
* @default false
* @since 3.6
* @example
* config.readOnly = true;
*/
/**
* Fired when a CKEDITOR instance is created, but still before initializing it.
* To interact with a fully initialized instance, use the
* <code>{@link CKEDITOR#instanceReady}</code> event instead.
* @name CKEDITOR#instanceCreated
* @event
* @param {CKEDITOR.editor} editor The editor instance that has been created.
*/
/**
* Fired when a CKEDITOR instance is destroyed.
* @name CKEDITOR#instanceDestroyed
* @event
* @param {CKEDITOR.editor} editor The editor instance that has been destroyed.
*/
/**
* Fired when the language is loaded into the editor instance.
* @name CKEDITOR.editor#langLoaded
* @event
* @since 3.6.1
* @param {CKEDITOR.editor} editor This editor instance.
*/
/**
* Fired when all plugins are loaded and initialized into the editor instance.
* @name CKEDITOR.editor#pluginsLoaded
* @event
* @param {CKEDITOR.editor} editor This editor instance.
*/
/**
* Fired before the command execution when <code>{@link #execCommand}</code> is called.
* @name CKEDITOR.editor#beforeCommandExec
* @event
* @param {CKEDITOR.editor} editor This editor instance.
* @param {String} data.name The command name.
* @param {Object} data.commandData The data to be sent to the command. This
* can be manipulated by the event listener.
* @param {CKEDITOR.command} data.command The command itself.
*/
/**
* Fired after the command execution when <code>{@link #execCommand}</code> is called.
* @name CKEDITOR.editor#afterCommandExec
* @event
* @param {CKEDITOR.editor} editor This editor instance.
* @param {String} data.name The command name.
* @param {Object} data.commandData The data sent to the command.
* @param {CKEDITOR.command} data.command The command itself.
* @param {Object} data.returnValue The value returned by the command execution.
*/
/**
* Fired when the custom configuration file is loaded, before the final
* configurations initialization.<br />
* <br />
* Custom configuration files can be loaded thorugh the
* <code>{@link CKEDITOR.config.customConfig}</code> setting. Several files can be loaded
* by changing this setting.
* @name CKEDITOR.editor#customConfigLoaded
* @event
* @param {CKEDITOR.editor} editor This editor instance.
*/
/**
* Fired once the editor configuration is ready (loaded and processed).
* @name CKEDITOR.editor#configLoaded
* @event
* @param {CKEDITOR.editor} editor This editor instance.
*/
/**
* Fired when this editor instance is destroyed. The editor at this
* point is not usable and this event should be used to perform the clean-up
* in any plugin.
* @name CKEDITOR.editor#destroy
* @event
*/
/**
* Internal event to get the current data.
* @name CKEDITOR.editor#beforeGetData
* @event
*/
/**
* Internal event to perform the <code>#getSnapshot</code> call.
* @name CKEDITOR.editor#getSnapshot
* @event
*/
/**
* Internal event to perform the <code>#loadSnapshot</code> call.
* @name CKEDITOR.editor#loadSnapshot
* @event
*/
/**
* Event fired before the <code>#getData</code> call returns allowing additional manipulation.
* @name CKEDITOR.editor#getData
* @event
* @param {CKEDITOR.editor} editor This editor instance.
* @param {String} data.dataValue The data that will be returned.
*/
/**
* Event fired before the <code>#setData</code> call is executed allowing additional manipulation.
* @name CKEDITOR.editor#setData
* @event
* @param {CKEDITOR.editor} editor This editor instance.
* @param {String} data.dataValue The data that will be used.
*/
/**
* Event fired at the end of the <code>#setData</code> call execution. Usually it is better to use the
* <code>{@link CKEDITOR.editor.prototype.dataReady}</code> event.
* @name CKEDITOR.editor#afterSetData
* @event
* @param {CKEDITOR.editor} editor This editor instance.
* @param {String} data.dataValue The data that has been set.
*/
/**
* Internal event to perform the <code>#insertHtml</code> call
* @name CKEDITOR.editor#insertHtml
* @event
* @param {CKEDITOR.editor} editor This editor instance.
* @param {String} data The HTML to insert.
*/
/**
* Internal event to perform the <code>#insertText</code> call
* @name CKEDITOR.editor#insertText
* @event
* @param {CKEDITOR.editor} editor This editor instance.
* @param {String} text The text to insert.
*/
/**
* Internal event to perform the <code>#insertElement</code> call
* @name CKEDITOR.editor#insertElement
* @event
* @param {CKEDITOR.editor} editor This editor instance.
* @param {Object} element The element to insert.
*/
/**
* Event fired after the <code>{@link CKEDITOR.editor#readOnly}</code> property changes.
* @name CKEDITOR.editor#readOnly
* @event
* @since 3.6
* @param {CKEDITOR.editor} editor This editor instance.
*/
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the "virtual" {@link CKEDITOR.commandDefinition} class,
* which contains the defintion of a command. This file is for
* documentation purposes only.
*/
/**
* (Virtual Class) Do not call this constructor. This class is not really part
* of the API.
* @name CKEDITOR.commandDefinition
* @class Virtual class that illustrates the features of command objects to be
* passed to the {@link CKEDITOR.editor.prototype.addCommand} function.
* @example
*/
/**
* The function to be fired when the commend is executed.
* @name CKEDITOR.commandDefinition.prototype.exec
* @function
* @param {CKEDITOR.editor} editor The editor within which run the command.
* @param {Object} [data] Additional data to be used to execute the command.
* @returns {Boolean} Whether the command has been successfully executed.
* Defaults to "true", if nothing is returned.
* @example
* editorInstance.addCommand( 'sample',
* {
* exec : function( editor )
* {
* alert( 'Executing a command for the editor name "' + editor.name + '"!' );
* }
* });
*/
/**
* Whether the command need to be hooked into the redo/undo system.
* @name CKEDITOR.commandDefinition.prototype.canUndo
* @type {Boolean}
* @default true
* @field
* @example
* editorInstance.addCommand( 'alertName',
* {
* exec : function( editor )
* {
* alert( editor.name );
* },
* canUndo : false // No support for undo/redo
* });
*/
/**
* Whether the command is asynchronous, which means that the
* {@link CKEDITOR.editor#event:afterCommandExec} event will be fired by the
* command itself manually, and that the return value of this command is not to
* be returned by the {@link CKEDITOR.command#exec} function.
* @name CKEDITOR.commandDefinition.prototype.async
* @default false
* @type {Boolean}
* @example
* editorInstance.addCommand( 'loadOptions',
* {
* exec : function( editor )
* {
* // Asynchronous operation below.
* CKEDITOR.ajax.loadXml( 'data.xml', function()
* {
* editor.fire( 'afterCommandExec' );
* ));
* },
* async : true // The command need some time to complete after exec function returns.
* });
*/
/**
* Whether the command should give focus to the editor before execution.
* @name CKEDITOR.commandDefinition.prototype.editorFocus
* @type {Boolean}
* @default true
* @see CKEDITOR.command#editorFocus
* @example
* editorInstance.addCommand( 'maximize',
* {
* exec : function( editor )
* {
* // ...
* },
* editorFocus : false // The command doesn't require focusing the editing document.
* });
*/
/**
* Whether the command state should be set to {@link CKEDITOR.TRISTATE_DISABLED} on startup.
* @name CKEDITOR.commandDefinition.prototype.startDisabled
* @type {Boolean}
* @default false
* @example
* editorInstance.addCommand( 'unlink',
* {
* exec : function( editor )
* {
* // ...
* },
* startDisabled : true // Command is unavailable until selection is inside a link.
* });
*/
/**
* The editor modes within which the command can be executed. The execution
* will have no action if the current mode is not listed in this property.
* @name CKEDITOR.commandDefinition.prototype.modes
* @type Object
* @default { wysiwyg : 1 }
* @see CKEDITOR.command#modes
* @example
* editorInstance.addCommand( 'link',
* {
* exec : function( editor )
* {
* // ...
* },
* modes : { wysiwyg : 1 } // Command is available in wysiwyg mode only.
* });
*/
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
/**
* Represents a list os CKEDITOR.dom.range objects, which can be easily
* iterated sequentially.
* @constructor
* @param {CKEDITOR.dom.range|Array} [ranges] The ranges contained on this list.
* Note that, if an array of ranges is specified, the range sequence
* should match its DOM order. This class will not help to sort them.
*/
CKEDITOR.dom.rangeList = function( ranges )
{
if ( ranges instanceof CKEDITOR.dom.rangeList )
return ranges;
if ( !ranges )
ranges = [];
else if ( ranges instanceof CKEDITOR.dom.range )
ranges = [ ranges ];
return CKEDITOR.tools.extend( ranges, mixins );
};
var mixins =
/** @lends CKEDITOR.dom.rangeList.prototype */
{
/**
* Creates an instance of the rangeList iterator, it should be used
* only when the ranges processing could be DOM intrusive, which
* means it may pollute and break other ranges in this list.
* Otherwise, it's enough to just iterate over this array in a for loop.
* @returns {CKEDITOR.dom.rangeListIterator}
*/
createIterator : function()
{
var rangeList = this,
bookmark = CKEDITOR.dom.walker.bookmark(),
guard = function( node ) { return ! ( node.is && node.is( 'tr' ) ); },
bookmarks = [],
current;
/**
* @lends CKEDITOR.dom.rangeListIterator.prototype
*/
return {
/**
* Retrieves the next range in the list.
* @param {Boolean} mergeConsequent Whether join two adjacent ranges into single, e.g. consequent table cells.
*/
getNextRange : function( mergeConsequent )
{
current = current == undefined ? 0 : current + 1;
var range = rangeList[ current ];
// Multiple ranges might be mangled by each other.
if ( range && rangeList.length > 1 )
{
// Bookmarking all other ranges on the first iteration,
// the range correctness after it doesn't matter since we'll
// restore them before the next iteration.
if ( !current )
{
// Make sure bookmark correctness by reverse processing.
for ( var i = rangeList.length - 1; i >= 0; i-- )
bookmarks.unshift( rangeList[ i ].createBookmark( true ) );
}
if ( mergeConsequent )
{
// Figure out how many ranges should be merged.
var mergeCount = 0;
while ( rangeList[ current + mergeCount + 1 ] )
{
var doc = range.document,
found = 0,
left = doc.getById( bookmarks[ mergeCount ].endNode ),
right = doc.getById( bookmarks[ mergeCount + 1 ].startNode ),
next;
// Check subsequent range.
while ( 1 )
{
next = left.getNextSourceNode( false );
if ( !right.equals( next ) )
{
// This could be yet another bookmark or
// walking across block boundaries.
if ( bookmark( next ) || ( next.type == CKEDITOR.NODE_ELEMENT && next.isBlockBoundary() ) )
{
left = next;
continue;
}
}
else
found = 1;
break;
}
if ( !found )
break;
mergeCount++;
}
}
range.moveToBookmark( bookmarks.shift() );
// Merge ranges finally after moving to bookmarks.
while( mergeCount-- )
{
next = rangeList[ ++current ];
next.moveToBookmark( bookmarks.shift() );
range.setEnd( next.endContainer, next.endOffset );
}
}
return range;
}
};
},
createBookmarks : function( serializable )
{
var retval = [], bookmark;
for ( var i = 0; i < this.length ; i++ )
{
retval.push( bookmark = this[ i ].createBookmark( serializable, true) );
// Updating the container & offset values for ranges
// that have been touched.
for ( var j = i + 1; j < this.length; j++ )
{
this[ j ] = updateDirtyRange( bookmark, this[ j ] );
this[ j ] = updateDirtyRange( bookmark, this[ j ], true );
}
}
return retval;
},
createBookmarks2 : function( normalized )
{
var bookmarks = [];
for ( var i = 0 ; i < this.length ; i++ )
bookmarks.push( this[ i ].createBookmark2( normalized ) );
return bookmarks;
},
/**
* Move each range in the list to the position specified by a list of bookmarks.
* @param {Array} bookmarks The list of bookmarks, each one matching a range in the list.
*/
moveToBookmarks : function( bookmarks )
{
for ( var i = 0 ; i < this.length ; i++ )
this[ i ].moveToBookmark( bookmarks[ i ] );
}
};
// Update the specified range which has been mangled by previous insertion of
// range bookmark nodes.(#3256)
function updateDirtyRange( bookmark, dirtyRange, checkEnd )
{
var serializable = bookmark.serializable,
container = dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ],
offset = checkEnd ? 'endOffset' : 'startOffset';
var bookmarkStart = serializable ?
dirtyRange.document.getById( bookmark.startNode )
: bookmark.startNode;
var bookmarkEnd = serializable ?
dirtyRange.document.getById( bookmark.endNode )
: bookmark.endNode;
if ( container.equals( bookmarkStart.getPrevious() ) )
{
dirtyRange.startOffset = dirtyRange.startOffset
- container.getLength()
- bookmarkEnd.getPrevious().getLength();
container = bookmarkEnd.getNext();
}
else if ( container.equals( bookmarkEnd.getPrevious() ) )
{
dirtyRange.startOffset = dirtyRange.startOffset - container.getLength();
container = bookmarkEnd.getNext();
}
container.equals( bookmarkStart.getParent() ) && dirtyRange[ offset ]++;
container.equals( bookmarkEnd.getParent() ) && dirtyRange[ offset ]++;
// Update and return this range.
dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ] = container;
return dirtyRange;
}
})();
/**
* (Virtual Class) Do not call this constructor. This class is not really part
* of the API. It just describes the return type of {@link CKEDITOR.dom.rangeList#createIterator}.
* @name CKEDITOR.dom.rangeListIterator
* @constructor
* @example
*/
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
// This function is to be called under a "walker" instance scope.
function iterate( rtl, breakOnFalse )
{
// Return null if we have reached the end.
if ( this._.end )
return null;
var node,
range = this.range,
guard,
userGuard = this.guard,
type = this.type,
getSourceNodeFn = ( rtl ? 'getPreviousSourceNode' : 'getNextSourceNode' );
// This is the first call. Initialize it.
if ( !this._.start )
{
this._.start = 1;
// Trim text nodes and optmize the range boundaries. DOM changes
// may happen at this point.
range.trim();
// A collapsed range must return null at first call.
if ( range.collapsed )
{
this.end();
return null;
}
}
// Create the LTR guard function, if necessary.
if ( !rtl && !this._.guardLTR )
{
// Gets the node that stops the walker when going LTR.
var limitLTR = range.endContainer,
blockerLTR = limitLTR.getChild( range.endOffset );
this._.guardLTR = function( node, movingOut )
{
return ( ( !movingOut || !limitLTR.equals( node ) )
&& ( !blockerLTR || !node.equals( blockerLTR ) )
&& ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) );
};
}
// Create the RTL guard function, if necessary.
if ( rtl && !this._.guardRTL )
{
// Gets the node that stops the walker when going LTR.
var limitRTL = range.startContainer,
blockerRTL = ( range.startOffset > 0 ) && limitRTL.getChild( range.startOffset - 1 );
this._.guardRTL = function( node, movingOut )
{
return ( ( !movingOut || !limitRTL.equals( node ) )
&& ( !blockerRTL || !node.equals( blockerRTL ) )
&& ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) );
};
}
// Define which guard function to use.
var stopGuard = rtl ? this._.guardRTL : this._.guardLTR;
// Make the user defined guard function participate in the process,
// otherwise simply use the boundary guard.
if ( userGuard )
{
guard = function( node, movingOut )
{
if ( stopGuard( node, movingOut ) === false )
return false;
return userGuard( node, movingOut );
};
}
else
guard = stopGuard;
if ( this.current )
node = this.current[ getSourceNodeFn ]( false, type, guard );
else
{
// Get the first node to be returned.
if ( rtl )
{
node = range.endContainer;
if ( range.endOffset > 0 )
{
node = node.getChild( range.endOffset - 1 );
if ( guard( node ) === false )
node = null;
}
else
node = ( guard ( node, true ) === false ) ?
null : node.getPreviousSourceNode( true, type, guard );
}
else
{
node = range.startContainer;
node = node.getChild( range.startOffset );
if ( node )
{
if ( guard( node ) === false )
node = null;
}
else
node = ( guard ( range.startContainer, true ) === false ) ?
null : range.startContainer.getNextSourceNode( true, type, guard ) ;
}
}
while ( node && !this._.end )
{
this.current = node;
if ( !this.evaluator || this.evaluator( node ) !== false )
{
if ( !breakOnFalse )
return node;
}
else if ( breakOnFalse && this.evaluator )
return false;
node = node[ getSourceNodeFn ]( false, type, guard );
}
this.end();
return this.current = null;
}
function iterateToLast( rtl )
{
var node, last = null;
while ( ( node = iterate.call( this, rtl ) ) )
last = node;
return last;
}
CKEDITOR.dom.walker = CKEDITOR.tools.createClass(
{
/**
* Utility class to "walk" the DOM inside a range boundaries. If
* necessary, partially included nodes (text nodes) are broken to
* reflect the boundaries limits, so DOM and range changes may happen.
* Outside changes to the range may break the walker.
*
* The walker may return nodes that are not totaly included into the
* range boundaires. Let's take the following range representation,
* where the square brackets indicate the boundaries:
*
* [<p>Some <b>sample] text</b>
*
* While walking forward into the above range, the following nodes are
* returned: <p>, "Some ", <b> and "sample". Going
* backwards instead we have: "sample" and "Some ". So note that the
* walker always returns nodes when "entering" them, but not when
* "leaving" them. The guard function is instead called both when
* entering and leaving nodes.
*
* @constructor
* @param {CKEDITOR.dom.range} range The range within which walk.
*/
$ : function( range )
{
this.range = range;
/**
* A function executed for every matched node, to check whether
* it's to be considered into the walk or not. If not provided, all
* matched nodes are considered good.
* If the function returns "false" the node is ignored.
* @name CKEDITOR.dom.walker.prototype.evaluator
* @property
* @type Function
*/
// this.evaluator = null;
/**
* A function executed for every node the walk pass by to check
* whether the walk is to be finished. It's called when both
* entering and exiting nodes, as well as for the matched nodes.
* If this function returns "false", the walking ends and no more
* nodes are evaluated.
* @name CKEDITOR.dom.walker.prototype.guard
* @property
* @type Function
*/
// this.guard = null;
/** @private */
this._ = {};
},
// statics :
// {
// /* Creates a CKEDITOR.dom.walker instance to walk inside DOM boundaries set by nodes.
// * @param {CKEDITOR.dom.node} startNode The node from wich the walk
// * will start.
// * @param {CKEDITOR.dom.node} [endNode] The last node to be considered
// * in the walk. No more nodes are retrieved after touching or
// * passing it. If not provided, the walker stops at the
// * <body> closing boundary.
// * @returns {CKEDITOR.dom.walker} A DOM walker for the nodes between the
// * provided nodes.
// */
// createOnNodes : function( startNode, endNode, startInclusive, endInclusive )
// {
// var range = new CKEDITOR.dom.range();
// if ( startNode )
// range.setStartAt( startNode, startInclusive ? CKEDITOR.POSITION_BEFORE_START : CKEDITOR.POSITION_AFTER_END ) ;
// else
// range.setStartAt( startNode.getDocument().getBody(), CKEDITOR.POSITION_AFTER_START ) ;
//
// if ( endNode )
// range.setEndAt( endNode, endInclusive ? CKEDITOR.POSITION_AFTER_END : CKEDITOR.POSITION_BEFORE_START ) ;
// else
// range.setEndAt( startNode.getDocument().getBody(), CKEDITOR.POSITION_BEFORE_END ) ;
//
// return new CKEDITOR.dom.walker( range );
// }
// },
//
proto :
{
/**
* Stop walking. No more nodes are retrieved if this function gets
* called.
*/
end : function()
{
this._.end = 1;
},
/**
* Retrieves the next node (at right).
* @returns {CKEDITOR.dom.node} The next node or null if no more
* nodes are available.
*/
next : function()
{
return iterate.call( this );
},
/**
* Retrieves the previous node (at left).
* @returns {CKEDITOR.dom.node} The previous node or null if no more
* nodes are available.
*/
previous : function()
{
return iterate.call( this, 1 );
},
/**
* Check all nodes at right, executing the evaluation fuction.
* @returns {Boolean} "false" if the evaluator function returned
* "false" for any of the matched nodes. Otherwise "true".
*/
checkForward : function()
{
return iterate.call( this, 0, 1 ) !== false;
},
/**
* Check all nodes at left, executing the evaluation fuction.
* @returns {Boolean} "false" if the evaluator function returned
* "false" for any of the matched nodes. Otherwise "true".
*/
checkBackward : function()
{
return iterate.call( this, 1, 1 ) !== false;
},
/**
* Executes a full walk forward (to the right), until no more nodes
* are available, returning the last valid node.
* @returns {CKEDITOR.dom.node} The last node at the right or null
* if no valid nodes are available.
*/
lastForward : function()
{
return iterateToLast.call( this );
},
/**
* Executes a full walk backwards (to the left), until no more nodes
* are available, returning the last valid node.
* @returns {CKEDITOR.dom.node} The last node at the left or null
* if no valid nodes are available.
*/
lastBackward : function()
{
return iterateToLast.call( this, 1 );
},
reset : function()
{
delete this.current;
this._ = {};
}
}
});
/*
* Anything whose display computed style is block, list-item, table,
* table-row-group, table-header-group, table-footer-group, table-row,
* table-column-group, table-column, table-cell, table-caption, or whose node
* name is hr, br (when enterMode is br only) is a block boundary.
*/
var blockBoundaryDisplayMatch =
{
block : 1,
'list-item' : 1,
table : 1,
'table-row-group' : 1,
'table-header-group' : 1,
'table-footer-group' : 1,
'table-row' : 1,
'table-column-group' : 1,
'table-column' : 1,
'table-cell' : 1,
'table-caption' : 1
};
CKEDITOR.dom.element.prototype.isBlockBoundary = function( customNodeNames )
{
var nodeNameMatches = customNodeNames ?
CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$block, customNodeNames || {} ) :
CKEDITOR.dtd.$block;
// Don't consider floated formatting as block boundary, fall back to dtd check in that case. (#6297)
return this.getComputedStyle( 'float' ) == 'none' && blockBoundaryDisplayMatch[ this.getComputedStyle( 'display' ) ]
|| nodeNameMatches[ this.getName() ];
};
CKEDITOR.dom.walker.blockBoundary = function( customNodeNames )
{
return function( node , type )
{
return ! ( node.type == CKEDITOR.NODE_ELEMENT
&& node.isBlockBoundary( customNodeNames ) );
};
};
CKEDITOR.dom.walker.listItemBoundary = function()
{
return this.blockBoundary( { br : 1 } );
};
/**
* Whether the to-be-evaluated node is a bookmark node OR bookmark node
* inner contents.
* @param {Boolean} contentOnly Whether only test againt the text content of
* bookmark node instead of the element itself(default).
* @param {Boolean} isReject Whether should return 'false' for the bookmark
* node instead of 'true'(default).
*/
CKEDITOR.dom.walker.bookmark = function( contentOnly, isReject )
{
function isBookmarkNode( node )
{
return ( node && node.getName
&& node.getName() == 'span'
&& node.data( 'cke-bookmark' ) );
}
return function( node )
{
var isBookmark, parent;
// Is bookmark inner text node?
isBookmark = ( node && !node.getName && ( parent = node.getParent() )
&& isBookmarkNode( parent ) );
// Is bookmark node?
isBookmark = contentOnly ? isBookmark : isBookmark || isBookmarkNode( node );
return !! ( isReject ^ isBookmark );
};
};
/**
* Whether the node is a text node containing only whitespaces characters.
* @param isReject
*/
CKEDITOR.dom.walker.whitespaces = function( isReject )
{
return function( node )
{
var isWhitespace = node && ( node.type == CKEDITOR.NODE_TEXT )
&& !CKEDITOR.tools.trim( node.getText() );
return !! ( isReject ^ isWhitespace );
};
};
/**
* Whether the node is invisible in wysiwyg mode.
* @param isReject
*/
CKEDITOR.dom.walker.invisible = function( isReject )
{
var whitespace = CKEDITOR.dom.walker.whitespaces();
return function( node )
{
// Nodes that take no spaces in wysiwyg:
// 1. White-spaces but not including NBSP;
// 2. Empty inline elements, e.g. <b></b> we're checking here
// 'offsetHeight' instead of 'offsetWidth' for properly excluding
// all sorts of empty paragraph, e.g. <br />.
var isInvisible = whitespace( node ) || node.is && !node.$.offsetHeight;
return !! ( isReject ^ isInvisible );
};
};
CKEDITOR.dom.walker.nodeType = function( type, isReject )
{
return function( node )
{
return !! ( isReject ^ ( node.type == type ) );
};
};
var tailNbspRegex = /^[\t\r\n ]*(?: |\xa0)$/,
isWhitespaces = CKEDITOR.dom.walker.whitespaces(),
isBookmark = CKEDITOR.dom.walker.bookmark(),
toSkip = function( node )
{
return isBookmark( node )
|| isWhitespaces( node )
|| node.type == CKEDITOR.NODE_ELEMENT
&& node.getName() in CKEDITOR.dtd.$inline
&& !( node.getName() in CKEDITOR.dtd.$empty );
};
// Check if there's a filler node at the end of an element, and return it.
CKEDITOR.dom.element.prototype.getBogus = function()
{
// Bogus are not always at the end, e.g. <p><a>text<br /></a></p> (#7070).
var tail = this;
do { tail = tail.getPreviousSourceNode(); }
while ( toSkip( tail ) )
if ( tail && ( !CKEDITOR.env.ie ? tail.is && tail.is( 'br' )
: tail.getText && tailNbspRegex.test( tail.getText() ) ) )
{
return tail;
}
return false;
};
})();
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.dom.event} class, which
* represents the a native DOM event object.
*/
/**
* Represents a native DOM event object.
* @constructor
* @param {Object} domEvent A native DOM event object.
* @example
*/
CKEDITOR.dom.event = function( domEvent )
{
/**
* The native DOM event object represented by this class instance.
* @type Object
* @example
*/
this.$ = domEvent;
};
CKEDITOR.dom.event.prototype =
{
/**
* Gets the key code associated to the event.
* @returns {Number} The key code.
* @example
* alert( event.getKey() ); "65" is "a" has been pressed
*/
getKey : function()
{
return this.$.keyCode || this.$.which;
},
/**
* Gets a number represeting the combination of the keys pressed during the
* event. It is the sum with the current key code and the {@link CKEDITOR.CTRL},
* {@link CKEDITOR.SHIFT} and {@link CKEDITOR.ALT} constants.
* @returns {Number} The number representing the keys combination.
* @example
* alert( event.getKeystroke() == 65 ); // "a" key
* alert( event.getKeystroke() == CKEDITOR.CTRL + 65 ); // CTRL + "a" key
* alert( event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65 ); // CTRL + SHIFT + "a" key
*/
getKeystroke : function()
{
var keystroke = this.getKey();
if ( this.$.ctrlKey || this.$.metaKey )
keystroke += CKEDITOR.CTRL;
if ( this.$.shiftKey )
keystroke += CKEDITOR.SHIFT;
if ( this.$.altKey )
keystroke += CKEDITOR.ALT;
return keystroke;
},
/**
* Prevents the original behavior of the event to happen. It can optionally
* stop propagating the event in the event chain.
* @param {Boolean} [stopPropagation] Stop propagating this event in the
* event chain.
* @example
* var element = CKEDITOR.document.getById( 'myElement' );
* element.on( 'click', function( ev )
* {
* // The DOM event object is passed by the "data" property.
* var domEvent = ev.data;
* // Prevent the click to chave any effect in the element.
* domEvent.preventDefault();
* });
*/
preventDefault : function( stopPropagation )
{
var $ = this.$;
if ( $.preventDefault )
$.preventDefault();
else
$.returnValue = false;
if ( stopPropagation )
this.stopPropagation();
},
stopPropagation : function()
{
var $ = this.$;
if ( $.stopPropagation )
$.stopPropagation();
else
$.cancelBubble = true;
},
/**
* Returns the DOM node where the event was targeted to.
* @returns {CKEDITOR.dom.node} The target DOM node.
* @example
* var element = CKEDITOR.document.getById( 'myElement' );
* element.on( 'click', function( ev )
* {
* // The DOM event object is passed by the "data" property.
* var domEvent = ev.data;
* // Add a CSS class to the event target.
* domEvent.getTarget().addClass( 'clicked' );
* });
*/
getTarget : function()
{
var rawNode = this.$.target || this.$.srcElement;
return rawNode ? new CKEDITOR.dom.node( rawNode ) : null;
}
};
// For the followind constants, we need to go over the Unicode boundaries
// (0x10FFFF) to avoid collision.
/**
* CTRL key (0x110000).
* @constant
* @example
*/
CKEDITOR.CTRL = 0x110000;
/**
* SHIFT key (0x220000).
* @constant
* @example
*/
CKEDITOR.SHIFT = 0x220000;
/**
* ALT key (0x440000).
* @constant
* @example
*/
CKEDITOR.ALT = 0x440000;
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.dom.document} class, which
* represents a DOM document.
*/
/**
* Represents a DOM window.
* @constructor
* @augments CKEDITOR.dom.domObject
* @param {Object} domWindow A native DOM window.
* @example
* var document = new CKEDITOR.dom.window( window );
*/
CKEDITOR.dom.window = function( domWindow )
{
CKEDITOR.dom.domObject.call( this, domWindow );
};
CKEDITOR.dom.window.prototype = new CKEDITOR.dom.domObject();
CKEDITOR.tools.extend( CKEDITOR.dom.window.prototype,
/** @lends CKEDITOR.dom.window.prototype */
{
/**
* Moves the selection focus to this window.
* @function
* @example
* var win = new CKEDITOR.dom.window( window );
* <b>win.focus()</b>;
*/
focus : function()
{
// Webkit is sometimes failed to focus iframe, blur it first(#3835).
if ( CKEDITOR.env.webkit && this.$.parent )
this.$.parent.focus();
this.$.focus();
},
/**
* Gets the width and height of this window's viewable area.
* @function
* @returns {Object} An object with the "width" and "height"
* properties containing the size.
* @example
* var win = new CKEDITOR.dom.window( window );
* var size = <b>win.getViewPaneSize()</b>;
* alert( size.width );
* alert( size.height );
*/
getViewPaneSize : function()
{
var doc = this.$.document,
stdMode = doc.compatMode == 'CSS1Compat';
return {
width : ( stdMode ? doc.documentElement.clientWidth : doc.body.clientWidth ) || 0,
height : ( stdMode ? doc.documentElement.clientHeight : doc.body.clientHeight ) || 0
};
},
/**
* Gets the current position of the window's scroll.
* @function
* @returns {Object} An object with the "x" and "y" properties
* containing the scroll position.
* @example
* var win = new CKEDITOR.dom.window( window );
* var pos = <b>win.getScrollPosition()</b>;
* alert( pos.x );
* alert( pos.y );
*/
getScrollPosition : function()
{
var $ = this.$;
if ( 'pageXOffset' in $ )
{
return {
x : $.pageXOffset || 0,
y : $.pageYOffset || 0
};
}
else
{
var doc = $.document;
return {
x : doc.documentElement.scrollLeft || doc.body.scrollLeft || 0,
y : doc.documentElement.scrollTop || doc.body.scrollTop || 0
};
}
}
});
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.dom.node} class which is the base
* class for classes that represent DOM nodes.
*/
/**
* Base class for classes representing DOM nodes. This constructor may return
* an instance of a class that inherits from this class, like
* {@link CKEDITOR.dom.element} or {@link CKEDITOR.dom.text}.
* @augments CKEDITOR.dom.domObject
* @param {Object} domNode A native DOM node.
* @constructor
* @see CKEDITOR.dom.element
* @see CKEDITOR.dom.text
* @example
*/
CKEDITOR.dom.node = function( domNode )
{
if ( domNode )
{
switch ( domNode.nodeType )
{
// Safari don't consider document as element node type. (#3389)
case CKEDITOR.NODE_DOCUMENT :
return new CKEDITOR.dom.document( domNode );
case CKEDITOR.NODE_ELEMENT :
return new CKEDITOR.dom.element( domNode );
case CKEDITOR.NODE_TEXT :
return new CKEDITOR.dom.text( domNode );
}
// Call the base constructor.
CKEDITOR.dom.domObject.call( this, domNode );
}
return this;
};
CKEDITOR.dom.node.prototype = new CKEDITOR.dom.domObject();
/**
* Element node type.
* @constant
* @example
*/
CKEDITOR.NODE_ELEMENT = 1;
/**
* Document node type.
* @constant
* @example
*/
CKEDITOR.NODE_DOCUMENT = 9;
/**
* Text node type.
* @constant
* @example
*/
CKEDITOR.NODE_TEXT = 3;
/**
* Comment node type.
* @constant
* @example
*/
CKEDITOR.NODE_COMMENT = 8;
CKEDITOR.NODE_DOCUMENT_FRAGMENT = 11;
CKEDITOR.POSITION_IDENTICAL = 0;
CKEDITOR.POSITION_DISCONNECTED = 1;
CKEDITOR.POSITION_FOLLOWING = 2;
CKEDITOR.POSITION_PRECEDING = 4;
CKEDITOR.POSITION_IS_CONTAINED = 8;
CKEDITOR.POSITION_CONTAINS = 16;
CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype,
/** @lends CKEDITOR.dom.node.prototype */
{
/**
* Makes this node a child of another element.
* @param {CKEDITOR.dom.element} element The target element to which
* this node will be appended.
* @returns {CKEDITOR.dom.element} The target element.
* @example
* var p = new CKEDITOR.dom.element( 'p' );
* var strong = new CKEDITOR.dom.element( 'strong' );
* strong.appendTo( p );
*
* // result: "<p><strong></strong></p>"
*/
appendTo : function( element, toStart )
{
element.append( this, toStart );
return element;
},
clone : function( includeChildren, cloneId )
{
var $clone = this.$.cloneNode( includeChildren );
var removeIds = function( node )
{
if ( node.nodeType != CKEDITOR.NODE_ELEMENT )
return;
if ( !cloneId )
node.removeAttribute( 'id', false );
node.removeAttribute( 'data-cke-expando', false );
if ( includeChildren )
{
var childs = node.childNodes;
for ( var i=0; i < childs.length; i++ )
removeIds( childs[ i ] );
}
};
// The "id" attribute should never be cloned to avoid duplication.
removeIds( $clone );
return new CKEDITOR.dom.node( $clone );
},
hasPrevious : function()
{
return !!this.$.previousSibling;
},
hasNext : function()
{
return !!this.$.nextSibling;
},
/**
* Inserts this element after a node.
* @param {CKEDITOR.dom.node} node The node that will precede this element.
* @returns {CKEDITOR.dom.node} The node preceding this one after
* insertion.
* @example
* var em = new CKEDITOR.dom.element( 'em' );
* var strong = new CKEDITOR.dom.element( 'strong' );
* strong.insertAfter( em );
*
* // result: "<em></em><strong></strong>"
*/
insertAfter : function( node )
{
node.$.parentNode.insertBefore( this.$, node.$.nextSibling );
return node;
},
/**
* Inserts this element before a node.
* @param {CKEDITOR.dom.node} node The node that will succeed this element.
* @returns {CKEDITOR.dom.node} The node being inserted.
* @example
* var em = new CKEDITOR.dom.element( 'em' );
* var strong = new CKEDITOR.dom.element( 'strong' );
* strong.insertBefore( em );
*
* // result: "<strong></strong><em></em>"
*/
insertBefore : function( node )
{
node.$.parentNode.insertBefore( this.$, node.$ );
return node;
},
insertBeforeMe : function( node )
{
this.$.parentNode.insertBefore( node.$, this.$ );
return node;
},
/**
* Retrieves a uniquely identifiable tree address for this node.
* The tree address returned is an array of integers, with each integer
* indicating a child index of a DOM node, starting from
* <code>document.documentElement</code>.
*
* For example, assuming <code><body></code> is the second child
* of <code><html></code> (<code><head></code> being the first),
* and we would like to address the third child under the
* fourth child of <code><body></code>, the tree address returned would be:
* [1, 3, 2]
*
* The tree address cannot be used for finding back the DOM tree node once
* the DOM tree structure has been modified.
*/
getAddress : function( normalized )
{
var address = [];
var $documentElement = this.getDocument().$.documentElement;
var node = this.$;
while ( node && node != $documentElement )
{
var parentNode = node.parentNode;
if ( parentNode )
{
// Get the node index. For performance, call getIndex
// directly, instead of creating a new node object.
address.unshift( this.getIndex.call( { $ : node }, normalized ) );
}
node = parentNode;
}
return address;
},
/**
* Gets the document containing this element.
* @returns {CKEDITOR.dom.document} The document.
* @example
* var element = CKEDITOR.document.getById( 'example' );
* alert( <strong>element.getDocument().equals( CKEDITOR.document )</strong> ); // "true"
*/
getDocument : function()
{
return new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument );
},
getIndex : function( normalized )
{
// Attention: getAddress depends on this.$
var current = this.$,
index = 0;
while ( ( current = current.previousSibling ) )
{
// When normalizing, do not count it if this is an
// empty text node or if it's a text node following another one.
if ( normalized && current.nodeType == 3 &&
( !current.nodeValue.length ||
( current.previousSibling && current.previousSibling.nodeType == 3 ) ) )
{
continue;
}
index++;
}
return index;
},
getNextSourceNode : function( startFromSibling, nodeType, guard )
{
// If "guard" is a node, transform it in a function.
if ( guard && !guard.call )
{
var guardNode = guard;
guard = function( node )
{
return !node.equals( guardNode );
};
}
var node = ( !startFromSibling && this.getFirst && this.getFirst() ),
parent;
// Guarding when we're skipping the current element( no children or 'startFromSibling' ).
// send the 'moving out' signal even we don't actually dive into.
if ( !node )
{
if ( this.type == CKEDITOR.NODE_ELEMENT && guard && guard( this, true ) === false )
return null;
node = this.getNext();
}
while ( !node && ( parent = ( parent || this ).getParent() ) )
{
// The guard check sends the "true" paramenter to indicate that
// we are moving "out" of the element.
if ( guard && guard( parent, true ) === false )
return null;
node = parent.getNext();
}
if ( !node )
return null;
if ( guard && guard( node ) === false )
return null;
if ( nodeType && nodeType != node.type )
return node.getNextSourceNode( false, nodeType, guard );
return node;
},
getPreviousSourceNode : function( startFromSibling, nodeType, guard )
{
if ( guard && !guard.call )
{
var guardNode = guard;
guard = function( node )
{
return !node.equals( guardNode );
};
}
var node = ( !startFromSibling && this.getLast && this.getLast() ),
parent;
// Guarding when we're skipping the current element( no children or 'startFromSibling' ).
// send the 'moving out' signal even we don't actually dive into.
if ( !node )
{
if ( this.type == CKEDITOR.NODE_ELEMENT && guard && guard( this, true ) === false )
return null;
node = this.getPrevious();
}
while ( !node && ( parent = ( parent || this ).getParent() ) )
{
// The guard check sends the "true" paramenter to indicate that
// we are moving "out" of the element.
if ( guard && guard( parent, true ) === false )
return null;
node = parent.getPrevious();
}
if ( !node )
return null;
if ( guard && guard( node ) === false )
return null;
if ( nodeType && node.type != nodeType )
return node.getPreviousSourceNode( false, nodeType, guard );
return node;
},
getPrevious : function( evaluator )
{
var previous = this.$, retval;
do
{
previous = previous.previousSibling;
retval = previous && new CKEDITOR.dom.node( previous );
}
while ( retval && evaluator && !evaluator( retval ) )
return retval;
},
/**
* Gets the node that follows this element in its parent's child list.
* @param {Function} evaluator Filtering the result node.
* @returns {CKEDITOR.dom.node} The next node or null if not available.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( '<div><b>Example</b> <i>next</i></div>' );
* var first = <strong>element.getFirst().getNext()</strong>;
* alert( first.getName() ); // "i"
*/
getNext : function( evaluator )
{
var next = this.$, retval;
do
{
next = next.nextSibling;
retval = next && new CKEDITOR.dom.node( next );
}
while ( retval && evaluator && !evaluator( retval ) )
return retval;
},
/**
* Gets the parent element for this node.
* @returns {CKEDITOR.dom.element} The parent element.
* @example
* var node = editor.document.getBody().getFirst();
* var parent = node.<strong>getParent()</strong>;
* alert( node.getName() ); // "body"
*/
getParent : function()
{
var parent = this.$.parentNode;
return ( parent && parent.nodeType == 1 ) ? new CKEDITOR.dom.node( parent ) : null;
},
getParents : function( closerFirst )
{
var node = this;
var parents = [];
do
{
parents[ closerFirst ? 'push' : 'unshift' ]( node );
}
while ( ( node = node.getParent() ) )
return parents;
},
getCommonAncestor : function( node )
{
if ( node.equals( this ) )
return this;
if ( node.contains && node.contains( this ) )
return node;
var start = this.contains ? this : this.getParent();
do
{
if ( start.contains( node ) )
return start;
}
while ( ( start = start.getParent() ) );
return null;
},
getPosition : function( otherNode )
{
var $ = this.$;
var $other = otherNode.$;
if ( $.compareDocumentPosition )
return $.compareDocumentPosition( $other );
// IE and Safari have no support for compareDocumentPosition.
if ( $ == $other )
return CKEDITOR.POSITION_IDENTICAL;
// Only element nodes support contains and sourceIndex.
if ( this.type == CKEDITOR.NODE_ELEMENT && otherNode.type == CKEDITOR.NODE_ELEMENT )
{
if ( $.contains )
{
if ( $.contains( $other ) )
return CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING;
if ( $other.contains( $ ) )
return CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING;
}
if ( 'sourceIndex' in $ )
{
return ( $.sourceIndex < 0 || $other.sourceIndex < 0 ) ? CKEDITOR.POSITION_DISCONNECTED :
( $.sourceIndex < $other.sourceIndex ) ? CKEDITOR.POSITION_PRECEDING :
CKEDITOR.POSITION_FOLLOWING;
}
}
// For nodes that don't support compareDocumentPosition, contains
// or sourceIndex, their "address" is compared.
var addressOfThis = this.getAddress(),
addressOfOther = otherNode.getAddress(),
minLevel = Math.min( addressOfThis.length, addressOfOther.length );
// Determinate preceed/follow relationship.
for ( var i = 0 ; i <= minLevel - 1 ; i++ )
{
if ( addressOfThis[ i ] != addressOfOther[ i ] )
{
if ( i < minLevel )
{
return addressOfThis[ i ] < addressOfOther[ i ] ?
CKEDITOR.POSITION_PRECEDING : CKEDITOR.POSITION_FOLLOWING;
}
break;
}
}
// Determinate contains/contained relationship.
return ( addressOfThis.length < addressOfOther.length ) ?
CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING :
CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING;
},
/**
* Gets the closest ancestor node of this node, specified by its name.
* @param {String} reference The name of the ancestor node to search or
* an object with the node names to search for.
* @param {Boolean} [includeSelf] Whether to include the current
* node in the search.
* @returns {CKEDITOR.dom.node} The located ancestor node or null if not found.
* @since 3.6.1
* @example
* // Suppose we have the following HTML structure:
* // <div id="outer"><div id="inner"><p><b>Some text</b></p></div></div>
* // If node == <b>
* ascendant = node.getAscendant( 'div' ); // ascendant == <div id="inner">
* ascendant = node.getAscendant( 'b' ); // ascendant == null
* ascendant = node.getAscendant( 'b', true ); // ascendant == <b>
* ascendant = node.getAscendant( { div: 1, p: 1} ); // Searches for the first 'div' or 'p': ascendant == <div id="inner">
*/
getAscendant : function( reference, includeSelf )
{
var $ = this.$,
name;
if ( !includeSelf )
$ = $.parentNode;
while ( $ )
{
if ( $.nodeName && ( name = $.nodeName.toLowerCase(), ( typeof reference == 'string' ? name == reference : name in reference ) ) )
return new CKEDITOR.dom.node( $ );
$ = $.parentNode;
}
return null;
},
hasAscendant : function( name, includeSelf )
{
var $ = this.$;
if ( !includeSelf )
$ = $.parentNode;
while ( $ )
{
if ( $.nodeName && $.nodeName.toLowerCase() == name )
return true;
$ = $.parentNode;
}
return false;
},
move : function( target, toStart )
{
target.append( this.remove(), toStart );
},
/**
* Removes this node from the document DOM.
* @param {Boolean} [preserveChildren] Indicates that the children
* elements must remain in the document, removing only the outer
* tags.
* @example
* var element = CKEDITOR.dom.element.getById( 'MyElement' );
* <strong>element.remove()</strong>;
*/
remove : function( preserveChildren )
{
var $ = this.$;
var parent = $.parentNode;
if ( parent )
{
if ( preserveChildren )
{
// Move all children before the node.
for ( var child ; ( child = $.firstChild ) ; )
{
parent.insertBefore( $.removeChild( child ), $ );
}
}
parent.removeChild( $ );
}
return this;
},
replace : function( nodeToReplace )
{
this.insertBefore( nodeToReplace );
nodeToReplace.remove();
},
trim : function()
{
this.ltrim();
this.rtrim();
},
ltrim : function()
{
var child;
while ( this.getFirst && ( child = this.getFirst() ) )
{
if ( child.type == CKEDITOR.NODE_TEXT )
{
var trimmed = CKEDITOR.tools.ltrim( child.getText() ),
originalLength = child.getLength();
if ( !trimmed )
{
child.remove();
continue;
}
else if ( trimmed.length < originalLength )
{
child.split( originalLength - trimmed.length );
// IE BUG: child.remove() may raise JavaScript errors here. (#81)
this.$.removeChild( this.$.firstChild );
}
}
break;
}
},
rtrim : function()
{
var child;
while ( this.getLast && ( child = this.getLast() ) )
{
if ( child.type == CKEDITOR.NODE_TEXT )
{
var trimmed = CKEDITOR.tools.rtrim( child.getText() ),
originalLength = child.getLength();
if ( !trimmed )
{
child.remove();
continue;
}
else if ( trimmed.length < originalLength )
{
child.split( trimmed.length );
// IE BUG: child.getNext().remove() may raise JavaScript errors here.
// (#81)
this.$.lastChild.parentNode.removeChild( this.$.lastChild );
}
}
break;
}
if ( !CKEDITOR.env.ie && !CKEDITOR.env.opera )
{
child = this.$.lastChild;
if ( child && child.type == 1 && child.nodeName.toLowerCase() == 'br' )
{
// Use "eChildNode.parentNode" instead of "node" to avoid IE bug (#324).
child.parentNode.removeChild( child ) ;
}
}
},
/**
* Checks if this node is read-only (should not be changed).
* @returns {Boolean}
* @since 3.5
* @example
* // For the following HTML:
* // <div contenteditable="false">Some <b>text</b></div>
*
* // If "ele" is the above <div>
* ele.isReadOnly(); // true
*/
isReadOnly : function()
{
var element = this;
if ( this.type != CKEDITOR.NODE_ELEMENT )
element = this.getParent();
if ( element && typeof element.$.isContentEditable != 'undefined' )
return ! ( element.$.isContentEditable || element.data( 'cke-editable' ) );
else
{
// Degrade for old browsers which don't support "isContentEditable", e.g. FF3
var current = element;
while( current )
{
if ( current.is( 'body' ) || !!current.data( 'cke-editable' ) )
break;
if ( current.getAttribute( 'contentEditable' ) == 'false' )
return true;
else if ( current.getAttribute( 'contentEditable' ) == 'true' )
break;
current = current.getParent();
}
return false;
}
}
}
);
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.dom.comment} class, which represents
* a DOM comment node.
*/
CKEDITOR.dom.comment = CKEDITOR.tools.createClass(
{
base : CKEDITOR.dom.node,
$ : function( text, ownerDocument )
{
if ( typeof text == 'string' )
text = ( ownerDocument ? ownerDocument.$ : document ).createComment( text );
this.base( text );
},
proto :
{
type : CKEDITOR.NODE_COMMENT,
getOuterHtml : function()
{
return '<!--' + this.$.nodeValue + '-->';
}
}
});
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.dom.document} class, which
* represents a DOM document.
*/
/**
* Represents a DOM document.
* @constructor
* @augments CKEDITOR.dom.domObject
* @param {Object} domDocument A native DOM document.
* @example
* var document = new CKEDITOR.dom.document( document );
*/
CKEDITOR.dom.document = function( domDocument )
{
CKEDITOR.dom.domObject.call( this, domDocument );
};
// PACKAGER_RENAME( CKEDITOR.dom.document )
CKEDITOR.dom.document.prototype = new CKEDITOR.dom.domObject();
CKEDITOR.tools.extend( CKEDITOR.dom.document.prototype,
/** @lends CKEDITOR.dom.document.prototype */
{
/**
* Appends a CSS file to the document.
* @param {String} cssFileUrl The CSS file URL.
* @example
* <b>CKEDITOR.document.appendStyleSheet( '/mystyles.css' )</b>;
*/
appendStyleSheet : function( cssFileUrl )
{
if ( this.$.createStyleSheet )
this.$.createStyleSheet( cssFileUrl );
else
{
var link = new CKEDITOR.dom.element( 'link' );
link.setAttributes(
{
rel :'stylesheet',
type : 'text/css',
href : cssFileUrl
});
this.getHead().append( link );
}
},
appendStyleText : function( cssStyleText )
{
if ( this.$.createStyleSheet )
{
var styleSheet = this.$.createStyleSheet( "" );
styleSheet.cssText = cssStyleText ;
}
else
{
var style = new CKEDITOR.dom.element( 'style', this );
style.append( new CKEDITOR.dom.text( cssStyleText, this ) );
this.getHead().append( style );
}
},
createElement : function( name, attribsAndStyles )
{
var element = new CKEDITOR.dom.element( name, this );
if ( attribsAndStyles )
{
if ( attribsAndStyles.attributes )
element.setAttributes( attribsAndStyles.attributes );
if ( attribsAndStyles.styles )
element.setStyles( attribsAndStyles.styles );
}
return element;
},
createText : function( text )
{
return new CKEDITOR.dom.text( text, this );
},
focus : function()
{
this.getWindow().focus();
},
/**
* Gets and element based on its id.
* @param {String} elementId The element id.
* @returns {CKEDITOR.dom.element} The element instance, or null if not found.
* @example
* var element = <b>CKEDITOR.document.getById( 'myElement' )</b>;
* alert( element.getId() ); // "myElement"
*/
getById : function( elementId )
{
var $ = this.$.getElementById( elementId );
return $ ? new CKEDITOR.dom.element( $ ) : null;
},
getByAddress : function( address, normalized )
{
var $ = this.$.documentElement;
for ( var i = 0 ; $ && i < address.length ; i++ )
{
var target = address[ i ];
if ( !normalized )
{
$ = $.childNodes[ target ];
continue;
}
var currentIndex = -1;
for (var j = 0 ; j < $.childNodes.length ; j++ )
{
var candidate = $.childNodes[ j ];
if ( normalized === true &&
candidate.nodeType == 3 &&
candidate.previousSibling &&
candidate.previousSibling.nodeType == 3 )
{
continue;
}
currentIndex++;
if ( currentIndex == target )
{
$ = candidate;
break;
}
}
}
return $ ? new CKEDITOR.dom.node( $ ) : null;
},
getElementsByTag : function( tagName, namespace )
{
if ( !( CKEDITOR.env.ie && ! ( document.documentMode > 8 ) ) && namespace )
tagName = namespace + ':' + tagName;
return new CKEDITOR.dom.nodeList( this.$.getElementsByTagName( tagName ) );
},
/**
* Gets the <head> element for this document.
* @returns {CKEDITOR.dom.element} The <head> element.
* @example
* var element = <b>CKEDITOR.document.getHead()</b>;
* alert( element.getName() ); // "head"
*/
getHead : function()
{
var head = this.$.getElementsByTagName( 'head' )[0];
if ( !head )
head = this.getDocumentElement().append( new CKEDITOR.dom.element( 'head' ), true );
else
head = new CKEDITOR.dom.element( head );
return (
this.getHead = function()
{
return head;
})();
},
/**
* Gets the <body> element for this document.
* @returns {CKEDITOR.dom.element} The <body> element.
* @example
* var element = <b>CKEDITOR.document.getBody()</b>;
* alert( element.getName() ); // "body"
*/
getBody : function()
{
var body = new CKEDITOR.dom.element( this.$.body );
return (
this.getBody = function()
{
return body;
})();
},
/**
* Gets the DOM document element for this document.
* @returns {CKEDITOR.dom.element} The DOM document element.
*/
getDocumentElement : function()
{
var documentElement = new CKEDITOR.dom.element( this.$.documentElement );
return (
this.getDocumentElement = function()
{
return documentElement;
})();
},
/**
* Gets the window object that holds this document.
* @returns {CKEDITOR.dom.window} The window object.
*/
getWindow : function()
{
var win = new CKEDITOR.dom.window( this.$.parentWindow || this.$.defaultView );
return (
this.getWindow = function()
{
return win;
})();
},
/**
* Defines the document contents through document.write. Note that the
* previous document contents will be lost (cleaned).
* @since 3.5
* @param {String} html The HTML defining the document contents.
* @example
* document.write(
* '<html>' +
* '<head><title>Sample Doc</title></head>' +
* '<body>Document contents created by code</body>' +
* '</html>' );
*/
write : function( html )
{
// Don't leave any history log in IE. (#5657)
this.$.open( 'text/html', 'replace' );
// Support for custom document.domain in IE.
CKEDITOR.env.isCustomDomain() && ( this.$.domain = document.domain );
this.$.write( html );
this.$.close();
}
});
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
// Elements that may be considered the "Block boundary" in an element path.
var pathBlockElements = { address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1, legend:1,caption:1 };
// Elements that may be considered the "Block limit" in an element path.
var pathBlockLimitElements = { body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,form:1,fieldset:1 };
// Check if an element contains any block element.
var checkHasBlock = function( element )
{
var childNodes = element.getChildren();
for ( var i = 0, count = childNodes.count() ; i < count ; i++ )
{
var child = childNodes.getItem( i );
if ( child.type == CKEDITOR.NODE_ELEMENT && CKEDITOR.dtd.$block[ child.getName() ] )
return true;
}
return false;
};
/**
* @class
*/
CKEDITOR.dom.elementPath = function( lastNode )
{
var block = null;
var blockLimit = null;
var elements = [];
var e = lastNode;
while ( e )
{
if ( e.type == CKEDITOR.NODE_ELEMENT )
{
if ( !this.lastElement )
this.lastElement = e;
var elementName = e.getName();
if ( CKEDITOR.env.ie && e.$.scopeName != 'HTML' )
elementName = e.$.scopeName.toLowerCase() + ':' + elementName;
if ( !blockLimit )
{
if ( !block && pathBlockElements[ elementName ] )
block = e;
if ( pathBlockLimitElements[ elementName ] )
{
// DIV is considered the Block, if no block is available (#525)
// and if it doesn't contain other blocks.
if ( !block && elementName == 'div' && !checkHasBlock( e ) )
block = e;
else
blockLimit = e;
}
}
elements.push( e );
if ( elementName == 'body' )
break;
}
e = e.getParent();
}
this.block = block;
this.blockLimit = blockLimit;
this.elements = elements;
};
})();
CKEDITOR.dom.elementPath.prototype =
{
/**
* Compares this element path with another one.
* @param {CKEDITOR.dom.elementPath} otherPath The elementPath object to be
* compared with this one.
* @returns {Boolean} "true" if the paths are equal, containing the same
* number of elements and the same elements in the same order.
*/
compare : function( otherPath )
{
var thisElements = this.elements;
var otherElements = otherPath && otherPath.elements;
if ( !otherElements || thisElements.length != otherElements.length )
return false;
for ( var i = 0 ; i < thisElements.length ; i++ )
{
if ( !thisElements[ i ].equals( otherElements[ i ] ) )
return false;
}
return true;
},
contains : function( tagNames )
{
var elements = this.elements;
for ( var i = 0 ; i < elements.length ; i++ )
{
if ( elements[ i ].getName() in tagNames )
return elements[ i ];
}
return null;
}
};
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.dom.text} class, which represents
* a DOM text node.
*/
/**
* Represents a DOM text node.
* @constructor
* @augments CKEDITOR.dom.node
* @param {Object|String} text A native DOM text node or a string containing
* the text to use to create a new text node.
* @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
* the node in case of new node creation. Defaults to the current document.
* @example
* var nativeNode = document.createTextNode( 'Example' );
* var text = CKEDITOR.dom.text( nativeNode );
* @example
* var text = CKEDITOR.dom.text( 'Example' );
*/
CKEDITOR.dom.text = function( text, ownerDocument )
{
if ( typeof text == 'string' )
text = ( ownerDocument ? ownerDocument.$ : document ).createTextNode( text );
// Theoretically, we should call the base constructor here
// (not CKEDITOR.dom.node though). But, IE doesn't support expando
// properties on text node, so the features provided by domObject will not
// work for text nodes (which is not a big issue for us).
//
// CKEDITOR.dom.domObject.call( this, element );
/**
* The native DOM text node represented by this class instance.
* @type Object
* @example
* var element = new CKEDITOR.dom.text( 'Example' );
* alert( element.$.nodeType ); // "3"
*/
this.$ = text;
};
CKEDITOR.dom.text.prototype = new CKEDITOR.dom.node();
CKEDITOR.tools.extend( CKEDITOR.dom.text.prototype,
/** @lends CKEDITOR.dom.text.prototype */
{
/**
* The node type. This is a constant value set to
* {@link CKEDITOR.NODE_TEXT}.
* @type Number
* @example
*/
type : CKEDITOR.NODE_TEXT,
getLength : function()
{
return this.$.nodeValue.length;
},
getText : function()
{
return this.$.nodeValue;
},
setText : function( text )
{
this.$.nodeValue = text;
},
/**
* Breaks this text node into two nodes at the specified offset,
* keeping both in the tree as siblings. This node then only contains
* all the content up to the offset point. A new text node, which is
* inserted as the next sibling of this node, contains all the content
* at and after the offset point. When the offset is equal to the
* length of this node, the new node has no data.
* @param {Number} The position at which to split, starting from zero.
* @returns {CKEDITOR.dom.text} The new text node.
*/
split : function( offset )
{
// If the offset is after the last char, IE creates the text node
// on split, but don't include it into the DOM. So, we have to do
// that manually here.
if ( CKEDITOR.env.ie && offset == this.getLength() )
{
var next = this.getDocument().createText( '' );
next.insertAfter( this );
return next;
}
var doc = this.getDocument();
var retval = new CKEDITOR.dom.text( this.$.splitText( offset ), doc );
// IE BUG: IE8 does not update the childNodes array in DOM after splitText(),
// we need to make some DOM changes to make it update. (#3436)
if ( CKEDITOR.env.ie8 )
{
var workaround = new CKEDITOR.dom.text( '', doc );
workaround.insertAfter( retval );
workaround.remove();
}
return retval;
},
/**
* Extracts characters from indexA up to but not including indexB.
* @param {Number} indexA An integer between 0 and one less than the
* length of the text.
* @param {Number} [indexB] An integer between 0 and the length of the
* string. If omitted, extracts characters to the end of the text.
*/
substring : function( indexA, indexB )
{
// We need the following check due to a Firefox bug
// https://bugzilla.mozilla.org/show_bug.cgi?id=458886
if ( typeof indexB != 'number' )
return this.$.nodeValue.substr( indexA );
else
return this.$.nodeValue.substring( indexA, indexB );
}
});
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.editor} class, which is the base
* for other classes representing DOM objects.
*/
/**
* Represents a DOM object. This class is not intended to be used directly. It
* serves as the base class for other classes representing specific DOM
* objects.
* @constructor
* @param {Object} nativeDomObject A native DOM object.
* @augments CKEDITOR.event
* @example
*/
CKEDITOR.dom.domObject = function( nativeDomObject )
{
if ( nativeDomObject )
{
/**
* The native DOM object represented by this class instance.
* @type Object
* @example
* var element = new CKEDITOR.dom.element( 'span' );
* alert( element.$.nodeType ); // "1"
*/
this.$ = nativeDomObject;
}
};
CKEDITOR.dom.domObject.prototype = (function()
{
// Do not define other local variables here. We want to keep the native
// listener closures as clean as possible.
var getNativeListener = function( domObject, eventName )
{
return function( domEvent )
{
// In FF, when reloading the page with the editor focused, it may
// throw an error because the CKEDITOR global is not anymore
// available. So, we check it here first. (#2923)
if ( typeof CKEDITOR != 'undefined' )
domObject.fire( eventName, new CKEDITOR.dom.event( domEvent ) );
};
};
return /** @lends CKEDITOR.dom.domObject.prototype */ {
getPrivate : function()
{
var priv;
// Get the main private function from the custom data. Create it if not
// defined.
if ( !( priv = this.getCustomData( '_' ) ) )
this.setCustomData( '_', ( priv = {} ) );
return priv;
},
/** @ignore */
on : function( eventName )
{
// We customize the "on" function here. The basic idea is that we'll have
// only one listener for a native event, which will then call all listeners
// set to the event.
// Get the listeners holder object.
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
if ( !nativeListeners )
{
nativeListeners = {};
this.setCustomData( '_cke_nativeListeners', nativeListeners );
}
// Check if we have a listener for that event.
if ( !nativeListeners[ eventName ] )
{
var listener = nativeListeners[ eventName ] = getNativeListener( this, eventName );
if ( this.$.attachEvent )
this.$.attachEvent( 'on' + eventName, listener );
else if ( this.$.addEventListener )
this.$.addEventListener( eventName, listener, !!CKEDITOR.event.useCapture );
}
// Call the original implementation.
return CKEDITOR.event.prototype.on.apply( this, arguments );
},
/** @ignore */
removeListener : function( eventName )
{
// Call the original implementation.
CKEDITOR.event.prototype.removeListener.apply( this, arguments );
// If we don't have listeners for this event, clean the DOM up.
if ( !this.hasListeners( eventName ) )
{
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
var listener = nativeListeners && nativeListeners[ eventName ];
if ( listener )
{
if ( this.$.detachEvent )
this.$.detachEvent( 'on' + eventName, listener );
else if ( this.$.removeEventListener )
this.$.removeEventListener( eventName, listener, false );
delete nativeListeners[ eventName ];
}
}
},
/**
* Removes any listener set on this object.
* To avoid memory leaks we must assure that there are no
* references left after the object is no longer needed.
*/
removeAllListeners : function()
{
var nativeListeners = this.getCustomData( '_cke_nativeListeners' );
for ( var eventName in nativeListeners )
{
var listener = nativeListeners[ eventName ];
if ( this.$.detachEvent )
this.$.detachEvent( 'on' + eventName, listener );
else if ( this.$.removeEventListener )
this.$.removeEventListener( eventName, listener, false );
delete nativeListeners[ eventName ];
}
}
};
})();
(function( domObjectProto )
{
var customData = {};
CKEDITOR.on( 'reset', function()
{
customData = {};
});
/**
* Determines whether the specified object is equal to the current object.
* @name CKEDITOR.dom.domObject.prototype.equals
* @function
* @param {Object} object The object to compare with the current object.
* @returns {Boolean} "true" if the object is equal.
* @example
* var doc = new CKEDITOR.dom.document( document );
* alert( doc.equals( CKEDITOR.document ) ); // "true"
* alert( doc == CKEDITOR.document ); // "false"
*/
domObjectProto.equals = function( object )
{
return ( object && object.$ === this.$ );
};
/**
* Sets a data slot value for this object. These values are shared by all
* instances pointing to that same DOM object.
* <strong>Note:</strong> The created data slot is only guarantied to be available on this unique dom node,
* thus any wish to continue access it from other element clones (either created by clone node or from innerHtml)
* will fail, for such usage, please use {@link CKEDITOR.dom.element::setAttribute} instead.
* @name CKEDITOR.dom.domObject.prototype.setCustomData
* @function
* @param {String} key A key used to identify the data slot.
* @param {Object} value The value to set to the data slot.
* @returns {CKEDITOR.dom.domObject} This DOM object instance.
* @see CKEDITOR.dom.domObject.prototype.getCustomData
* @example
* var element = new CKEDITOR.dom.element( 'span' );
* element.setCustomData( 'hasCustomData', true );
*/
domObjectProto.setCustomData = function( key, value )
{
var expandoNumber = this.getUniqueId(),
dataSlot = customData[ expandoNumber ] || ( customData[ expandoNumber ] = {} );
dataSlot[ key ] = value;
return this;
};
/**
* Gets the value set to a data slot in this object.
* @name CKEDITOR.dom.domObject.prototype.getCustomData
* @function
* @param {String} key The key used to identify the data slot.
* @returns {Object} This value set to the data slot.
* @see CKEDITOR.dom.domObject.prototype.setCustomData
* @example
* var element = new CKEDITOR.dom.element( 'span' );
* alert( element.getCustomData( 'hasCustomData' ) ); // e.g. 'true'
*/
domObjectProto.getCustomData = function( key )
{
var expandoNumber = this.$[ 'data-cke-expando' ],
dataSlot = expandoNumber && customData[ expandoNumber ];
return dataSlot && dataSlot[ key ];
};
/**
* @name CKEDITOR.dom.domObject.prototype.removeCustomData
*/
domObjectProto.removeCustomData = function( key )
{
var expandoNumber = this.$[ 'data-cke-expando' ],
dataSlot = expandoNumber && customData[ expandoNumber ],
retval = dataSlot && dataSlot[ key ];
if ( typeof retval != 'undefined' )
delete dataSlot[ key ];
return retval || null;
};
/**
* Removes any data stored on this object.
* To avoid memory leaks we must assure that there are no
* references left after the object is no longer needed.
* @name CKEDITOR.dom.domObject.prototype.clearCustomData
* @function
*/
domObjectProto.clearCustomData = function()
{
// Clear all event listeners
this.removeAllListeners();
var expandoNumber = this.$[ 'data-cke-expando' ];
expandoNumber && delete customData[ expandoNumber ];
};
/**
* Gets an ID that can be used to identiquely identify this DOM object in
* the running session.
* @name CKEDITOR.dom.domObject.prototype.getUniqueId
* @function
* @returns {Number} A unique ID.
*/
domObjectProto.getUniqueId = function()
{
return this.$[ 'data-cke-expando' ] || ( this.$[ 'data-cke-expando' ] = CKEDITOR.tools.getNextNumber() );
};
// Implement CKEDITOR.event.
CKEDITOR.event.implementOn( domObjectProto );
})( CKEDITOR.dom.domObject.prototype );
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @class
*/
CKEDITOR.dom.nodeList = function( nativeList )
{
this.$ = nativeList;
};
CKEDITOR.dom.nodeList.prototype =
{
count : function()
{
return this.$.length;
},
getItem : function( index )
{
var $node = this.$[ index ];
return $node ? new CKEDITOR.dom.node( $node ) : null;
}
};
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @class DocumentFragment is a "lightweight" or "minimal" Document object. It is
* commonly used to extract a portion of a document's tree or to create a new
* fragment of a document. Various operations may take DocumentFragment objects
* as arguments and results in all the child nodes of the DocumentFragment being
* moved to the child list of this node.
* @param {Object} ownerDocument
*/
CKEDITOR.dom.documentFragment = function( ownerDocument )
{
ownerDocument = ownerDocument || CKEDITOR.document;
this.$ = ownerDocument.$.createDocumentFragment();
};
CKEDITOR.tools.extend( CKEDITOR.dom.documentFragment.prototype,
CKEDITOR.dom.element.prototype,
{
type : CKEDITOR.NODE_DOCUMENT_FRAGMENT,
insertAfterNode : function( node )
{
node = node.$;
node.parentNode.insertBefore( this.$, node.nextSibling );
}
},
true,
{
'append' : 1,
'appendBogus' : 1,
'getFirst' : 1,
'getLast' : 1,
'appendTo' : 1,
'moveChildren' : 1,
'insertBefore' : 1,
'insertAfterNode' : 1,
'replace' : 1,
'trim' : 1,
'type' : 1,
'ltrim' : 1,
'rtrim' : 1,
'getDocument' : 1,
'getChildCount' : 1,
'getChild' : 1,
'getChildren' : 1
} );
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* Creates a CKEDITOR.dom.range instance that can be used inside a specific
* DOM Document.
* @class Represents a delimited piece of content in a DOM Document.
* It is contiguous in the sense that it can be characterized as selecting all
* of the content between a pair of boundary-points.<br>
* <br>
* This class shares much of the W3C
* <a href="http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html">Document Object Model Range</a>
* ideas and features, adding several range manipulation tools to it, but it's
* not intended to be compatible with it.
* @param {CKEDITOR.dom.document} document The document into which the range
* features will be available.
* @example
* // Create a range for the entire contents of the editor document body.
* var range = new CKEDITOR.dom.range( editor.document );
* range.selectNodeContents( editor.document.getBody() );
* // Delete the contents.
* range.deleteContents();
*/
CKEDITOR.dom.range = function( document )
{
/**
* Node within which the range begins.
* @type {CKEDITOR.NODE_ELEMENT|CKEDITOR.NODE_TEXT}
* @example
* var range = new CKEDITOR.dom.range( editor.document );
* range.selectNodeContents( editor.document.getBody() );
* alert( range.startContainer.getName() ); // "body"
*/
this.startContainer = null;
/**
* Offset within the starting node of the range.
* @type {Number}
* @example
* var range = new CKEDITOR.dom.range( editor.document );
* range.selectNodeContents( editor.document.getBody() );
* alert( range.startOffset ); // "0"
*/
this.startOffset = null;
/**
* Node within which the range ends.
* @type {CKEDITOR.NODE_ELEMENT|CKEDITOR.NODE_TEXT}
* @example
* var range = new CKEDITOR.dom.range( editor.document );
* range.selectNodeContents( editor.document.getBody() );
* alert( range.endContainer.getName() ); // "body"
*/
this.endContainer = null;
/**
* Offset within the ending node of the range.
* @type {Number}
* @example
* var range = new CKEDITOR.dom.range( editor.document );
* range.selectNodeContents( editor.document.getBody() );
* alert( range.endOffset ); // == editor.document.getBody().getChildCount()
*/
this.endOffset = null;
/**
* Indicates that this is a collapsed range. A collapsed range has it's
* start and end boudaries at the very same point so nothing is contained
* in it.
* @example
* var range = new CKEDITOR.dom.range( editor.document );
* range.selectNodeContents( editor.document.getBody() );
* alert( range.collapsed ); // "false"
* range.collapse();
* alert( range.collapsed ); // "true"
*/
this.collapsed = true;
/**
* The document within which the range can be used.
* @type {CKEDITOR.dom.document}
* @example
* // Selects the body contents of the range document.
* range.selectNodeContents( range.document.getBody() );
*/
this.document = document;
};
(function()
{
// Updates the "collapsed" property for the given range object.
var updateCollapsed = function( range )
{
range.collapsed = (
range.startContainer &&
range.endContainer &&
range.startContainer.equals( range.endContainer ) &&
range.startOffset == range.endOffset );
};
// This is a shared function used to delete, extract and clone the range
// contents.
// V2
var execContentsAction = function( range, action, docFrag, mergeThen )
{
range.optimizeBookmark();
var startNode = range.startContainer;
var endNode = range.endContainer;
var startOffset = range.startOffset;
var endOffset = range.endOffset;
var removeStartNode;
var removeEndNode;
// For text containers, we must simply split the node and point to the
// second part. The removal will be handled by the rest of the code .
if ( endNode.type == CKEDITOR.NODE_TEXT )
endNode = endNode.split( endOffset );
else
{
// If the end container has children and the offset is pointing
// to a child, then we should start from it.
if ( endNode.getChildCount() > 0 )
{
// If the offset points after the last node.
if ( endOffset >= endNode.getChildCount() )
{
// Let's create a temporary node and mark it for removal.
endNode = endNode.append( range.document.createText( '' ) );
removeEndNode = true;
}
else
endNode = endNode.getChild( endOffset );
}
}
// For text containers, we must simply split the node. The removal will
// be handled by the rest of the code .
if ( startNode.type == CKEDITOR.NODE_TEXT )
{
startNode.split( startOffset );
// In cases the end node is the same as the start node, the above
// splitting will also split the end, so me must move the end to
// the second part of the split.
if ( startNode.equals( endNode ) )
endNode = startNode.getNext();
}
else
{
// If the start container has children and the offset is pointing
// to a child, then we should start from its previous sibling.
// If the offset points to the first node, we don't have a
// sibling, so let's use the first one, but mark it for removal.
if ( !startOffset )
{
// Let's create a temporary node and mark it for removal.
startNode = startNode.getFirst().insertBeforeMe( range.document.createText( '' ) );
removeStartNode = true;
}
else if ( startOffset >= startNode.getChildCount() )
{
// Let's create a temporary node and mark it for removal.
startNode = startNode.append( range.document.createText( '' ) );
removeStartNode = true;
}
else
startNode = startNode.getChild( startOffset ).getPrevious();
}
// Get the parent nodes tree for the start and end boundaries.
var startParents = startNode.getParents();
var endParents = endNode.getParents();
// Compare them, to find the top most siblings.
var i, topStart, topEnd;
for ( i = 0 ; i < startParents.length ; i++ )
{
topStart = startParents[ i ];
topEnd = endParents[ i ];
// The compared nodes will match until we find the top most
// siblings (different nodes that have the same parent).
// "i" will hold the index in the parents array for the top
// most element.
if ( !topStart.equals( topEnd ) )
break;
}
var clone = docFrag, levelStartNode, levelClone, currentNode, currentSibling;
// Remove all successive sibling nodes for every node in the
// startParents tree.
for ( var j = i ; j < startParents.length ; j++ )
{
levelStartNode = startParents[j];
// For Extract and Clone, we must clone this level.
if ( clone && !levelStartNode.equals( startNode ) ) // action = 0 = Delete
levelClone = clone.append( levelStartNode.clone() );
currentNode = levelStartNode.getNext();
while ( currentNode )
{
// Stop processing when the current node matches a node in the
// endParents tree or if it is the endNode.
if ( currentNode.equals( endParents[ j ] ) || currentNode.equals( endNode ) )
break;
// Cache the next sibling.
currentSibling = currentNode.getNext();
// If cloning, just clone it.
if ( action == 2 ) // 2 = Clone
clone.append( currentNode.clone( true ) );
else
{
// Both Delete and Extract will remove the node.
currentNode.remove();
// When Extracting, move the removed node to the docFrag.
if ( action == 1 ) // 1 = Extract
clone.append( currentNode );
}
currentNode = currentSibling;
}
if ( clone )
clone = levelClone;
}
clone = docFrag;
// Remove all previous sibling nodes for every node in the
// endParents tree.
for ( var k = i ; k < endParents.length ; k++ )
{
levelStartNode = endParents[ k ];
// For Extract and Clone, we must clone this level.
if ( action > 0 && !levelStartNode.equals( endNode ) ) // action = 0 = Delete
levelClone = clone.append( levelStartNode.clone() );
// The processing of siblings may have already been done by the parent.
if ( !startParents[ k ] || levelStartNode.$.parentNode != startParents[ k ].$.parentNode )
{
currentNode = levelStartNode.getPrevious();
while ( currentNode )
{
// Stop processing when the current node matches a node in the
// startParents tree or if it is the startNode.
if ( currentNode.equals( startParents[ k ] ) || currentNode.equals( startNode ) )
break;
// Cache the next sibling.
currentSibling = currentNode.getPrevious();
// If cloning, just clone it.
if ( action == 2 ) // 2 = Clone
clone.$.insertBefore( currentNode.$.cloneNode( true ), clone.$.firstChild ) ;
else
{
// Both Delete and Extract will remove the node.
currentNode.remove();
// When Extracting, mode the removed node to the docFrag.
if ( action == 1 ) // 1 = Extract
clone.$.insertBefore( currentNode.$, clone.$.firstChild );
}
currentNode = currentSibling;
}
}
if ( clone )
clone = levelClone;
}
if ( action == 2 ) // 2 = Clone.
{
// No changes in the DOM should be done, so fix the split text (if any).
var startTextNode = range.startContainer;
if ( startTextNode.type == CKEDITOR.NODE_TEXT )
{
startTextNode.$.data += startTextNode.$.nextSibling.data;
startTextNode.$.parentNode.removeChild( startTextNode.$.nextSibling );
}
var endTextNode = range.endContainer;
if ( endTextNode.type == CKEDITOR.NODE_TEXT && endTextNode.$.nextSibling )
{
endTextNode.$.data += endTextNode.$.nextSibling.data;
endTextNode.$.parentNode.removeChild( endTextNode.$.nextSibling );
}
}
else
{
// Collapse the range.
// If a node has been partially selected, collapse the range between
// topStart and topEnd. Otherwise, simply collapse it to the start. (W3C specs).
if ( topStart && topEnd && ( startNode.$.parentNode != topStart.$.parentNode || endNode.$.parentNode != topEnd.$.parentNode ) )
{
var endIndex = topEnd.getIndex();
// If the start node is to be removed, we must correct the
// index to reflect the removal.
if ( removeStartNode && topEnd.$.parentNode == startNode.$.parentNode )
endIndex--;
// Merge splitted parents.
if ( mergeThen && topStart.type == CKEDITOR.NODE_ELEMENT )
{
var span = CKEDITOR.dom.element.createFromHtml( '<span ' +
'data-cke-bookmark="1" style="display:none"> </span>', range.document );
span.insertAfter( topStart );
topStart.mergeSiblings( false );
range.moveToBookmark( { startNode : span } );
}
else
range.setStart( topEnd.getParent(), endIndex );
}
// Collapse it to the start.
range.collapse( true );
}
// Cleanup any marked node.
if ( removeStartNode )
startNode.remove();
if ( removeEndNode && endNode.$.parentNode )
endNode.remove();
};
var inlineChildReqElements = { abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1 };
// Creates the appropriate node evaluator for the dom walker used inside
// check(Start|End)OfBlock.
function getCheckStartEndBlockEvalFunction( isStart )
{
var hadBr = false, bookmarkEvaluator = CKEDITOR.dom.walker.bookmark( true );
return function( node )
{
// First ignore bookmark nodes.
if ( bookmarkEvaluator( node ) )
return true;
if ( node.type == CKEDITOR.NODE_TEXT )
{
// If there's any visible text, then we're not at the start.
if ( node.hasAscendant( 'pre' ) || CKEDITOR.tools.trim( node.getText() ).length )
return false;
}
else if ( node.type == CKEDITOR.NODE_ELEMENT )
{
// If there are non-empty inline elements (e.g. <img />), then we're not
// at the start.
if ( !inlineChildReqElements[ node.getName() ] )
{
// If we're working at the end-of-block, forgive the first <br /> in non-IE
// browsers.
if ( !isStart && !CKEDITOR.env.ie && node.getName() == 'br' && !hadBr )
hadBr = true;
else
return false;
}
}
return true;
};
}
// Evaluator for CKEDITOR.dom.element::checkBoundaryOfElement, reject any
// text node and non-empty elements unless it's being bookmark text.
function elementBoundaryEval( node )
{
// Reject any text node unless it's being bookmark
// OR it's spaces. (#3883)
return node.type != CKEDITOR.NODE_TEXT
&& node.getName() in CKEDITOR.dtd.$removeEmpty
|| !CKEDITOR.tools.trim( node.getText() )
|| !!node.getParent().data( 'cke-bookmark' );
}
var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(),
bookmarkEval = new CKEDITOR.dom.walker.bookmark();
function nonWhitespaceOrBookmarkEval( node )
{
// Whitespaces and bookmark nodes are to be ignored.
return !whitespaceEval( node ) && !bookmarkEval( node );
}
CKEDITOR.dom.range.prototype =
{
clone : function()
{
var clone = new CKEDITOR.dom.range( this.document );
clone.startContainer = this.startContainer;
clone.startOffset = this.startOffset;
clone.endContainer = this.endContainer;
clone.endOffset = this.endOffset;
clone.collapsed = this.collapsed;
return clone;
},
collapse : function( toStart )
{
if ( toStart )
{
this.endContainer = this.startContainer;
this.endOffset = this.startOffset;
}
else
{
this.startContainer = this.endContainer;
this.startOffset = this.endOffset;
}
this.collapsed = true;
},
/**
* The content nodes of the range are cloned and added to a document fragment, which is returned.
* <strong> Note: </strong> Text selection may lost after invoking this method. (caused by text node splitting).
*/
cloneContents : function()
{
var docFrag = new CKEDITOR.dom.documentFragment( this.document );
if ( !this.collapsed )
execContentsAction( this, 2, docFrag );
return docFrag;
},
/**
* Deletes the content nodes of the range permanently from the DOM tree.
* @param {Boolean} [mergeThen] Merge any splitted elements result in DOM true due to partial selection.
*/
deleteContents : function( mergeThen )
{
if ( this.collapsed )
return;
execContentsAction( this, 0, null, mergeThen );
},
/**
* The content nodes of the range are cloned and added to a document fragment,
* meanwhile they're removed permanently from the DOM tree.
* @param {Boolean} [mergeThen] Merge any splitted elements result in DOM true due to partial selection.
*/
extractContents : function( mergeThen )
{
var docFrag = new CKEDITOR.dom.documentFragment( this.document );
if ( !this.collapsed )
execContentsAction( this, 1, docFrag, mergeThen );
return docFrag;
},
/**
* Creates a bookmark object, which can be later used to restore the
* range by using the moveToBookmark function.
* This is an "intrusive" way to create a bookmark. It includes <span> tags
* in the range boundaries. The advantage of it is that it is possible to
* handle DOM mutations when moving back to the bookmark.
* Attention: the inclusion of nodes in the DOM is a design choice and
* should not be changed as there are other points in the code that may be
* using those nodes to perform operations. See GetBookmarkNode.
* @param {Boolean} [serializable] Indicates that the bookmark nodes
* must contain ids, which can be used to restore the range even
* when these nodes suffer mutations (like a clonation or innerHTML
* change).
* @returns {Object} And object representing a bookmark.
*/
createBookmark : function( serializable )
{
var startNode, endNode;
var baseId;
var clone;
var collapsed = this.collapsed;
startNode = this.document.createElement( 'span' );
startNode.data( 'cke-bookmark', 1 );
startNode.setStyle( 'display', 'none' );
// For IE, it must have something inside, otherwise it may be
// removed during DOM operations.
startNode.setHtml( ' ' );
if ( serializable )
{
baseId = 'cke_bm_' + CKEDITOR.tools.getNextNumber();
startNode.setAttribute( 'id', baseId + 'S' );
}
// If collapsed, the endNode will not be created.
if ( !collapsed )
{
endNode = startNode.clone();
endNode.setHtml( ' ' );
if ( serializable )
endNode.setAttribute( 'id', baseId + 'E' );
clone = this.clone();
clone.collapse();
clone.insertNode( endNode );
}
clone = this.clone();
clone.collapse( true );
clone.insertNode( startNode );
// Update the range position.
if ( endNode )
{
this.setStartAfter( startNode );
this.setEndBefore( endNode );
}
else
this.moveToPosition( startNode, CKEDITOR.POSITION_AFTER_END );
return {
startNode : serializable ? baseId + 'S' : startNode,
endNode : serializable ? baseId + 'E' : endNode,
serializable : serializable,
collapsed : collapsed
};
},
/**
* Creates a "non intrusive" and "mutation sensible" bookmark. This
* kind of bookmark should be used only when the DOM is supposed to
* remain stable after its creation.
* @param {Boolean} [normalized] Indicates that the bookmark must
* normalized. When normalized, the successive text nodes are
* considered a single node. To sucessful load a normalized
* bookmark, the DOM tree must be also normalized before calling
* moveToBookmark.
* @returns {Object} An object representing the bookmark.
*/
createBookmark2 : function( normalized )
{
var startContainer = this.startContainer,
endContainer = this.endContainer;
var startOffset = this.startOffset,
endOffset = this.endOffset;
var collapsed = this.collapsed;
var child, previous;
// If there is no range then get out of here.
// It happens on initial load in Safari #962 and if the editor it's
// hidden also in Firefox
if ( !startContainer || !endContainer )
return { start : 0, end : 0 };
if ( normalized )
{
// Find out if the start is pointing to a text node that will
// be normalized.
if ( startContainer.type == CKEDITOR.NODE_ELEMENT )
{
child = startContainer.getChild( startOffset );
// In this case, move the start information to that text
// node.
if ( child && child.type == CKEDITOR.NODE_TEXT
&& startOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT )
{
startContainer = child;
startOffset = 0;
}
// Get the normalized offset.
if ( child && child.type == CKEDITOR.NODE_ELEMENT )
startOffset = child.getIndex( 1 );
}
// Normalize the start.
while ( startContainer.type == CKEDITOR.NODE_TEXT
&& ( previous = startContainer.getPrevious() )
&& previous.type == CKEDITOR.NODE_TEXT )
{
startContainer = previous;
startOffset += previous.getLength();
}
// Process the end only if not normalized.
if ( !collapsed )
{
// Find out if the start is pointing to a text node that
// will be normalized.
if ( endContainer.type == CKEDITOR.NODE_ELEMENT )
{
child = endContainer.getChild( endOffset );
// In this case, move the start information to that
// text node.
if ( child && child.type == CKEDITOR.NODE_TEXT
&& endOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT )
{
endContainer = child;
endOffset = 0;
}
// Get the normalized offset.
if ( child && child.type == CKEDITOR.NODE_ELEMENT )
endOffset = child.getIndex( 1 );
}
// Normalize the end.
while ( endContainer.type == CKEDITOR.NODE_TEXT
&& ( previous = endContainer.getPrevious() )
&& previous.type == CKEDITOR.NODE_TEXT )
{
endContainer = previous;
endOffset += previous.getLength();
}
}
}
return {
start : startContainer.getAddress( normalized ),
end : collapsed ? null : endContainer.getAddress( normalized ),
startOffset : startOffset,
endOffset : endOffset,
normalized : normalized,
collapsed : collapsed,
is2 : true // It's a createBookmark2 bookmark.
};
},
moveToBookmark : function( bookmark )
{
if ( bookmark.is2 ) // Created with createBookmark2().
{
// Get the start information.
var startContainer = this.document.getByAddress( bookmark.start, bookmark.normalized ),
startOffset = bookmark.startOffset;
// Get the end information.
var endContainer = bookmark.end && this.document.getByAddress( bookmark.end, bookmark.normalized ),
endOffset = bookmark.endOffset;
// Set the start boundary.
this.setStart( startContainer, startOffset );
// Set the end boundary. If not available, collapse it.
if ( endContainer )
this.setEnd( endContainer, endOffset );
else
this.collapse( true );
}
else // Created with createBookmark().
{
var serializable = bookmark.serializable,
startNode = serializable ? this.document.getById( bookmark.startNode ) : bookmark.startNode,
endNode = serializable ? this.document.getById( bookmark.endNode ) : bookmark.endNode;
// Set the range start at the bookmark start node position.
this.setStartBefore( startNode );
// Remove it, because it may interfere in the setEndBefore call.
startNode.remove();
// Set the range end at the bookmark end node position, or simply
// collapse it if it is not available.
if ( endNode )
{
this.setEndBefore( endNode );
endNode.remove();
}
else
this.collapse( true );
}
},
getBoundaryNodes : function()
{
var startNode = this.startContainer,
endNode = this.endContainer,
startOffset = this.startOffset,
endOffset = this.endOffset,
childCount;
if ( startNode.type == CKEDITOR.NODE_ELEMENT )
{
childCount = startNode.getChildCount();
if ( childCount > startOffset )
startNode = startNode.getChild( startOffset );
else if ( childCount < 1 )
startNode = startNode.getPreviousSourceNode();
else // startOffset > childCount but childCount is not 0
{
// Try to take the node just after the current position.
startNode = startNode.$;
while ( startNode.lastChild )
startNode = startNode.lastChild;
startNode = new CKEDITOR.dom.node( startNode );
// Normally we should take the next node in DFS order. But it
// is also possible that we've already reached the end of
// document.
startNode = startNode.getNextSourceNode() || startNode;
}
}
if ( endNode.type == CKEDITOR.NODE_ELEMENT )
{
childCount = endNode.getChildCount();
if ( childCount > endOffset )
endNode = endNode.getChild( endOffset ).getPreviousSourceNode( true );
else if ( childCount < 1 )
endNode = endNode.getPreviousSourceNode();
else // endOffset > childCount but childCount is not 0
{
// Try to take the node just before the current position.
endNode = endNode.$;
while ( endNode.lastChild )
endNode = endNode.lastChild;
endNode = new CKEDITOR.dom.node( endNode );
}
}
// Sometimes the endNode will come right before startNode for collapsed
// ranges. Fix it. (#3780)
if ( startNode.getPosition( endNode ) & CKEDITOR.POSITION_FOLLOWING )
startNode = endNode;
return { startNode : startNode, endNode : endNode };
},
/**
* Find the node which fully contains the range.
* @param includeSelf
* @param {Boolean} ignoreTextNode Whether ignore CKEDITOR.NODE_TEXT type.
*/
getCommonAncestor : function( includeSelf , ignoreTextNode )
{
var start = this.startContainer,
end = this.endContainer,
ancestor;
if ( start.equals( end ) )
{
if ( includeSelf
&& start.type == CKEDITOR.NODE_ELEMENT
&& this.startOffset == this.endOffset - 1 )
ancestor = start.getChild( this.startOffset );
else
ancestor = start;
}
else
ancestor = start.getCommonAncestor( end );
return ignoreTextNode && !ancestor.is ? ancestor.getParent() : ancestor;
},
/**
* Transforms the startContainer and endContainer properties from text
* nodes to element nodes, whenever possible. This is actually possible
* if either of the boundary containers point to a text node, and its
* offset is set to zero, or after the last char in the node.
*/
optimize : function()
{
var container = this.startContainer;
var offset = this.startOffset;
if ( container.type != CKEDITOR.NODE_ELEMENT )
{
if ( !offset )
this.setStartBefore( container );
else if ( offset >= container.getLength() )
this.setStartAfter( container );
}
container = this.endContainer;
offset = this.endOffset;
if ( container.type != CKEDITOR.NODE_ELEMENT )
{
if ( !offset )
this.setEndBefore( container );
else if ( offset >= container.getLength() )
this.setEndAfter( container );
}
},
/**
* Move the range out of bookmark nodes if they'd been the container.
*/
optimizeBookmark: function()
{
var startNode = this.startContainer,
endNode = this.endContainer;
if ( startNode.is && startNode.is( 'span' )
&& startNode.data( 'cke-bookmark' ) )
this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START );
if ( endNode && endNode.is && endNode.is( 'span' )
&& endNode.data( 'cke-bookmark' ) )
this.setEndAt( endNode, CKEDITOR.POSITION_AFTER_END );
},
trim : function( ignoreStart, ignoreEnd )
{
var startContainer = this.startContainer,
startOffset = this.startOffset,
collapsed = this.collapsed;
if ( ( !ignoreStart || collapsed )
&& startContainer && startContainer.type == CKEDITOR.NODE_TEXT )
{
// If the offset is zero, we just insert the new node before
// the start.
if ( !startOffset )
{
startOffset = startContainer.getIndex();
startContainer = startContainer.getParent();
}
// If the offset is at the end, we'll insert it after the text
// node.
else if ( startOffset >= startContainer.getLength() )
{
startOffset = startContainer.getIndex() + 1;
startContainer = startContainer.getParent();
}
// In other case, we split the text node and insert the new
// node at the split point.
else
{
var nextText = startContainer.split( startOffset );
startOffset = startContainer.getIndex() + 1;
startContainer = startContainer.getParent();
// Check all necessity of updating the end boundary.
if ( this.startContainer.equals( this.endContainer ) )
this.setEnd( nextText, this.endOffset - this.startOffset );
else if ( startContainer.equals( this.endContainer ) )
this.endOffset += 1;
}
this.setStart( startContainer, startOffset );
if ( collapsed )
{
this.collapse( true );
return;
}
}
var endContainer = this.endContainer;
var endOffset = this.endOffset;
if ( !( ignoreEnd || collapsed )
&& endContainer && endContainer.type == CKEDITOR.NODE_TEXT )
{
// If the offset is zero, we just insert the new node before
// the start.
if ( !endOffset )
{
endOffset = endContainer.getIndex();
endContainer = endContainer.getParent();
}
// If the offset is at the end, we'll insert it after the text
// node.
else if ( endOffset >= endContainer.getLength() )
{
endOffset = endContainer.getIndex() + 1;
endContainer = endContainer.getParent();
}
// In other case, we split the text node and insert the new
// node at the split point.
else
{
endContainer.split( endOffset );
endOffset = endContainer.getIndex() + 1;
endContainer = endContainer.getParent();
}
this.setEnd( endContainer, endOffset );
}
},
/**
* Expands the range so that partial units are completely contained.
* @param unit {Number} The unit type to expand with.
* @param {Boolean} [excludeBrs=false] Whether include line-breaks when expanding.
*/
enlarge : function( unit, excludeBrs )
{
switch ( unit )
{
case CKEDITOR.ENLARGE_ELEMENT :
if ( this.collapsed )
return;
// Get the common ancestor.
var commonAncestor = this.getCommonAncestor();
var body = this.document.getBody();
// For each boundary
// a. Depending on its position, find out the first node to be checked (a sibling) or, if not available, to be enlarge.
// b. Go ahead checking siblings and enlarging the boundary as much as possible until the common ancestor is not reached. After reaching the common ancestor, just save the enlargeable node to be used later.
var startTop, endTop;
var enlargeable, sibling, commonReached;
// Indicates that the node can be added only if whitespace
// is available before it.
var needsWhiteSpace = false;
var isWhiteSpace;
var siblingText;
// Process the start boundary.
var container = this.startContainer;
var offset = this.startOffset;
if ( container.type == CKEDITOR.NODE_TEXT )
{
if ( offset )
{
// Check if there is any non-space text before the
// offset. Otherwise, container is null.
container = !CKEDITOR.tools.trim( container.substring( 0, offset ) ).length && container;
// If we found only whitespace in the node, it
// means that we'll need more whitespace to be able
// to expand. For example, <i> can be expanded in
// "A <i> [B]</i>", but not in "A<i> [B]</i>".
needsWhiteSpace = !!container;
}
if ( container )
{
if ( !( sibling = container.getPrevious() ) )
enlargeable = container.getParent();
}
}
else
{
// If we have offset, get the node preceeding it as the
// first sibling to be checked.
if ( offset )
sibling = container.getChild( offset - 1 ) || container.getLast();
// If there is no sibling, mark the container to be
// enlarged.
if ( !sibling )
enlargeable = container;
}
while ( enlargeable || sibling )
{
if ( enlargeable && !sibling )
{
// If we reached the common ancestor, mark the flag
// for it.
if ( !commonReached && enlargeable.equals( commonAncestor ) )
commonReached = true;
if ( !body.contains( enlargeable ) )
break;
// If we don't need space or this element breaks
// the line, then enlarge it.
if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' )
{
needsWhiteSpace = false;
// If the common ancestor has been reached,
// we'll not enlarge it immediately, but just
// mark it to be enlarged later if the end
// boundary also enlarges it.
if ( commonReached )
startTop = enlargeable;
else
this.setStartBefore( enlargeable );
}
sibling = enlargeable.getPrevious();
}
// Check all sibling nodes preceeding the enlargeable
// node. The node wil lbe enlarged only if none of them
// blocks it.
while ( sibling )
{
// This flag indicates that this node has
// whitespaces at the end.
isWhiteSpace = false;
if ( sibling.type == CKEDITOR.NODE_TEXT )
{
siblingText = sibling.getText();
if ( /[^\s\ufeff]/.test( siblingText ) )
sibling = null;
isWhiteSpace = /[\s\ufeff]$/.test( siblingText );
}
else
{
// If this is a visible element.
// We need to check for the bookmark attribute because IE insists on
// rendering the display:none nodes we use for bookmarks. (#3363)
// Line-breaks (br) are rendered with zero width, which we don't want to include. (#7041)
if ( ( sibling.$.offsetWidth > 0 || excludeBrs && sibling.is( 'br' ) ) && !sibling.data( 'cke-bookmark' ) )
{
// We'll accept it only if we need
// whitespace, and this is an inline
// element with whitespace only.
if ( needsWhiteSpace && CKEDITOR.dtd.$removeEmpty[ sibling.getName() ] )
{
// It must contains spaces and inline elements only.
siblingText = sibling.getText();
if ( (/[^\s\ufeff]/).test( siblingText ) ) // Spaces + Zero Width No-Break Space (U+FEFF)
sibling = null;
else
{
var allChildren = sibling.$.all || sibling.$.getElementsByTagName( '*' );
for ( var i = 0, child ; child = allChildren[ i++ ] ; )
{
if ( !CKEDITOR.dtd.$removeEmpty[ child.nodeName.toLowerCase() ] )
{
sibling = null;
break;
}
}
}
if ( sibling )
isWhiteSpace = !!siblingText.length;
}
else
sibling = null;
}
}
// A node with whitespaces has been found.
if ( isWhiteSpace )
{
// Enlarge the last enlargeable node, if we
// were waiting for spaces.
if ( needsWhiteSpace )
{
if ( commonReached )
startTop = enlargeable;
else if ( enlargeable )
this.setStartBefore( enlargeable );
}
else
needsWhiteSpace = true;
}
if ( sibling )
{
var next = sibling.getPrevious();
if ( !enlargeable && !next )
{
// Set the sibling as enlargeable, so it's
// parent will be get later outside this while.
enlargeable = sibling;
sibling = null;
break;
}
sibling = next;
}
else
{
// If sibling has been set to null, then we
// need to stop enlarging.
enlargeable = null;
}
}
if ( enlargeable )
enlargeable = enlargeable.getParent();
}
// Process the end boundary. This is basically the same
// code used for the start boundary, with small changes to
// make it work in the oposite side (to the right). This
// makes it difficult to reuse the code here. So, fixes to
// the above code are likely to be replicated here.
container = this.endContainer;
offset = this.endOffset;
// Reset the common variables.
enlargeable = sibling = null;
commonReached = needsWhiteSpace = false;
if ( container.type == CKEDITOR.NODE_TEXT )
{
// Check if there is any non-space text after the
// offset. Otherwise, container is null.
container = !CKEDITOR.tools.trim( container.substring( offset ) ).length && container;
// If we found only whitespace in the node, it
// means that we'll need more whitespace to be able
// to expand. For example, <i> can be expanded in
// "A <i> [B]</i>", but not in "A<i> [B]</i>".
needsWhiteSpace = !( container && container.getLength() );
if ( container )
{
if ( !( sibling = container.getNext() ) )
enlargeable = container.getParent();
}
}
else
{
// Get the node right after the boudary to be checked
// first.
sibling = container.getChild( offset );
if ( !sibling )
enlargeable = container;
}
while ( enlargeable || sibling )
{
if ( enlargeable && !sibling )
{
if ( !commonReached && enlargeable.equals( commonAncestor ) )
commonReached = true;
if ( !body.contains( enlargeable ) )
break;
if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' )
{
needsWhiteSpace = false;
if ( commonReached )
endTop = enlargeable;
else if ( enlargeable )
this.setEndAfter( enlargeable );
}
sibling = enlargeable.getNext();
}
while ( sibling )
{
isWhiteSpace = false;
if ( sibling.type == CKEDITOR.NODE_TEXT )
{
siblingText = sibling.getText();
if ( /[^\s\ufeff]/.test( siblingText ) )
sibling = null;
isWhiteSpace = /^[\s\ufeff]/.test( siblingText );
}
else
{
// If this is a visible element.
// We need to check for the bookmark attribute because IE insists on
// rendering the display:none nodes we use for bookmarks. (#3363)
// Line-breaks (br) are rendered with zero width, which we don't want to include. (#7041)
if ( ( sibling.$.offsetWidth > 0 || excludeBrs && sibling.is( 'br' ) ) && !sibling.data( 'cke-bookmark' ) )
{
// We'll accept it only if we need
// whitespace, and this is an inline
// element with whitespace only.
if ( needsWhiteSpace && CKEDITOR.dtd.$removeEmpty[ sibling.getName() ] )
{
// It must contains spaces and inline elements only.
siblingText = sibling.getText();
if ( (/[^\s\ufeff]/).test( siblingText ) )
sibling = null;
else
{
allChildren = sibling.$.all || sibling.$.getElementsByTagName( '*' );
for ( i = 0 ; child = allChildren[ i++ ] ; )
{
if ( !CKEDITOR.dtd.$removeEmpty[ child.nodeName.toLowerCase() ] )
{
sibling = null;
break;
}
}
}
if ( sibling )
isWhiteSpace = !!siblingText.length;
}
else
sibling = null;
}
}
if ( isWhiteSpace )
{
if ( needsWhiteSpace )
{
if ( commonReached )
endTop = enlargeable;
else
this.setEndAfter( enlargeable );
}
}
if ( sibling )
{
next = sibling.getNext();
if ( !enlargeable && !next )
{
enlargeable = sibling;
sibling = null;
break;
}
sibling = next;
}
else
{
// If sibling has been set to null, then we
// need to stop enlarging.
enlargeable = null;
}
}
if ( enlargeable )
enlargeable = enlargeable.getParent();
}
// If the common ancestor can be enlarged by both boundaries, then include it also.
if ( startTop && endTop )
{
commonAncestor = startTop.contains( endTop ) ? endTop : startTop;
this.setStartBefore( commonAncestor );
this.setEndAfter( commonAncestor );
}
break;
case CKEDITOR.ENLARGE_BLOCK_CONTENTS:
case CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS:
// Enlarging the start boundary.
var walkerRange = new CKEDITOR.dom.range( this.document );
body = this.document.getBody();
walkerRange.setStartAt( body, CKEDITOR.POSITION_AFTER_START );
walkerRange.setEnd( this.startContainer, this.startOffset );
var walker = new CKEDITOR.dom.walker( walkerRange ),
blockBoundary, // The node on which the enlarging should stop.
tailBr, // In case BR as block boundary.
notBlockBoundary = CKEDITOR.dom.walker.blockBoundary(
( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ? { br : 1 } : null ),
// Record the encountered 'blockBoundary' for later use.
boundaryGuard = function( node )
{
var retval = notBlockBoundary( node );
if ( !retval )
blockBoundary = node;
return retval;
},
// Record the encounted 'tailBr' for later use.
tailBrGuard = function( node )
{
var retval = boundaryGuard( node );
if ( !retval && node.is && node.is( 'br' ) )
tailBr = node;
return retval;
};
walker.guard = boundaryGuard;
enlargeable = walker.lastBackward();
// It's the body which stop the enlarging if no block boundary found.
blockBoundary = blockBoundary || body;
// Start the range either after the end of found block (<p>...</p>[text)
// or at the start of block (<p>[text...), by comparing the document position
// with 'enlargeable' node.
this.setStartAt(
blockBoundary,
!blockBoundary.is( 'br' ) &&
( !enlargeable && this.checkStartOfBlock()
|| enlargeable && blockBoundary.contains( enlargeable ) ) ?
CKEDITOR.POSITION_AFTER_START :
CKEDITOR.POSITION_AFTER_END );
// Avoid enlarging the range further when end boundary spans right after the BR. (#7490)
if ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS )
{
var theRange = this.clone();
walker = new CKEDITOR.dom.walker( theRange );
var whitespaces = CKEDITOR.dom.walker.whitespaces(),
bookmark = CKEDITOR.dom.walker.bookmark();
walker.evaluator = function( node ) { return !whitespaces( node ) && !bookmark( node ); };
var previous = walker.previous();
if ( previous && previous.type == CKEDITOR.NODE_ELEMENT && previous.is( 'br' ) )
return;
}
// Enlarging the end boundary.
walkerRange = this.clone();
walkerRange.collapse();
walkerRange.setEndAt( body, CKEDITOR.POSITION_BEFORE_END );
walker = new CKEDITOR.dom.walker( walkerRange );
// tailBrGuard only used for on range end.
walker.guard = ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ?
tailBrGuard : boundaryGuard;
blockBoundary = null;
// End the range right before the block boundary node.
enlargeable = walker.lastForward();
// It's the body which stop the enlarging if no block boundary found.
blockBoundary = blockBoundary || body;
// Close the range either before the found block start (text]<p>...</p>) or at the block end (...text]</p>)
// by comparing the document position with 'enlargeable' node.
this.setEndAt(
blockBoundary,
( !enlargeable && this.checkEndOfBlock()
|| enlargeable && blockBoundary.contains( enlargeable ) ) ?
CKEDITOR.POSITION_BEFORE_END :
CKEDITOR.POSITION_BEFORE_START );
// We must include the <br> at the end of range if there's
// one and we're expanding list item contents
if ( tailBr )
this.setEndAfter( tailBr );
}
},
/**
* Descrease the range to make sure that boundaries
* always anchor beside text nodes or innermost element.
* @param {Number} mode ( CKEDITOR.SHRINK_ELEMENT | CKEDITOR.SHRINK_TEXT ) The shrinking mode.
* <dl>
* <dt>CKEDITOR.SHRINK_ELEMENT</dt>
* <dd>Shrink the range boundaries to the edge of the innermost element.</dd>
* <dt>CKEDITOR.SHRINK_TEXT</dt>
* <dd>Shrink the range boudaries to anchor by the side of enclosed text node, range remains if there's no text nodes on boundaries at all.</dd>
* </dl>
* @param {Boolean} selectContents Whether result range anchors at the inner OR outer boundary of the node.
*/
shrink : function( mode, selectContents )
{
// Unable to shrink a collapsed range.
if ( !this.collapsed )
{
mode = mode || CKEDITOR.SHRINK_TEXT;
var walkerRange = this.clone();
var startContainer = this.startContainer,
endContainer = this.endContainer,
startOffset = this.startOffset,
endOffset = this.endOffset,
collapsed = this.collapsed;
// Whether the start/end boundary is moveable.
var moveStart = 1,
moveEnd = 1;
if ( startContainer && startContainer.type == CKEDITOR.NODE_TEXT )
{
if ( !startOffset )
walkerRange.setStartBefore( startContainer );
else if ( startOffset >= startContainer.getLength( ) )
walkerRange.setStartAfter( startContainer );
else
{
// Enlarge the range properly to avoid walker making
// DOM changes caused by triming the text nodes later.
walkerRange.setStartBefore( startContainer );
moveStart = 0;
}
}
if ( endContainer && endContainer.type == CKEDITOR.NODE_TEXT )
{
if ( !endOffset )
walkerRange.setEndBefore( endContainer );
else if ( endOffset >= endContainer.getLength( ) )
walkerRange.setEndAfter( endContainer );
else
{
walkerRange.setEndAfter( endContainer );
moveEnd = 0;
}
}
var walker = new CKEDITOR.dom.walker( walkerRange ),
isBookmark = CKEDITOR.dom.walker.bookmark();
walker.evaluator = function( node )
{
return node.type == ( mode == CKEDITOR.SHRINK_ELEMENT ?
CKEDITOR.NODE_ELEMENT : CKEDITOR.NODE_TEXT );
};
var currentElement;
walker.guard = function( node, movingOut )
{
if ( isBookmark( node ) )
return true;
// Stop when we're shrink in element mode while encountering a text node.
if ( mode == CKEDITOR.SHRINK_ELEMENT && node.type == CKEDITOR.NODE_TEXT )
return false;
// Stop when we've already walked "through" an element.
if ( movingOut && node.equals( currentElement ) )
return false;
if ( !movingOut && node.type == CKEDITOR.NODE_ELEMENT )
currentElement = node;
return true;
};
if ( moveStart )
{
var textStart = walker[ mode == CKEDITOR.SHRINK_ELEMENT ? 'lastForward' : 'next']();
textStart && this.setStartAt( textStart, selectContents ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_START );
}
if ( moveEnd )
{
walker.reset();
var textEnd = walker[ mode == CKEDITOR.SHRINK_ELEMENT ? 'lastBackward' : 'previous']();
textEnd && this.setEndAt( textEnd, selectContents ? CKEDITOR.POSITION_BEFORE_END : CKEDITOR.POSITION_AFTER_END );
}
return !!( moveStart || moveEnd );
}
},
/**
* Inserts a node at the start of the range. The range will be expanded
* the contain the node.
*/
insertNode : function( node )
{
this.optimizeBookmark();
this.trim( false, true );
var startContainer = this.startContainer;
var startOffset = this.startOffset;
var nextNode = startContainer.getChild( startOffset );
if ( nextNode )
node.insertBefore( nextNode );
else
startContainer.append( node );
// Check if we need to update the end boundary.
if ( node.getParent().equals( this.endContainer ) )
this.endOffset++;
// Expand the range to embrace the new node.
this.setStartBefore( node );
},
moveToPosition : function( node, position )
{
this.setStartAt( node, position );
this.collapse( true );
},
selectNodeContents : function( node )
{
this.setStart( node, 0 );
this.setEnd( node, node.type == CKEDITOR.NODE_TEXT ? node.getLength() : node.getChildCount() );
},
/**
* Sets the start position of a Range.
* @param {CKEDITOR.dom.node} startNode The node to start the range.
* @param {Number} startOffset An integer greater than or equal to zero
* representing the offset for the start of the range from the start
* of startNode.
*/
setStart : function( startNode, startOffset )
{
// W3C requires a check for the new position. If it is after the end
// boundary, the range should be collapsed to the new start. It seams
// we will not need this check for our use of this class so we can
// ignore it for now.
// Fixing invalid range start inside dtd empty elements.
if( startNode.type == CKEDITOR.NODE_ELEMENT
&& CKEDITOR.dtd.$empty[ startNode.getName() ] )
startOffset = startNode.getIndex(), startNode = startNode.getParent();
this.startContainer = startNode;
this.startOffset = startOffset;
if ( !this.endContainer )
{
this.endContainer = startNode;
this.endOffset = startOffset;
}
updateCollapsed( this );
},
/**
* Sets the end position of a Range.
* @param {CKEDITOR.dom.node} endNode The node to end the range.
* @param {Number} endOffset An integer greater than or equal to zero
* representing the offset for the end of the range from the start
* of endNode.
*/
setEnd : function( endNode, endOffset )
{
// W3C requires a check for the new position. If it is before the start
// boundary, the range should be collapsed to the new end. It seams we
// will not need this check for our use of this class so we can ignore
// it for now.
// Fixing invalid range end inside dtd empty elements.
if( endNode.type == CKEDITOR.NODE_ELEMENT
&& CKEDITOR.dtd.$empty[ endNode.getName() ] )
endOffset = endNode.getIndex() + 1, endNode = endNode.getParent();
this.endContainer = endNode;
this.endOffset = endOffset;
if ( !this.startContainer )
{
this.startContainer = endNode;
this.startOffset = endOffset;
}
updateCollapsed( this );
},
setStartAfter : function( node )
{
this.setStart( node.getParent(), node.getIndex() + 1 );
},
setStartBefore : function( node )
{
this.setStart( node.getParent(), node.getIndex() );
},
setEndAfter : function( node )
{
this.setEnd( node.getParent(), node.getIndex() + 1 );
},
setEndBefore : function( node )
{
this.setEnd( node.getParent(), node.getIndex() );
},
setStartAt : function( node, position )
{
switch( position )
{
case CKEDITOR.POSITION_AFTER_START :
this.setStart( node, 0 );
break;
case CKEDITOR.POSITION_BEFORE_END :
if ( node.type == CKEDITOR.NODE_TEXT )
this.setStart( node, node.getLength() );
else
this.setStart( node, node.getChildCount() );
break;
case CKEDITOR.POSITION_BEFORE_START :
this.setStartBefore( node );
break;
case CKEDITOR.POSITION_AFTER_END :
this.setStartAfter( node );
}
updateCollapsed( this );
},
setEndAt : function( node, position )
{
switch( position )
{
case CKEDITOR.POSITION_AFTER_START :
this.setEnd( node, 0 );
break;
case CKEDITOR.POSITION_BEFORE_END :
if ( node.type == CKEDITOR.NODE_TEXT )
this.setEnd( node, node.getLength() );
else
this.setEnd( node, node.getChildCount() );
break;
case CKEDITOR.POSITION_BEFORE_START :
this.setEndBefore( node );
break;
case CKEDITOR.POSITION_AFTER_END :
this.setEndAfter( node );
}
updateCollapsed( this );
},
fixBlock : function( isStart, blockTag )
{
var bookmark = this.createBookmark(),
fixedBlock = this.document.createElement( blockTag );
this.collapse( isStart );
this.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS );
this.extractContents().appendTo( fixedBlock );
fixedBlock.trim();
if ( !CKEDITOR.env.ie )
fixedBlock.appendBogus();
this.insertNode( fixedBlock );
this.moveToBookmark( bookmark );
return fixedBlock;
},
splitBlock : function( blockTag )
{
var startPath = new CKEDITOR.dom.elementPath( this.startContainer ),
endPath = new CKEDITOR.dom.elementPath( this.endContainer );
var startBlockLimit = startPath.blockLimit,
endBlockLimit = endPath.blockLimit;
var startBlock = startPath.block,
endBlock = endPath.block;
var elementPath = null;
// Do nothing if the boundaries are in different block limits.
if ( !startBlockLimit.equals( endBlockLimit ) )
return null;
// Get or fix current blocks.
if ( blockTag != 'br' )
{
if ( !startBlock )
{
startBlock = this.fixBlock( true, blockTag );
endBlock = new CKEDITOR.dom.elementPath( this.endContainer ).block;
}
if ( !endBlock )
endBlock = this.fixBlock( false, blockTag );
}
// Get the range position.
var isStartOfBlock = startBlock && this.checkStartOfBlock(),
isEndOfBlock = endBlock && this.checkEndOfBlock();
// Delete the current contents.
// TODO: Why is 2.x doing CheckIsEmpty()?
this.deleteContents();
if ( startBlock && startBlock.equals( endBlock ) )
{
if ( isEndOfBlock )
{
elementPath = new CKEDITOR.dom.elementPath( this.startContainer );
this.moveToPosition( endBlock, CKEDITOR.POSITION_AFTER_END );
endBlock = null;
}
else if ( isStartOfBlock )
{
elementPath = new CKEDITOR.dom.elementPath( this.startContainer );
this.moveToPosition( startBlock, CKEDITOR.POSITION_BEFORE_START );
startBlock = null;
}
else
{
endBlock = this.splitElement( startBlock );
// In Gecko, the last child node must be a bogus <br>.
// Note: bogus <br> added under <ul> or <ol> would cause
// lists to be incorrectly rendered.
if ( !CKEDITOR.env.ie && !startBlock.is( 'ul', 'ol') )
startBlock.appendBogus() ;
}
}
return {
previousBlock : startBlock,
nextBlock : endBlock,
wasStartOfBlock : isStartOfBlock,
wasEndOfBlock : isEndOfBlock,
elementPath : elementPath
};
},
/**
* Branch the specified element from the collapsed range position and
* place the caret between the two result branches.
* Note: The range must be collapsed and been enclosed by this element.
* @param {CKEDITOR.dom.element} element
* @return {CKEDITOR.dom.element} Root element of the new branch after the split.
*/
splitElement : function( toSplit )
{
if ( !this.collapsed )
return null;
// Extract the contents of the block from the selection point to the end
// of its contents.
this.setEndAt( toSplit, CKEDITOR.POSITION_BEFORE_END );
var documentFragment = this.extractContents();
// Duplicate the element after it.
var clone = toSplit.clone( false );
// Place the extracted contents into the duplicated element.
documentFragment.appendTo( clone );
clone.insertAfter( toSplit );
this.moveToPosition( toSplit, CKEDITOR.POSITION_AFTER_END );
return clone;
},
/**
* Check whether a range boundary is at the inner boundary of a given
* element.
* @param {CKEDITOR.dom.element} element The target element to check.
* @param {Number} checkType The boundary to check for both the range
* and the element. It can be CKEDITOR.START or CKEDITOR.END.
* @returns {Boolean} "true" if the range boundary is at the inner
* boundary of the element.
*/
checkBoundaryOfElement : function( element, checkType )
{
var checkStart = ( checkType == CKEDITOR.START );
// Create a copy of this range, so we can manipulate it for our checks.
var walkerRange = this.clone();
// Collapse the range at the proper size.
walkerRange.collapse( checkStart );
// Expand the range to element boundary.
walkerRange[ checkStart ? 'setStartAt' : 'setEndAt' ]
( element, checkStart ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_END );
// Create the walker, which will check if we have anything useful
// in the range.
var walker = new CKEDITOR.dom.walker( walkerRange );
walker.evaluator = elementBoundaryEval;
return walker[ checkStart ? 'checkBackward' : 'checkForward' ]();
},
// Calls to this function may produce changes to the DOM. The range may
// be updated to reflect such changes.
checkStartOfBlock : function()
{
var startContainer = this.startContainer,
startOffset = this.startOffset;
// If the starting node is a text node, and non-empty before the offset,
// then we're surely not at the start of block.
if ( startOffset && startContainer.type == CKEDITOR.NODE_TEXT )
{
var textBefore = CKEDITOR.tools.ltrim( startContainer.substring( 0, startOffset ) );
if ( textBefore.length )
return false;
}
// Antecipate the trim() call here, so the walker will not make
// changes to the DOM, which would not get reflected into this
// range otherwise.
this.trim();
// We need to grab the block element holding the start boundary, so
// let's use an element path for it.
var path = new CKEDITOR.dom.elementPath( this.startContainer );
// Creates a range starting at the block start until the range start.
var walkerRange = this.clone();
walkerRange.collapse( true );
walkerRange.setStartAt( path.block || path.blockLimit, CKEDITOR.POSITION_AFTER_START );
var walker = new CKEDITOR.dom.walker( walkerRange );
walker.evaluator = getCheckStartEndBlockEvalFunction( true );
return walker.checkBackward();
},
checkEndOfBlock : function()
{
var endContainer = this.endContainer,
endOffset = this.endOffset;
// If the ending node is a text node, and non-empty after the offset,
// then we're surely not at the end of block.
if ( endContainer.type == CKEDITOR.NODE_TEXT )
{
var textAfter = CKEDITOR.tools.rtrim( endContainer.substring( endOffset ) );
if ( textAfter.length )
return false;
}
// Antecipate the trim() call here, so the walker will not make
// changes to the DOM, which would not get reflected into this
// range otherwise.
this.trim();
// We need to grab the block element holding the start boundary, so
// let's use an element path for it.
var path = new CKEDITOR.dom.elementPath( this.endContainer );
// Creates a range starting at the block start until the range start.
var walkerRange = this.clone();
walkerRange.collapse( false );
walkerRange.setEndAt( path.block || path.blockLimit, CKEDITOR.POSITION_BEFORE_END );
var walker = new CKEDITOR.dom.walker( walkerRange );
walker.evaluator = getCheckStartEndBlockEvalFunction( false );
return walker.checkForward();
},
/**
* Check if elements at which the range boundaries anchor are read-only,
* with respect to "contenteditable" attribute.
*/
checkReadOnly : ( function()
{
function checkNodesEditable( node, anotherEnd )
{
while( node )
{
if ( node.type == CKEDITOR.NODE_ELEMENT )
{
if ( node.getAttribute( 'contentEditable' ) == 'false'
&& !node.data( 'cke-editable' ) )
{
return 0;
}
// Range enclosed entirely in an editable element.
else if ( node.is( 'html' )
|| node.getAttribute( 'contentEditable' ) == 'true'
&& ( node.contains( anotherEnd ) || node.equals( anotherEnd ) ) )
{
break;
}
}
node = node.getParent();
}
return 1;
}
return function()
{
var startNode = this.startContainer,
endNode = this.endContainer;
// Check if elements path at both boundaries are editable.
return !( checkNodesEditable( startNode, endNode ) && checkNodesEditable( endNode, startNode ) );
};
})(),
/**
* Moves the range boundaries to the first/end editing point inside an
* element. For example, in an element tree like
* "<p><b><i></i></b> Text</p>", the start editing point is
* "<p><b><i>^</i></b> Text</p>" (inside <i>).
* @param {CKEDITOR.dom.element} el The element into which look for the
* editing spot.
* @param {Boolean} isMoveToEnd Whether move to the end editable position.
*/
moveToElementEditablePosition : function( el, isMoveToEnd )
{
function nextDFS( node, childOnly )
{
var next;
if ( node.type == CKEDITOR.NODE_ELEMENT
&& node.isEditable( false )
&& !CKEDITOR.dtd.$nonEditable[ node.getName() ] )
{
next = node[ isMoveToEnd ? 'getLast' : 'getFirst' ]( nonWhitespaceOrBookmarkEval );
}
if ( !childOnly && !next )
next = node[ isMoveToEnd ? 'getPrevious' : 'getNext' ]( nonWhitespaceOrBookmarkEval );
return next;
}
var found = 0;
while ( el )
{
// Stop immediately if we've found a text node.
if ( el.type == CKEDITOR.NODE_TEXT )
{
this.moveToPosition( el, isMoveToEnd ?
CKEDITOR.POSITION_AFTER_END :
CKEDITOR.POSITION_BEFORE_START );
found = 1;
break;
}
// If an editable element is found, move inside it, but not stop the searching.
if ( el.type == CKEDITOR.NODE_ELEMENT )
{
if ( el.isEditable() )
{
this.moveToPosition( el, isMoveToEnd ?
CKEDITOR.POSITION_BEFORE_END :
CKEDITOR.POSITION_AFTER_START );
found = 1;
}
}
el = nextDFS( el, found );
}
return !!found;
},
/**
*@see {CKEDITOR.dom.range.moveToElementEditablePosition}
*/
moveToElementEditStart : function( target )
{
return this.moveToElementEditablePosition( target );
},
/**
*@see {CKEDITOR.dom.range.moveToElementEditablePosition}
*/
moveToElementEditEnd : function( target )
{
return this.moveToElementEditablePosition( target, true );
},
/**
* Get the single node enclosed within the range if there's one.
*/
getEnclosedNode : function()
{
var walkerRange = this.clone();
// Optimize and analyze the range to avoid DOM destructive nature of walker. (#5780)
walkerRange.optimize();
if ( walkerRange.startContainer.type != CKEDITOR.NODE_ELEMENT
|| walkerRange.endContainer.type != CKEDITOR.NODE_ELEMENT )
return null;
var walker = new CKEDITOR.dom.walker( walkerRange ),
isNotBookmarks = CKEDITOR.dom.walker.bookmark( true ),
isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ),
evaluator = function( node )
{
return isNotWhitespaces( node ) && isNotBookmarks( node );
};
walkerRange.evaluator = evaluator;
var node = walker.next();
walker.reset();
return node && node.equals( walker.previous() ) ? node : null;
},
getTouchedStartNode : function()
{
var container = this.startContainer ;
if ( this.collapsed || container.type != CKEDITOR.NODE_ELEMENT )
return container ;
return container.getChild( this.startOffset ) || container ;
},
getTouchedEndNode : function()
{
var container = this.endContainer ;
if ( this.collapsed || container.type != CKEDITOR.NODE_ELEMENT )
return container ;
return container.getChild( this.endOffset - 1 ) || container ;
}
};
})();
CKEDITOR.POSITION_AFTER_START = 1; // <element>^contents</element> "^text"
CKEDITOR.POSITION_BEFORE_END = 2; // <element>contents^</element> "text^"
CKEDITOR.POSITION_BEFORE_START = 3; // ^<element>contents</element> ^"text"
CKEDITOR.POSITION_AFTER_END = 4; // <element>contents</element>^ "text"
CKEDITOR.ENLARGE_ELEMENT = 1;
CKEDITOR.ENLARGE_BLOCK_CONTENTS = 2;
CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS = 3;
// Check boundary types.
// @see CKEDITOR.dom.range.prototype.checkBoundaryOfElement
CKEDITOR.START = 1;
CKEDITOR.END = 2;
CKEDITOR.STARTEND = 3;
// Shrink range types.
// @see CKEDITOR.dom.range.prototype.shrink
CKEDITOR.SHRINK_ELEMENT = 1;
CKEDITOR.SHRINK_TEXT = 2;
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.dom.element} class, which
* represents a DOM element.
*/
/**
* Represents a DOM element.
* @constructor
* @augments CKEDITOR.dom.node
* @param {Object|String} element A native DOM element or the element name for
* new elements.
* @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
* the element in case of element creation.
* @example
* // Create a new <span> element.
* var element = new CKEDITOR.dom.element( 'span' );
* @example
* // Create an element based on a native DOM element.
* var element = new CKEDITOR.dom.element( document.getElementById( 'myId' ) );
*/
CKEDITOR.dom.element = function( element, ownerDocument )
{
if ( typeof element == 'string' )
element = ( ownerDocument ? ownerDocument.$ : document ).createElement( element );
// Call the base constructor (we must not call CKEDITOR.dom.node).
CKEDITOR.dom.domObject.call( this, element );
};
// PACKAGER_RENAME( CKEDITOR.dom.element )
/**
* The the {@link CKEDITOR.dom.element} representing and element. If the
* element is a native DOM element, it will be transformed into a valid
* CKEDITOR.dom.element object.
* @returns {CKEDITOR.dom.element} The transformed element.
* @example
* var element = new CKEDITOR.dom.element( 'span' );
* alert( element == <b>CKEDITOR.dom.element.get( element )</b> ); "true"
* @example
* var element = document.getElementById( 'myElement' );
* alert( <b>CKEDITOR.dom.element.get( element )</b>.getName() ); e.g. "p"
*/
CKEDITOR.dom.element.get = function( element )
{
return element && ( element.$ ? element : new CKEDITOR.dom.element( element ) );
};
CKEDITOR.dom.element.prototype = new CKEDITOR.dom.node();
/**
* Creates an instance of the {@link CKEDITOR.dom.element} class based on the
* HTML representation of an element.
* @param {String} html The element HTML. It should define only one element in
* the "root" level. The "root" element can have child nodes, but not
* siblings.
* @returns {CKEDITOR.dom.element} The element instance.
* @example
* var element = <b>CKEDITOR.dom.element.createFromHtml( '<strong class="anyclass">My element</strong>' )</b>;
* alert( element.getName() ); // "strong"
*/
CKEDITOR.dom.element.createFromHtml = function( html, ownerDocument )
{
var temp = new CKEDITOR.dom.element( 'div', ownerDocument );
temp.setHtml( html );
// When returning the node, remove it from its parent to detach it.
return temp.getFirst().remove();
};
CKEDITOR.dom.element.setMarker = function( database, element, name, value )
{
var id = element.getCustomData( 'list_marker_id' ) ||
( element.setCustomData( 'list_marker_id', CKEDITOR.tools.getNextNumber() ).getCustomData( 'list_marker_id' ) ),
markerNames = element.getCustomData( 'list_marker_names' ) ||
( element.setCustomData( 'list_marker_names', {} ).getCustomData( 'list_marker_names' ) );
database[id] = element;
markerNames[name] = 1;
return element.setCustomData( name, value );
};
CKEDITOR.dom.element.clearAllMarkers = function( database )
{
for ( var i in database )
CKEDITOR.dom.element.clearMarkers( database, database[i], 1 );
};
CKEDITOR.dom.element.clearMarkers = function( database, element, removeFromDatabase )
{
var names = element.getCustomData( 'list_marker_names' ),
id = element.getCustomData( 'list_marker_id' );
for ( var i in names )
element.removeCustomData( i );
element.removeCustomData( 'list_marker_names' );
if ( removeFromDatabase )
{
element.removeCustomData( 'list_marker_id' );
delete database[id];
}
};
CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype,
/** @lends CKEDITOR.dom.element.prototype */
{
/**
* The node type. This is a constant value set to
* {@link CKEDITOR.NODE_ELEMENT}.
* @type Number
* @example
*/
type : CKEDITOR.NODE_ELEMENT,
/**
* Adds a CSS class to the element. It appends the class to the
* already existing names.
* @param {String} className The name of the class to be added.
* @example
* var element = new CKEDITOR.dom.element( 'div' );
* element.addClass( 'classA' ); // <div class="classA">
* element.addClass( 'classB' ); // <div class="classA classB">
* element.addClass( 'classA' ); // <div class="classA classB">
*/
addClass : function( className )
{
var c = this.$.className;
if ( c )
{
var regex = new RegExp( '(?:^|\\s)' + className + '(?:\\s|$)', '' );
if ( !regex.test( c ) )
c += ' ' + className;
}
this.$.className = c || className;
},
/**
* Removes a CSS class name from the elements classes. Other classes
* remain untouched.
* @param {String} className The name of the class to remove.
* @example
* var element = new CKEDITOR.dom.element( 'div' );
* element.addClass( 'classA' ); // <div class="classA">
* element.addClass( 'classB' ); // <div class="classA classB">
* element.removeClass( 'classA' ); // <div class="classB">
* element.removeClass( 'classB' ); // <div>
*/
removeClass : function( className )
{
var c = this.getAttribute( 'class' );
if ( c )
{
var regex = new RegExp( '(?:^|\\s+)' + className + '(?=\\s|$)', 'i' );
if ( regex.test( c ) )
{
c = c.replace( regex, '' ).replace( /^\s+/, '' );
if ( c )
this.setAttribute( 'class', c );
else
this.removeAttribute( 'class' );
}
}
},
hasClass : function( className )
{
var regex = new RegExp( '(?:^|\\s+)' + className + '(?=\\s|$)', '' );
return regex.test( this.getAttribute('class') );
},
/**
* Append a node as a child of this element.
* @param {CKEDITOR.dom.node|String} node The node or element name to be
* appended.
* @param {Boolean} [toStart] Indicates that the element is to be
* appended at the start.
* @returns {CKEDITOR.dom.node} The appended node.
* @example
* var p = new CKEDITOR.dom.element( 'p' );
*
* var strong = new CKEDITOR.dom.element( 'strong' );
* <b>p.append( strong );</b>
*
* var em = <b>p.append( 'em' );</b>
*
* // result: "<p><strong></strong><em></em></p>"
*/
append : function( node, toStart )
{
if ( typeof node == 'string' )
node = this.getDocument().createElement( node );
if ( toStart )
this.$.insertBefore( node.$, this.$.firstChild );
else
this.$.appendChild( node.$ );
return node;
},
appendHtml : function( html )
{
if ( !this.$.childNodes.length )
this.setHtml( html );
else
{
var temp = new CKEDITOR.dom.element( 'div', this.getDocument() );
temp.setHtml( html );
temp.moveChildren( this );
}
},
/**
* Append text to this element.
* @param {String} text The text to be appended.
* @returns {CKEDITOR.dom.node} The appended node.
* @example
* var p = new CKEDITOR.dom.element( 'p' );
* p.appendText( 'This is' );
* p.appendText( ' some text' );
*
* // result: "<p>This is some text</p>"
*/
appendText : function( text )
{
if ( this.$.text != undefined )
this.$.text += text;
else
this.append( new CKEDITOR.dom.text( text ) );
},
appendBogus : function()
{
var lastChild = this.getLast() ;
// Ignore empty/spaces text.
while ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.rtrim( lastChild.getText() ) )
lastChild = lastChild.getPrevious();
if ( !lastChild || !lastChild.is || !lastChild.is( 'br' ) )
{
var bogus = CKEDITOR.env.opera ?
this.getDocument().createText('') :
this.getDocument().createElement( 'br' );
CKEDITOR.env.gecko && bogus.setAttribute( 'type', '_moz' );
this.append( bogus );
}
},
/**
* Breaks one of the ancestor element in the element position, moving
* this element between the broken parts.
* @param {CKEDITOR.dom.element} parent The anscestor element to get broken.
* @example
* // Before breaking:
* // <b>This <i>is some<span /> sample</i> test text</b>
* // If "element" is <span /> and "parent" is <i>:
* // <b>This <i>is some</i><span /><i> sample</i> test text</b>
* element.breakParent( parent );
* @example
* // Before breaking:
* // <b>This <i>is some<span /> sample</i> test text</b>
* // If "element" is <span /> and "parent" is <b>:
* // <b>This <i>is some</i></b><span /><b><i> sample</i> test text</b>
* element.breakParent( parent );
*/
breakParent : function( parent )
{
var range = new CKEDITOR.dom.range( this.getDocument() );
// We'll be extracting part of this element, so let's use our
// range to get the correct piece.
range.setStartAfter( this );
range.setEndAfter( parent );
// Extract it.
var docFrag = range.extractContents();
// Move the element outside the broken element.
range.insertNode( this.remove() );
// Re-insert the extracted piece after the element.
docFrag.insertAfterNode( this );
},
contains :
CKEDITOR.env.ie || CKEDITOR.env.webkit ?
function( node )
{
var $ = this.$;
return node.type != CKEDITOR.NODE_ELEMENT ?
$.contains( node.getParent().$ ) :
$ != node.$ && $.contains( node.$ );
}
:
function( node )
{
return !!( this.$.compareDocumentPosition( node.$ ) & 16 );
},
/**
* Moves the selection focus to this element.
* @function
* @param {Boolean} defer Whether to asynchronously defer the
* execution by 100 ms.
* @example
* var element = CKEDITOR.document.getById( 'myTextarea' );
* <b>element.focus()</b>;
*/
focus : ( function()
{
function exec()
{
// IE throws error if the element is not visible.
try
{
this.$.focus();
}
catch (e)
{}
}
return function( defer )
{
if ( defer )
CKEDITOR.tools.setTimeout( exec, 100, this );
else
exec.call( this );
};
})(),
/**
* Gets the inner HTML of this element.
* @returns {String} The inner HTML of this element.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( '<div><b>Example</b></div>' );
* alert( <b>p.getHtml()</b> ); // "<b>Example</b>"
*/
getHtml : function()
{
var retval = this.$.innerHTML;
// Strip <?xml:namespace> tags in IE. (#3341).
return CKEDITOR.env.ie ? retval.replace( /<\?[^>]*>/g, '' ) : retval;
},
getOuterHtml : function()
{
if ( this.$.outerHTML )
{
// IE includes the <?xml:namespace> tag in the outerHTML of
// namespaced element. So, we must strip it here. (#3341)
return this.$.outerHTML.replace( /<\?[^>]*>/, '' );
}
var tmpDiv = this.$.ownerDocument.createElement( 'div' );
tmpDiv.appendChild( this.$.cloneNode( true ) );
return tmpDiv.innerHTML;
},
/**
* Sets the inner HTML of this element.
* @param {String} html The HTML to be set for this element.
* @returns {String} The inserted HTML.
* @example
* var p = new CKEDITOR.dom.element( 'p' );
* <b>p.setHtml( '<b>Inner</b> HTML' );</b>
*
* // result: "<p><b>Inner</b> HTML</p>"
*/
setHtml : function( html )
{
return ( this.$.innerHTML = html );
},
/**
* Sets the element contents as plain text.
* @param {String} text The text to be set.
* @returns {String} The inserted text.
* @example
* var element = new CKEDITOR.dom.element( 'div' );
* element.setText( 'A > B & C < D' );
* alert( element.innerHTML ); // "A &gt; B &amp; C &lt; D"
*/
setText : function( text )
{
CKEDITOR.dom.element.prototype.setText = ( this.$.innerText != undefined ) ?
function ( text )
{
return this.$.innerText = text;
} :
function ( text )
{
return this.$.textContent = text;
};
return this.setText( text );
},
/**
* Gets the value of an element attribute.
* @function
* @param {String} name The attribute name.
* @returns {String} The attribute value or null if not defined.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( '<input type="text" />' );
* alert( <b>element.getAttribute( 'type' )</b> ); // "text"
*/
getAttribute : (function()
{
var standard = function( name )
{
return this.$.getAttribute( name, 2 );
};
if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )
{
return function( name )
{
switch ( name )
{
case 'class':
name = 'className';
break;
case 'http-equiv':
name = 'httpEquiv';
break;
case 'name':
return this.$.name;
case 'tabindex':
var tabIndex = standard.call( this, name );
// IE returns tabIndex=0 by default for all
// elements. For those elements,
// getAtrribute( 'tabindex', 2 ) returns 32768
// instead. So, we must make this check to give a
// uniform result among all browsers.
if ( tabIndex !== 0 && this.$.tabIndex === 0 )
tabIndex = null;
return tabIndex;
break;
case 'checked':
{
var attr = this.$.attributes.getNamedItem( name ),
attrValue = attr.specified ? attr.nodeValue // For value given by parser.
: this.$.checked; // For value created via DOM interface.
return attrValue ? 'checked' : null;
}
case 'hspace':
case 'value':
return this.$[ name ];
case 'style':
// IE does not return inline styles via getAttribute(). See #2947.
return this.$.style.cssText;
}
return standard.call( this, name );
};
}
else
return standard;
})(),
getChildren : function()
{
return new CKEDITOR.dom.nodeList( this.$.childNodes );
},
/**
* Gets the current computed value of one of the element CSS style
* properties.
* @function
* @param {String} propertyName The style property name.
* @returns {String} The property value.
* @example
* var element = new CKEDITOR.dom.element( 'span' );
* alert( <b>element.getComputedStyle( 'display' )</b> ); // "inline"
*/
getComputedStyle :
CKEDITOR.env.ie ?
function( propertyName )
{
return this.$.currentStyle[ CKEDITOR.tools.cssStyleToDomStyle( propertyName ) ];
}
:
function( propertyName )
{
return this.getWindow().$.getComputedStyle( this.$, '' ).getPropertyValue( propertyName );
},
/**
* Gets the DTD entries for this element.
* @returns {Object} An object containing the list of elements accepted
* by this element.
*/
getDtd : function()
{
var dtd = CKEDITOR.dtd[ this.getName() ];
this.getDtd = function()
{
return dtd;
};
return dtd;
},
getElementsByTag : CKEDITOR.dom.document.prototype.getElementsByTag,
/**
* Gets the computed tabindex for this element.
* @function
* @returns {Number} The tabindex value.
* @example
* var element = CKEDITOR.document.getById( 'myDiv' );
* alert( <b>element.getTabIndex()</b> ); // e.g. "-1"
*/
getTabIndex :
CKEDITOR.env.ie ?
function()
{
var tabIndex = this.$.tabIndex;
// IE returns tabIndex=0 by default for all elements. In
// those cases we must check that the element really has
// the tabindex attribute set to zero, or it is one of
// those element that should have zero by default.
if ( tabIndex === 0 && !CKEDITOR.dtd.$tabIndex[ this.getName() ] && parseInt( this.getAttribute( 'tabindex' ), 10 ) !== 0 )
tabIndex = -1;
return tabIndex;
}
: CKEDITOR.env.webkit ?
function()
{
var tabIndex = this.$.tabIndex;
// Safari returns "undefined" for elements that should not
// have tabindex (like a div). So, we must try to get it
// from the attribute.
// https://bugs.webkit.org/show_bug.cgi?id=20596
if ( tabIndex == undefined )
{
tabIndex = parseInt( this.getAttribute( 'tabindex' ), 10 );
// If the element don't have the tabindex attribute,
// then we should return -1.
if ( isNaN( tabIndex ) )
tabIndex = -1;
}
return tabIndex;
}
:
function()
{
return this.$.tabIndex;
},
/**
* Gets the text value of this element.
*
* Only in IE (which uses innerText), <br> will cause linebreaks,
* and sucessive whitespaces (including line breaks) will be reduced to
* a single space. This behavior is ok for us, for now. It may change
* in the future.
* @returns {String} The text value.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( '<div>Same <i>text</i>.</div>' );
* alert( <b>element.getText()</b> ); // "Sample text."
*/
getText : function()
{
return this.$.textContent || this.$.innerText || '';
},
/**
* Gets the window object that contains this element.
* @returns {CKEDITOR.dom.window} The window object.
* @example
*/
getWindow : function()
{
return this.getDocument().getWindow();
},
/**
* Gets the value of the "id" attribute of this element.
* @returns {String} The element id, or null if not available.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( '<p id="myId"></p>' );
* alert( <b>element.getId()</b> ); // "myId"
*/
getId : function()
{
return this.$.id || null;
},
/**
* Gets the value of the "name" attribute of this element.
* @returns {String} The element name, or null if not available.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( '<input name="myName"></input>' );
* alert( <b>element.getNameAtt()</b> ); // "myName"
*/
getNameAtt : function()
{
return this.$.name || null;
},
/**
* Gets the element name (tag name). The returned name is guaranteed to
* be always full lowercased.
* @returns {String} The element name.
* @example
* var element = new CKEDITOR.dom.element( 'span' );
* alert( <b>element.getName()</b> ); // "span"
*/
getName : function()
{
// Cache the lowercased name inside a closure.
var nodeName = this.$.nodeName.toLowerCase();
if ( CKEDITOR.env.ie && ! ( document.documentMode > 8 ) )
{
var scopeName = this.$.scopeName;
if ( scopeName != 'HTML' )
nodeName = scopeName.toLowerCase() + ':' + nodeName;
}
return (
this.getName = function()
{
return nodeName;
})();
},
/**
* Gets the value set to this element. This value is usually available
* for form field elements.
* @returns {String} The element value.
*/
getValue : function()
{
return this.$.value;
},
/**
* Gets the first child node of this element.
* @param {Function} evaluator Filtering the result node.
* @returns {CKEDITOR.dom.node} The first child node or null if not
* available.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( '<div><b>Example</b></div>' );
* var first = <b>element.getFirst()</b>;
* alert( first.getName() ); // "b"
*/
getFirst : function( evaluator )
{
var first = this.$.firstChild,
retval = first && new CKEDITOR.dom.node( first );
if ( retval && evaluator && !evaluator( retval ) )
retval = retval.getNext( evaluator );
return retval;
},
/**
* @param {Function} evaluator Filtering the result node.
*/
getLast : function( evaluator )
{
var last = this.$.lastChild,
retval = last && new CKEDITOR.dom.node( last );
if ( retval && evaluator && !evaluator( retval ) )
retval = retval.getPrevious( evaluator );
return retval;
},
getStyle : function( name )
{
return this.$.style[ CKEDITOR.tools.cssStyleToDomStyle( name ) ];
},
/**
* Checks if the element name matches one or more names.
* @param {String} name[,name[,...]] One or more names to be checked.
* @returns {Boolean} true if the element name matches any of the names.
* @example
* var element = new CKEDITOR.element( 'span' );
* alert( <b>element.is( 'span' )</b> ); "true"
* alert( <b>element.is( 'p', 'span' )</b> ); "true"
* alert( <b>element.is( 'p' )</b> ); "false"
* alert( <b>element.is( 'p', 'div' )</b> ); "false"
*/
is : function()
{
var name = this.getName();
for ( var i = 0 ; i < arguments.length ; i++ )
{
if ( arguments[ i ] == name )
return true;
}
return false;
},
/**
* Decide whether one element is able to receive cursor.
* @param {Boolean} [textCursor=true] Only consider element that could receive text child.
*/
isEditable : function( textCursor )
{
var name = this.getName();
if ( this.isReadOnly()
|| this.getComputedStyle( 'display' ) == 'none'
|| this.getComputedStyle( 'visibility' ) == 'hidden'
|| CKEDITOR.dtd.$nonEditable[ name ] )
{
return false;
}
if ( textCursor !== false )
{
// Get the element DTD (defaults to span for unknown elements).
var dtd = CKEDITOR.dtd[ name ] || CKEDITOR.dtd.span;
// In the DTD # == text node.
return ( dtd && dtd[ '#'] );
}
return true;
},
isIdentical : function( otherElement )
{
if ( this.getName() != otherElement.getName() )
return false;
var thisAttribs = this.$.attributes,
otherAttribs = otherElement.$.attributes;
var thisLength = thisAttribs.length,
otherLength = otherAttribs.length;
for ( var i = 0 ; i < thisLength ; i++ )
{
var attribute = thisAttribs[ i ];
if ( attribute.nodeName == '_moz_dirty' )
continue;
if ( ( !CKEDITOR.env.ie || ( attribute.specified && attribute.nodeName != 'data-cke-expando' ) ) && attribute.nodeValue != otherElement.getAttribute( attribute.nodeName ) )
return false;
}
// For IE, we have to for both elements, because it's difficult to
// know how the atttibutes collection is organized in its DOM.
if ( CKEDITOR.env.ie )
{
for ( i = 0 ; i < otherLength ; i++ )
{
attribute = otherAttribs[ i ];
if ( attribute.specified && attribute.nodeName != 'data-cke-expando'
&& attribute.nodeValue != this.getAttribute( attribute.nodeName ) )
return false;
}
}
return true;
},
/**
* Checks if this element is visible. May not work if the element is
* child of an element with visibility set to "hidden", but works well
* on the great majority of cases.
* @return {Boolean} True if the element is visible.
*/
isVisible : function()
{
var isVisible = ( this.$.offsetHeight || this.$.offsetWidth ) && this.getComputedStyle( 'visibility' ) != 'hidden',
elementWindow,
elementWindowFrame;
// Webkit and Opera report non-zero offsetHeight despite that
// element is inside an invisible iframe. (#4542)
if ( isVisible && ( CKEDITOR.env.webkit || CKEDITOR.env.opera ) )
{
elementWindow = this.getWindow();
if ( !elementWindow.equals( CKEDITOR.document.getWindow() )
&& ( elementWindowFrame = elementWindow.$.frameElement ) )
{
isVisible = new CKEDITOR.dom.element( elementWindowFrame ).isVisible();
}
}
return !!isVisible;
},
/**
* Whether it's an empty inline elements which has no visual impact when removed.
*/
isEmptyInlineRemoveable : function()
{
if ( !CKEDITOR.dtd.$removeEmpty[ this.getName() ] )
return false;
var children = this.getChildren();
for ( var i = 0, count = children.count(); i < count; i++ )
{
var child = children.getItem( i );
if ( child.type == CKEDITOR.NODE_ELEMENT && child.data( 'cke-bookmark' ) )
continue;
if ( child.type == CKEDITOR.NODE_ELEMENT && !child.isEmptyInlineRemoveable()
|| child.type == CKEDITOR.NODE_TEXT && CKEDITOR.tools.trim( child.getText() ) )
{
return false;
}
}
return true;
},
/**
* Checks if the element has any defined attributes.
* @function
* @returns {Boolean} True if the element has attributes.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( '<div title="Test">Example</div>' );
* alert( <b>element.hasAttributes()</b> ); // "true"
* @example
* var element = CKEDITOR.dom.element.createFromHtml( '<div>Example</div>' );
* alert( <b>element.hasAttributes()</b> ); // "false"
*/
hasAttributes :
CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) ?
function()
{
var attributes = this.$.attributes;
for ( var i = 0 ; i < attributes.length ; i++ )
{
var attribute = attributes[i];
switch ( attribute.nodeName )
{
case 'class' :
// IE has a strange bug. If calling removeAttribute('className'),
// the attributes collection will still contain the "class"
// attribute, which will be marked as "specified", even if the
// outerHTML of the element is not displaying the class attribute.
// Note : I was not able to reproduce it outside the editor,
// but I've faced it while working on the TC of #1391.
if ( this.getAttribute( 'class' ) )
return true;
// Attributes to be ignored.
case 'data-cke-expando' :
continue;
/*jsl:fallthru*/
default :
if ( attribute.specified )
return true;
}
}
return false;
}
:
function()
{
var attrs = this.$.attributes,
attrsNum = attrs.length;
// The _moz_dirty attribute might get into the element after pasting (#5455)
var execludeAttrs = { 'data-cke-expando' : 1, _moz_dirty : 1 };
return attrsNum > 0 &&
( attrsNum > 2 ||
!execludeAttrs[ attrs[0].nodeName ] ||
( attrsNum == 2 && !execludeAttrs[ attrs[1].nodeName ] ) );
},
/**
* Checks if the specified attribute is defined for this element.
* @returns {Boolean} True if the specified attribute is defined.
* @param {String} name The attribute name.
* @example
*/
hasAttribute : (function()
{
function standard( name )
{
var $attr = this.$.attributes.getNamedItem( name );
return !!( $attr && $attr.specified );
}
return ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) ?
function( name )
{
// On IE < 8 the name attribute cannot be retrieved
// right after the element creation and setting the
// name with setAttribute.
if ( name == 'name' )
return !!this.$.name;
return standard.call( this, name );
}
:
standard;
})(),
/**
* Hides this element (display:none).
* @example
* var element = CKEDITOR.dom.element.getById( 'myElement' );
* <b>element.hide()</b>;
*/
hide : function()
{
this.setStyle( 'display', 'none' );
},
moveChildren : function( target, toStart )
{
var $ = this.$;
target = target.$;
if ( $ == target )
return;
var child;
if ( toStart )
{
while ( ( child = $.lastChild ) )
target.insertBefore( $.removeChild( child ), target.firstChild );
}
else
{
while ( ( child = $.firstChild ) )
target.appendChild( $.removeChild( child ) );
}
},
/**
* Merges sibling elements that are identical to this one.<br>
* <br>
* Identical child elements are also merged. For example:<br>
* <b><i></i></b><b><i></i></b> => <b><i></i></b>
* @function
* @param {Boolean} [inlineOnly] Allow only inline elements to be merged. Defaults to "true".
*/
mergeSiblings : ( function()
{
function mergeElements( element, sibling, isNext )
{
if ( sibling && sibling.type == CKEDITOR.NODE_ELEMENT )
{
// Jumping over bookmark nodes and empty inline elements, e.g. <b><i></i></b>,
// queuing them to be moved later. (#5567)
var pendingNodes = [];
while ( sibling.data( 'cke-bookmark' )
|| sibling.isEmptyInlineRemoveable() )
{
pendingNodes.push( sibling );
sibling = isNext ? sibling.getNext() : sibling.getPrevious();
if ( !sibling || sibling.type != CKEDITOR.NODE_ELEMENT )
return;
}
if ( element.isIdentical( sibling ) )
{
// Save the last child to be checked too, to merge things like
// <b><i></i></b><b><i></i></b> => <b><i></i></b>
var innerSibling = isNext ? element.getLast() : element.getFirst();
// Move pending nodes first into the target element.
while( pendingNodes.length )
pendingNodes.shift().move( element, !isNext );
sibling.moveChildren( element, !isNext );
sibling.remove();
// Now check the last inner child (see two comments above).
if ( innerSibling && innerSibling.type == CKEDITOR.NODE_ELEMENT )
innerSibling.mergeSiblings();
}
}
}
return function( inlineOnly )
{
if ( ! ( inlineOnly === false
|| CKEDITOR.dtd.$removeEmpty[ this.getName() ]
|| this.is( 'a' ) ) ) // Merge empty links and anchors also. (#5567)
{
return;
}
mergeElements( this, this.getNext(), true );
mergeElements( this, this.getPrevious() );
};
} )(),
/**
* Shows this element (display it).
* @example
* var element = CKEDITOR.dom.element.getById( 'myElement' );
* <b>element.show()</b>;
*/
show : function()
{
this.setStyles(
{
display : '',
visibility : ''
});
},
/**
* Sets the value of an element attribute.
* @param {String} name The name of the attribute.
* @param {String} value The value to be set to the attribute.
* @function
* @returns {CKEDITOR.dom.element} This element instance.
* @example
* var element = CKEDITOR.dom.element.getById( 'myElement' );
* <b>element.setAttribute( 'class', 'myClass' )</b>;
* <b>element.setAttribute( 'title', 'This is an example' )</b>;
*/
setAttribute : (function()
{
var standard = function( name, value )
{
this.$.setAttribute( name, value );
return this;
};
if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )
{
return function( name, value )
{
if ( name == 'class' )
this.$.className = value;
else if ( name == 'style' )
this.$.style.cssText = value;
else if ( name == 'tabindex' ) // Case sensitive.
this.$.tabIndex = value;
else if ( name == 'checked' )
this.$.checked = value;
else
standard.apply( this, arguments );
return this;
};
}
else if ( CKEDITOR.env.ie8Compat && CKEDITOR.env.secure )
{
return function( name, value )
{
// IE8 throws error when setting src attribute to non-ssl value. (#7847)
if ( name == 'src' && value.match( /^http:\/\// ) )
try { standard.apply( this, arguments ); } catch( e ){}
else
standard.apply( this, arguments );
return this;
};
}
else
return standard;
})(),
/**
* Sets the value of several element attributes.
* @param {Object} attributesPairs An object containing the names and
* values of the attributes.
* @returns {CKEDITOR.dom.element} This element instance.
* @example
* var element = CKEDITOR.dom.element.getById( 'myElement' );
* <b>element.setAttributes({
* 'class' : 'myClass',
* 'title' : 'This is an example' })</b>;
*/
setAttributes : function( attributesPairs )
{
for ( var name in attributesPairs )
this.setAttribute( name, attributesPairs[ name ] );
return this;
},
/**
* Sets the element value. This function is usually used with form
* field element.
* @param {String} value The element value.
* @returns {CKEDITOR.dom.element} This element instance.
*/
setValue : function( value )
{
this.$.value = value;
return this;
},
/**
* Removes an attribute from the element.
* @param {String} name The attribute name.
* @function
* @example
* var element = CKEDITOR.dom.element.createFromHtml( '<div class="classA"></div>' );
* element.removeAttribute( 'class' );
*/
removeAttribute : (function()
{
var standard = function( name )
{
this.$.removeAttribute( name );
};
if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )
{
return function( name )
{
if ( name == 'class' )
name = 'className';
else if ( name == 'tabindex' )
name = 'tabIndex';
standard.call( this, name );
};
}
else
return standard;
})(),
removeAttributes : function ( attributes )
{
if ( CKEDITOR.tools.isArray( attributes ) )
{
for ( var i = 0 ; i < attributes.length ; i++ )
this.removeAttribute( attributes[ i ] );
}
else
{
for ( var attr in attributes )
attributes.hasOwnProperty( attr ) && this.removeAttribute( attr );
}
},
/**
* Removes a style from the element.
* @param {String} name The style name.
* @function
* @example
* var element = CKEDITOR.dom.element.createFromHtml( '<div style="display:none"></div>' );
* element.removeStyle( 'display' );
*/
removeStyle : function( name )
{
this.setStyle( name, '' );
if ( this.$.style.removeAttribute )
this.$.style.removeAttribute( CKEDITOR.tools.cssStyleToDomStyle( name ) );
if ( !this.$.style.cssText )
this.removeAttribute( 'style' );
},
/**
* Sets the value of an element style.
* @param {String} name The name of the style. The CSS naming notation
* must be used (e.g. "background-color").
* @param {String} value The value to be set to the style.
* @returns {CKEDITOR.dom.element} This element instance.
* @example
* var element = CKEDITOR.dom.element.getById( 'myElement' );
* <b>element.setStyle( 'background-color', '#ff0000' )</b>;
* <b>element.setStyle( 'margin-top', '10px' )</b>;
* <b>element.setStyle( 'float', 'right' )</b>;
*/
setStyle : function( name, value )
{
this.$.style[ CKEDITOR.tools.cssStyleToDomStyle( name ) ] = value;
return this;
},
/**
* Sets the value of several element styles.
* @param {Object} stylesPairs An object containing the names and
* values of the styles.
* @returns {CKEDITOR.dom.element} This element instance.
* @example
* var element = CKEDITOR.dom.element.getById( 'myElement' );
* <b>element.setStyles({
* 'position' : 'absolute',
* 'float' : 'right' })</b>;
*/
setStyles : function( stylesPairs )
{
for ( var name in stylesPairs )
this.setStyle( name, stylesPairs[ name ] );
return this;
},
/**
* Sets the opacity of an element.
* @param {Number} opacity A number within the range [0.0, 1.0].
* @example
* var element = CKEDITOR.dom.element.getById( 'myElement' );
* <b>element.setOpacity( 0.75 )</b>;
*/
setOpacity : function( opacity )
{
if ( CKEDITOR.env.ie )
{
opacity = Math.round( opacity * 100 );
this.setStyle( 'filter', opacity >= 100 ? '' : 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacity + ')' );
}
else
this.setStyle( 'opacity', opacity );
},
/**
* Makes the element and its children unselectable.
* @function
* @example
* var element = CKEDITOR.dom.element.getById( 'myElement' );
* element.unselectable();
*/
unselectable :
CKEDITOR.env.gecko ?
function()
{
this.$.style.MozUserSelect = 'none';
this.on( 'dragstart', function( evt ) { evt.data.preventDefault(); } );
}
: CKEDITOR.env.webkit ?
function()
{
this.$.style.KhtmlUserSelect = 'none';
this.on( 'dragstart', function( evt ) { evt.data.preventDefault(); } );
}
:
function()
{
if ( CKEDITOR.env.ie || CKEDITOR.env.opera )
{
var element = this.$,
e,
i = 0;
element.unselectable = 'on';
while ( ( e = element.all[ i++ ] ) )
{
switch ( e.tagName.toLowerCase() )
{
case 'iframe' :
case 'textarea' :
case 'input' :
case 'select' :
/* Ignore the above tags */
break;
default :
e.unselectable = 'on';
}
}
}
},
getPositionedAncestor : function()
{
var current = this;
while ( current.getName() != 'html' )
{
if ( current.getComputedStyle( 'position' ) != 'static' )
return current;
current = current.getParent();
}
return null;
},
getDocumentPosition : function( refDocument )
{
var x = 0, y = 0,
doc = this.getDocument(),
body = doc.getBody(),
quirks = doc.$.compatMode == 'BackCompat';
if ( document.documentElement[ "getBoundingClientRect" ] )
{
var box = this.$.getBoundingClientRect(),
$doc = doc.$,
$docElem = $doc.documentElement;
var clientTop = $docElem.clientTop || body.$.clientTop || 0,
clientLeft = $docElem.clientLeft || body.$.clientLeft || 0,
needAdjustScrollAndBorders = true;
/*
* #3804: getBoundingClientRect() works differently on IE and non-IE
* browsers, regarding scroll positions.
*
* On IE, the top position of the <html> element is always 0, no matter
* how much you scrolled down.
*
* On other browsers, the top position of the <html> element is negative
* scrollTop.
*/
if ( CKEDITOR.env.ie )
{
var inDocElem = doc.getDocumentElement().contains( this ),
inBody = doc.getBody().contains( this );
needAdjustScrollAndBorders = ( quirks && inBody ) || ( !quirks && inDocElem );
}
if ( needAdjustScrollAndBorders )
{
x = box.left + ( !quirks && $docElem.scrollLeft || body.$.scrollLeft );
x -= clientLeft;
y = box.top + ( !quirks && $docElem.scrollTop || body.$.scrollTop );
y -= clientTop;
}
}
else
{
var current = this, previous = null, offsetParent;
while ( current && !( current.getName() == 'body' || current.getName() == 'html' ) )
{
x += current.$.offsetLeft - current.$.scrollLeft;
y += current.$.offsetTop - current.$.scrollTop;
// Opera includes clientTop|Left into offsetTop|Left.
if ( !current.equals( this ) )
{
x += ( current.$.clientLeft || 0 );
y += ( current.$.clientTop || 0 );
}
var scrollElement = previous;
while ( scrollElement && !scrollElement.equals( current ) )
{
x -= scrollElement.$.scrollLeft;
y -= scrollElement.$.scrollTop;
scrollElement = scrollElement.getParent();
}
previous = current;
current = ( offsetParent = current.$.offsetParent ) ?
new CKEDITOR.dom.element( offsetParent ) : null;
}
}
if ( refDocument )
{
var currentWindow = this.getWindow(),
refWindow = refDocument.getWindow();
if ( !currentWindow.equals( refWindow ) && currentWindow.$.frameElement )
{
var iframePosition = ( new CKEDITOR.dom.element( currentWindow.$.frameElement ) ).getDocumentPosition( refDocument );
x += iframePosition.x;
y += iframePosition.y;
}
}
if ( !document.documentElement[ "getBoundingClientRect" ] )
{
// In Firefox, we'll endup one pixel before the element positions,
// so we must add it here.
if ( CKEDITOR.env.gecko && !quirks )
{
x += this.$.clientLeft ? 1 : 0;
y += this.$.clientTop ? 1 : 0;
}
}
return { x : x, y : y };
},
scrollIntoView : function( alignTop )
{
// Get the element window.
var win = this.getWindow(),
winHeight = win.getViewPaneSize().height;
// Starts from the offset that will be scrolled with the negative value of
// the visible window height.
var offset = winHeight * -1;
// Append the view pane's height if align to top.
// Append element height if we are aligning to the bottom.
if ( alignTop )
offset += winHeight;
else
{
offset += this.$.offsetHeight || 0;
// Consider the margin in the scroll, which is ok for our current needs, but
// needs investigation if we will be using this function in other places.
offset += parseInt( this.getComputedStyle( 'marginBottom' ) || 0, 10 ) || 0;
}
// Append the offsets for the entire element hierarchy.
var elementPosition = this.getDocumentPosition();
offset += elementPosition.y;
// offset value might be out of range(nagative), fix it(#3692).
offset = offset < 0 ? 0 : offset;
// Scroll the window to the desired position, if not already visible(#3795).
var currentScroll = win.getScrollPosition().y;
if ( offset > currentScroll || offset < currentScroll - winHeight )
win.$.scrollTo( 0, offset );
},
setState : function( state )
{
switch ( state )
{
case CKEDITOR.TRISTATE_ON :
this.addClass( 'cke_on' );
this.removeClass( 'cke_off' );
this.removeClass( 'cke_disabled' );
break;
case CKEDITOR.TRISTATE_DISABLED :
this.addClass( 'cke_disabled' );
this.removeClass( 'cke_off' );
this.removeClass( 'cke_on' );
break;
default :
this.addClass( 'cke_off' );
this.removeClass( 'cke_on' );
this.removeClass( 'cke_disabled' );
break;
}
},
/**
* Returns the inner document of this IFRAME element.
* @returns {CKEDITOR.dom.document} The inner document.
*/
getFrameDocument : function()
{
var $ = this.$;
try
{
// In IE, with custom document.domain, it may happen that
// the iframe is not yet available, resulting in "Access
// Denied" for the following property access.
$.contentWindow.document;
}
catch ( e )
{
// Trick to solve this issue, forcing the iframe to get ready
// by simply setting its "src" property.
$.src = $.src;
// In IE6 though, the above is not enough, so we must pause the
// execution for a while, giving it time to think.
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 )
{
window.showModalDialog(
'javascript:document.write("' +
'<script>' +
'window.setTimeout(' +
'function(){window.close();}' +
',50);' +
'</script>")' );
}
}
return $ && new CKEDITOR.dom.document( $.contentWindow.document );
},
/**
* Copy all the attributes from one node to the other, kinda like a clone
* skipAttributes is an object with the attributes that must NOT be copied.
* @param {CKEDITOR.dom.element} dest The destination element.
* @param {Object} skipAttributes A dictionary of attributes to skip.
* @example
*/
copyAttributes : function( dest, skipAttributes )
{
var attributes = this.$.attributes;
skipAttributes = skipAttributes || {};
for ( var n = 0 ; n < attributes.length ; n++ )
{
var attribute = attributes[n];
// Lowercase attribute name hard rule is broken for
// some attribute on IE, e.g. CHECKED.
var attrName = attribute.nodeName.toLowerCase(),
attrValue;
// We can set the type only once, so do it with the proper value, not copying it.
if ( attrName in skipAttributes )
continue;
if ( attrName == 'checked' && ( attrValue = this.getAttribute( attrName ) ) )
dest.setAttribute( attrName, attrValue );
// IE BUG: value attribute is never specified even if it exists.
else if ( attribute.specified ||
( CKEDITOR.env.ie && attribute.nodeValue && attrName == 'value' ) )
{
attrValue = this.getAttribute( attrName );
if ( attrValue === null )
attrValue = attribute.nodeValue;
dest.setAttribute( attrName, attrValue );
}
}
// The style:
if ( this.$.style.cssText !== '' )
dest.$.style.cssText = this.$.style.cssText;
},
/**
* Changes the tag name of the current element.
* @param {String} newTag The new tag for the element.
*/
renameNode : function( newTag )
{
// If it's already correct exit here.
if ( this.getName() == newTag )
return;
var doc = this.getDocument();
// Create the new node.
var newNode = new CKEDITOR.dom.element( newTag, doc );
// Copy all attributes.
this.copyAttributes( newNode );
// Move children to the new node.
this.moveChildren( newNode );
// Replace the node.
this.getParent() && this.$.parentNode.replaceChild( newNode.$, this.$ );
newNode.$[ 'data-cke-expando' ] = this.$[ 'data-cke-expando' ];
this.$ = newNode.$;
},
/**
* Gets a DOM tree descendant under the current node.
* @param {Array|Number} indices The child index or array of child indices under the node.
* @returns {CKEDITOR.dom.node} The specified DOM child under the current node. Null if child does not exist.
* @example
* var strong = p.getChild(0);
*/
getChild : function( indices )
{
var rawNode = this.$;
if ( !indices.slice )
rawNode = rawNode.childNodes[ indices ];
else
{
while ( indices.length > 0 && rawNode )
rawNode = rawNode.childNodes[ indices.shift() ];
}
return rawNode ? new CKEDITOR.dom.node( rawNode ) : null;
},
getChildCount : function()
{
return this.$.childNodes.length;
},
disableContextMenu : function()
{
this.on( 'contextmenu', function( event )
{
// Cancel the browser context menu.
if ( !event.data.getTarget().hasClass( 'cke_enable_context_menu' ) )
event.data.preventDefault();
} );
},
/**
* Gets element's direction. Supports both CSS 'direction' prop and 'dir' attr.
*/
getDirection : function( useComputed )
{
return useComputed ?
this.getComputedStyle( 'direction' )
// Webkit: offline element returns empty direction (#8053).
|| this.getDirection()
|| this.getDocument().$.dir
|| this.getDocument().getBody().getDirection( 1 )
: this.getStyle( 'direction' ) || this.getAttribute( 'dir' );
},
/**
* Gets, sets and removes custom data to be stored as HTML5 data-* attributes.
* @param {String} name The name of the attribute, excluding the 'data-' part.
* @param {String} [value] The value to set. If set to false, the attribute will be removed.
* @example
* element.data( 'extra-info', 'test' ); // appended the attribute data-extra-info="test" to the element
* alert( element.data( 'extra-info' ) ); // "test"
* element.data( 'extra-info', false ); // remove the data-extra-info attribute from the element
*/
data : function ( name, value )
{
name = 'data-' + name;
if ( value === undefined )
return this.getAttribute( name );
else if ( value === false )
this.removeAttribute( name );
else
this.setAttribute( name, value );
return null;
}
});
( function()
{
var sides = {
width : [ "border-left-width", "border-right-width","padding-left", "padding-right" ],
height : [ "border-top-width", "border-bottom-width", "padding-top", "padding-bottom" ]
};
function marginAndPaddingSize( type )
{
var adjustment = 0;
for ( var i = 0, len = sides[ type ].length; i < len; i++ )
adjustment += parseInt( this.getComputedStyle( sides [ type ][ i ] ) || 0, 10 ) || 0;
return adjustment;
}
/**
* Sets the element size considering the box model.
* @name CKEDITOR.dom.element.prototype.setSize
* @function
* @param {String} type The dimension to set. It accepts "width" and "height".
* @param {Number} size The length unit in px.
* @param {Boolean} isBorderBox Apply the size based on the border box model.
*/
CKEDITOR.dom.element.prototype.setSize = function( type, size, isBorderBox )
{
if ( typeof size == 'number' )
{
if ( isBorderBox && !( CKEDITOR.env.ie && CKEDITOR.env.quirks ) )
size -= marginAndPaddingSize.call( this, type );
this.setStyle( type, size + 'px' );
}
};
/**
* Gets the element size, possibly considering the box model.
* @name CKEDITOR.dom.element.prototype.getSize
* @function
* @param {String} type The dimension to get. It accepts "width" and "height".
* @param {Boolean} isBorderBox Get the size based on the border box model.
*/
CKEDITOR.dom.element.prototype.getSize = function( type, isBorderBox )
{
var size = Math.max( this.$[ 'offset' + CKEDITOR.tools.capitalize( type ) ],
this.$[ 'client' + CKEDITOR.tools.capitalize( type ) ] ) || 0;
if ( isBorderBox )
size -= marginAndPaddingSize.call( this, type );
return size;
};
})();
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the "virtual" {@link CKEDITOR.dataProcessor} class, which
* defines the basic structure of data processor objects to be
* set to {@link CKEDITOR.editor.dataProcessor}.
*/
/**
* If defined, points to the data processor which is responsible to translate
* and transform the editor data on input and output.
* Generaly it will point to an instance of {@link CKEDITOR.htmlDataProcessor},
* which handles HTML data. The editor may also handle other data formats by
* using different data processors provided by specific plugins.
* @name CKEDITOR.editor.prototype.dataProcessor
* @type CKEDITOR.dataProcessor
*/
/**
* This class is here for documentation purposes only and is not really part of
* the API. It serves as the base ("interface") for data processors
* implementation.
* @name CKEDITOR.dataProcessor
* @class Represents a data processor, which is responsible to translate and
* transform the editor data on input and output.
* @example
*/
/**
* Transforms input data into HTML to be loaded in the editor.
* While the editor is able to handle non HTML data (like BBCode), at runtime
* it can handle HTML data only. The role of the data processor is transforming
* the input data into HTML through this function.
* @name CKEDITOR.dataProcessor.prototype.toHtml
* @function
* @param {String} data The input data to be transformed.
* @param {String} [fixForBody] The tag name to be used if the data must be
* fixed because it is supposed to be loaded direcly into the <body>
* tag. This is generally not used by non-HTML data processors.
* @example
* // Tranforming BBCode data, having a custom BBCode data processor.
* var data = 'This is [b]an example[/b].';
* var html = editor.dataProcessor.toHtml( data ); // '<p>This is <b>an example</b>.</p>'
*/
/**
* Transforms HTML into data to be outputted by the editor, in the format
* expected by the data processor.
* While the editor is able to handle non HTML data (like BBCode), at runtime
* it can handle HTML data only. The role of the data processor is transforming
* the HTML data containined by the editor into a specific data format through
* this function.
* @name CKEDITOR.dataProcessor.prototype.toDataFormat
* @function
* @param {String} html The HTML to be transformed.
* @param {String} fixForBody The tag name to be used if the output data is
* coming from <body> and may be eventually fixed for it. This is
* generally not used by non-HTML data processors.
* // Tranforming into BBCode data, having a custom BBCode data processor.
* var html = '<p>This is <b>an example</b>.</p>';
* var data = editor.dataProcessor.toDataFormat( html ); // 'This is [b]an example[/b].'
*/
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the "virtual" {@link CKEDITOR.eventInfo} class, which
* contains the defintions of the event object passed to event listeners.
* This file is for documentation purposes only.
*/
/**
* (Virtual Class) Do not call this constructor. This class is not really part
* of the API.
* @class Virtual class that illustrates the features of the event object to be
* passed to event listeners by a {@link CKEDITOR.event} based object.
* @name CKEDITOR.eventInfo
* @example
* // Do not do this.
* var myEvent = new CKEDITOR.eventInfo(); // Error: CKEDITOR.eventInfo is undefined
*/
/**
* The event name.
* @name CKEDITOR.eventInfo.prototype.name
* @field
* @type String
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( <b>event.name</b> ); // "someEvent"
* });
* someObject.fire( 'someEvent' );
*/
/**
* The object that publishes (sends) the event.
* @name CKEDITOR.eventInfo.prototype.sender
* @field
* @type Object
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( <b>event.sender</b> == someObject ); // "true"
* });
* someObject.fire( 'someEvent' );
*/
/**
* The editor instance that holds the sender. May be the same as sender. May be
* null if the sender is not part of an editor instance, like a component
* running in standalone mode.
* @name CKEDITOR.eventInfo.prototype.editor
* @field
* @type CKEDITOR.editor
* @example
* myButton.on( 'someEvent', function( event )
* {
* alert( <b>event.editor</b> == myEditor ); // "true"
* });
* myButton.fire( 'someEvent', null, <b>myEditor</b> );
*/
/**
* Any kind of additional data. Its format and usage is event dependent.
* @name CKEDITOR.eventInfo.prototype.data
* @field
* @type Object
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( <b>event.data</b> ); // "Example"
* });
* someObject.fire( 'someEvent', <b>'Example'</b> );
*/
/**
* Any extra data appended during the listener registration.
* @name CKEDITOR.eventInfo.prototype.listenerData
* @field
* @type Object
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( <b>event.listenerData</b> ); // "Example"
* }
* , null, <b>'Example'</b> );
*/
/**
* Indicates that no further listeners are to be called.
* @name CKEDITOR.eventInfo.prototype.stop
* @function
* @example
* someObject.on( 'someEvent', function( event )
* {
* <b>event.stop()</b>;
* });
* someObject.on( 'someEvent', function( event )
* {
* // This one will not be called.
* });
* alert( someObject.fire( 'someEvent' ) ); // "false"
*/
/**
* Indicates that the event is to be cancelled (if cancelable).
* @name CKEDITOR.eventInfo.prototype.cancel
* @function
* @example
* someObject.on( 'someEvent', function( event )
* {
* <b>event.cancel()</b>;
* });
* someObject.on( 'someEvent', function( event )
* {
* // This one will not be called.
* });
* alert( someObject.fire( 'someEvent' ) ); // "true"
*/
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the "virtual" {@link CKEDITOR.pluginDefinition} class, which
* contains the defintion of a plugin. This file is for documentation
* purposes only.
*/
/**
* (Virtual Class) Do not call this constructor. This class is not really part
* of the API. It just illustrates the features of plugin objects to be
* passed to the {@link CKEDITOR.plugins.add} function.
* @name CKEDITOR.pluginDefinition
* @constructor
* @example
*/
/**
* A list of plugins that are required by this plugin. Note that this property
* doesn't guarantee the loading order of the plugins.
* @name CKEDITOR.pluginDefinition.prototype.requires
* @type Array
* @example
* CKEDITOR.plugins.add( 'sample',
* {
* requires : [ 'button', 'selection' ]
* });
*/
/**
* A list of language files available for this plugin. These files are stored inside
* the "lang" directory, which is inside the plugin directory, follow the name
* pattern of "langCode.js", and contain a language definition created with {@link CKEDITOR.pluginDefinition#setLang}.
* While the plugin is being loaded, the editor checks this list to see if
* a language file of the current editor language ({@link CKEDITOR.editor#langCode})
* is available, and if so, loads it. Otherwise, the file represented by the first list item
* in the list is loaded.
* @name CKEDITOR.pluginDefinition.prototype.lang
* @type Array
* @example
* CKEDITOR.plugins.add( 'sample',
* {
* lang : [ 'en', 'fr' ]
* });
*/
/**
* Function called on initialization of every editor instance created in the
* page before the init() call task. The beforeInit function will be called for
* all plugins, after that the init function is called for all of them. This
* feature makes it possible to initialize things that could be used in the
* init function of other plugins.
* @name CKEDITOR.pluginDefinition.prototype.beforeInit
* @function
* @param {CKEDITOR.editor} editor The editor instance being initialized.
* @example
* CKEDITOR.plugins.add( 'sample',
* {
* beforeInit : function( editor )
* {
* alert( 'Editor "' + editor.name + '" is to be initialized!' );
* }
* });
*/
/**
* Function called on initialization of every editor instance created in the
* page.
* @name CKEDITOR.pluginDefinition.prototype.init
* @function
* @param {CKEDITOR.editor} editor The editor instance being initialized.
* @example
* CKEDITOR.plugins.add( 'sample',
* {
* init : function( editor )
* {
* alert( 'Editor "' + editor.name + '" is being initialized!' );
* }
* });
*/
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview API initialization code.
*/
(function()
{
// Disable HC detaction in WebKit. (#5429)
if ( CKEDITOR.env.webkit )
{
CKEDITOR.env.hc = false;
return;
}
// Check whether high contrast is active by creating a colored border.
var hcDetect = CKEDITOR.dom.element.createFromHtml(
'<div style="width:0px;height:0px;position:absolute;left:-10000px;' +
'border: 1px solid;border-color: red blue;"></div>', CKEDITOR.document );
hcDetect.appendTo( CKEDITOR.document.getHead() );
// Update CKEDITOR.env.
// Catch exception needed sometimes for FF. (#4230)
try
{
CKEDITOR.env.hc = hcDetect.getComputedStyle( 'border-top-color' ) == hcDetect.getComputedStyle( 'border-right-color' );
}
catch (e)
{
CKEDITOR.env.hc = false;
}
if ( CKEDITOR.env.hc )
CKEDITOR.env.cssClass += ' cke_hc';
hcDetect.remove();
})();
// Load core plugins.
CKEDITOR.plugins.load( CKEDITOR.config.corePlugins.split( ',' ), function()
{
CKEDITOR.status = 'loaded';
CKEDITOR.fire( 'loaded' );
// Process all instances created by the "basic" implementation.
var pending = CKEDITOR._.pending;
if ( pending )
{
delete CKEDITOR._.pending;
for ( var i = 0 ; i < pending.length ; i++ )
CKEDITOR.add( pending[ i ] );
}
});
// Needed for IE6 to not request image (HTTP 200 or 304) for every CSS background. (#6187)
if ( CKEDITOR.env.ie )
{
// Remove IE mouse flickering on IE6 because of background images.
try
{
document.execCommand( 'BackgroundImageCache', false, true );
}
catch (e)
{
// We have been reported about loading problems caused by the above
// line. For safety, let's just ignore errors.
}
}
/**
* Indicates that CKEditor is running on a High Contrast environment.
* @name CKEDITOR.env.hc
* @example
* if ( CKEDITOR.env.hc )
* alert( 'You're running on High Contrast mode. The editor interface will get adapted to provide you a better experience.' );
*/
/**
* Fired when a CKEDITOR core object is fully loaded and ready for interaction.
* @name CKEDITOR#loaded
* @event
*/
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Contains the first and essential part of the {@link CKEDITOR}
* object definition.
*/
// #### Compressed Code
// Must be updated on changes in the script as well as updated in the
// ckeditor_source.js and ckeditor_basic_source.js files.
// if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.6.2',rev:'7275',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf(':/')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;return d;})(),getUrl:function(d){if(d.indexOf(':/')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/')d+=(d.indexOf('?')>=0?'&':'?')+('t=')+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();
// #### Raw code
// ATTENTION: read the above "Compressed Code" notes when changing this code.
/* @Packager.RemoveLine
// Avoid having the editor code initialized twice. (#7588)
// Use CKEDITOR.dom to check whether the full ckeditor.js code has been loaded
// or just ckeditor_basic.js.
// Remove these lines when compressing manually.
if ( window.CKEDITOR && window.CKEDITOR.dom )
return;
@Packager.RemoveLine */
if ( !window.CKEDITOR )
{
/**
* @name CKEDITOR
* @namespace This is the API entry point. The entire CKEditor code runs under this object.
* @example
*/
window.CKEDITOR = (function()
{
var CKEDITOR =
/** @lends CKEDITOR */
{
/**
* A constant string unique for each release of CKEditor. Its value
* is used, by default, to build the URL for all resources loaded
* by the editor code, guaranteeing clean cache results when
* upgrading.
* @type String
* @example
* alert( CKEDITOR.timestamp ); // e.g. '87dm'
*/
// The production implementation contains a fixed timestamp, unique
// for each release and generated by the releaser.
// (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122)
timestamp : 'B8DJ5M3',
/**
* Contains the CKEditor version number.
* @type String
* @example
* alert( CKEDITOR.version ); // e.g. 'CKEditor 3.4.1'
*/
version : '3.6.2',
/**
* Contains the CKEditor revision number.
* The revision number is incremented automatically, following each
* modification to the CKEditor source code.
* @type String
* @example
* alert( CKEDITOR.revision ); // e.g. '3975'
*/
revision : '7275',
/**
* Private object used to hold core stuff. It should not be used outside of
* the API code as properties defined here may change at any time
* without notice.
* @private
*/
_ : {},
/**
* Indicates the API loading status. The following statuses are available:
* <ul>
* <li><b>unloaded</b>: the API is not yet loaded.</li>
* <li><b>basic_loaded</b>: the basic API features are available.</li>
* <li><b>basic_ready</b>: the basic API is ready to load the full core code.</li>
* <li><b>loading</b>: the full API is being loaded.</li>
* <li><b>loaded</b>: the API can be fully used.</li>
* </ul>
* @type String
* @example
* if ( <b>CKEDITOR.status</b> == 'loaded' )
* {
* // The API can now be fully used.
* }
*/
status : 'unloaded',
/**
* Contains the full URL for the CKEditor installation directory.
* It is possible to manually provide the base path by setting a
* global variable named CKEDITOR_BASEPATH. This global variable
* must be set <strong>before</strong> the editor script loading.
* @type String
* @example
* alert( <b>CKEDITOR.basePath</b> ); // "http://www.example.com/ckeditor/" (e.g.)
*/
basePath : (function()
{
// ATTENTION: fixes to this code must be ported to
// var basePath in "core/loader.js".
// Find out the editor directory path, based on its <script> tag.
var path = window.CKEDITOR_BASEPATH || '';
if ( !path )
{
var scripts = document.getElementsByTagName( 'script' );
for ( var i = 0 ; i < scripts.length ; i++ )
{
var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
if ( match )
{
path = match[1];
break;
}
}
}
// In IE (only) the script.src string is the raw value entered in the
// HTML source. Other browsers return the full resolved URL instead.
if ( path.indexOf(':/') == -1 )
{
// Absolute path.
if ( path.indexOf( '/' ) === 0 )
path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
// Relative path.
else
path = location.href.match( /^[^\?]*\/(?:)/ )[0] + path;
}
if ( !path )
throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';
return path;
})(),
/**
* Gets the full URL for CKEditor resources. By default, URLs
* returned by this function contain a querystring parameter ("t")
* set to the {@link CKEDITOR.timestamp} value.<br />
* <br />
* It is possible to provide a custom implementation of this
* function by setting a global variable named CKEDITOR_GETURL.
* This global variable must be set <strong>before</strong> the editor script
* loading. If the custom implementation returns nothing (==null), the
* default implementation is used.
* @param {String} resource The resource whose full URL we want to get.
* It may be a full, absolute, or relative URL.
* @returns {String} The full URL.
* @example
* // e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
* alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
* @example
* // e.g. http://www.example.com/skins/default/editor.css?t=87dm
* alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
* @example
* // e.g. http://www.somesite.com/skins/default/editor.css?t=87dm
* alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );
*/
getUrl : function( resource )
{
// If this is not a full or absolute path.
if ( resource.indexOf(':/') == -1 && resource.indexOf( '/' ) !== 0 )
resource = this.basePath + resource;
// Add the timestamp, except for directories.
if ( this.timestamp && resource.charAt( resource.length - 1 ) != '/' && !(/[&?]t=/).test( resource ) )
resource += ( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + this.timestamp;
return resource;
}
};
// Make it possible to override the getUrl function with a custom
// implementation pointing to a global named CKEDITOR_GETURL.
var newGetUrl = window.CKEDITOR_GETURL;
if ( newGetUrl )
{
var originalGetUrl = CKEDITOR.getUrl;
CKEDITOR.getUrl = function ( resource )
{
return newGetUrl.call( CKEDITOR, resource ) ||
originalGetUrl.call( CKEDITOR, resource );
};
}
return CKEDITOR;
})();
}
/**
* Function called upon loading a custom configuration file that can
* modify the editor instance configuration ({@link CKEDITOR.editor#config }).
* It is usually defined inside the custom configuration files that can
* include developer defined settings.
* @name CKEDITOR.editorConfig
* @function
* @param {CKEDITOR.config} config A configuration object containing the
* settings defined for a {@link CKEDITOR.editor} instance up to this
* function call. Note that not all settings may still be available. See
* <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations#Configuration_Loading_Order">Configuration Loading Order</a>
* for details.
* @example
* // This is supposed to be placed in the config.js file.
* CKEDITOR.editorConfig = function( config )
* {
* // Define changes to default configuration here. For example:
* config.language = 'fr';
* config.uiColor = '#AADC6E';
* };
*/
// PACKAGER_RENAME( CKEDITOR )
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
/**
* A lightweight representation of HTML text.
* @constructor
* @example
*/
CKEDITOR.htmlParser.cdata = function( value )
{
/**
* The CDATA value.
* @type String
* @example
*/
this.value = value;
};
CKEDITOR.htmlParser.cdata.prototype =
{
/**
* CDATA has the same type as {@link CKEDITOR.htmlParser.text} This is
* a constant value set to {@link CKEDITOR.NODE_TEXT}.
* @type Number
* @example
*/
type : CKEDITOR.NODE_TEXT,
/**
* Writes write the CDATA with no special manipulations.
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
*/
writeHtml : function( writer )
{
writer.write( this.value );
}
};
})();
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
CKEDITOR.htmlParser.filter = CKEDITOR.tools.createClass(
{
$ : function( rules )
{
this._ =
{
elementNames : [],
attributeNames : [],
elements : { $length : 0 },
attributes : { $length : 0 }
};
if ( rules )
this.addRules( rules, 10 );
},
proto :
{
addRules : function( rules, priority )
{
if ( typeof priority != 'number' )
priority = 10;
// Add the elementNames.
addItemsToList( this._.elementNames, rules.elementNames, priority );
// Add the attributeNames.
addItemsToList( this._.attributeNames, rules.attributeNames, priority );
// Add the elements.
addNamedItems( this._.elements, rules.elements, priority );
// Add the attributes.
addNamedItems( this._.attributes, rules.attributes, priority );
// Add the text.
this._.text = transformNamedItem( this._.text, rules.text, priority ) || this._.text;
// Add the comment.
this._.comment = transformNamedItem( this._.comment, rules.comment, priority ) || this._.comment;
// Add root fragment.
this._.root = transformNamedItem( this._.root, rules.root, priority ) || this._.root;
},
onElementName : function( name )
{
return filterName( name, this._.elementNames );
},
onAttributeName : function( name )
{
return filterName( name, this._.attributeNames );
},
onText : function( text )
{
var textFilter = this._.text;
return textFilter ? textFilter.filter( text ) : text;
},
onComment : function( commentText, comment )
{
var textFilter = this._.comment;
return textFilter ? textFilter.filter( commentText, comment ) : commentText;
},
onFragment : function( element )
{
var rootFilter = this._.root;
return rootFilter ? rootFilter.filter( element ) : element;
},
onElement : function( element )
{
// We must apply filters set to the specific element name as
// well as those set to the generic $ name. So, add both to an
// array and process them in a small loop.
var filters = [ this._.elements[ '^' ], this._.elements[ element.name ], this._.elements.$ ],
filter, ret;
for ( var i = 0 ; i < 3 ; i++ )
{
filter = filters[ i ];
if ( filter )
{
ret = filter.filter( element, this );
if ( ret === false )
return null;
if ( ret && ret != element )
return this.onNode( ret );
// The non-root element has been dismissed by one of the filters.
if ( element.parent && !element.name )
break;
}
}
return element;
},
onNode : function( node )
{
var type = node.type;
return type == CKEDITOR.NODE_ELEMENT ? this.onElement( node ) :
type == CKEDITOR.NODE_TEXT ? new CKEDITOR.htmlParser.text( this.onText( node.value ) ) :
type == CKEDITOR.NODE_COMMENT ? new CKEDITOR.htmlParser.comment( this.onComment( node.value ) ):
null;
},
onAttribute : function( element, name, value )
{
var filter = this._.attributes[ name ];
if ( filter )
{
var ret = filter.filter( value, element, this );
if ( ret === false )
return false;
if ( typeof ret != 'undefined' )
return ret;
}
return value;
}
}
});
function filterName( name, filters )
{
for ( var i = 0 ; name && i < filters.length ; i++ )
{
var filter = filters[ i ];
name = name.replace( filter[ 0 ], filter[ 1 ] );
}
return name;
}
function addItemsToList( list, items, priority )
{
if ( typeof items == 'function' )
items = [ items ];
var i, j,
listLength = list.length,
itemsLength = items && items.length;
if ( itemsLength )
{
// Find the index to insert the items at.
for ( i = 0 ; i < listLength && list[ i ].pri < priority ; i++ )
{ /*jsl:pass*/ }
// Add all new items to the list at the specific index.
for ( j = itemsLength - 1 ; j >= 0 ; j-- )
{
var item = items[ j ];
if ( item )
{
item.pri = priority;
list.splice( i, 0, item );
}
}
}
}
function addNamedItems( hashTable, items, priority )
{
if ( items )
{
for ( var name in items )
{
var current = hashTable[ name ];
hashTable[ name ] =
transformNamedItem(
current,
items[ name ],
priority );
if ( !current )
hashTable.$length++;
}
}
}
function transformNamedItem( current, item, priority )
{
if ( item )
{
item.pri = priority;
if ( current )
{
// If the current item is not an Array, transform it.
if ( !current.splice )
{
if ( current.pri > priority )
current = [ item, current ];
else
current = [ current, item ];
current.filter = callItems;
}
else
addItemsToList( current, item, priority );
return current;
}
else
{
item.filter = item;
return item;
}
}
}
// Invoke filters sequentially on the array, break the iteration
// when it doesn't make sense to continue anymore.
function callItems( currentEntry )
{
var isNode = currentEntry.type
|| currentEntry instanceof CKEDITOR.htmlParser.fragment;
for ( var i = 0 ; i < this.length ; i++ )
{
// Backup the node info before filtering.
if ( isNode )
{
var orgType = currentEntry.type,
orgName = currentEntry.name;
}
var item = this[ i ],
ret = item.apply( window, arguments );
if ( ret === false )
return ret;
// We're filtering node (element/fragment).
if ( isNode )
{
// No further filtering if it's not anymore
// fitable for the subsequent filters.
if ( ret && ( ret.name != orgName
|| ret.type != orgType ) )
{
return ret;
}
}
// Filtering value (nodeName/textValue/attrValue).
else
{
// No further filtering if it's not
// any more values.
if ( typeof ret != 'string' )
return ret;
}
ret != undefined && ( currentEntry = ret );
}
return currentEntry;
}
})();
// "entities" plugin
/*
{
text : function( text )
{
// TODO : Process entities.
return text.toUpperCase();
}
};
*/
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* A lightweight representation of an HTML comment.
* @constructor
* @example
*/
CKEDITOR.htmlParser.comment = function( value )
{
/**
* The comment text.
* @type String
* @example
*/
this.value = value;
/** @private */
this._ =
{
isBlockLike : false
};
};
CKEDITOR.htmlParser.comment.prototype =
{
/**
* The node type. This is a constant value set to {@link CKEDITOR.NODE_COMMENT}.
* @type Number
* @example
*/
type : CKEDITOR.NODE_COMMENT,
/**
* Writes the HTML representation of this comment to a CKEDITOR.htmlWriter.
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
* @example
*/
writeHtml : function( writer, filter )
{
var comment = this.value;
if ( filter )
{
if ( !( comment = filter.onComment( comment, this ) ) )
return;
if ( typeof comment != 'string' )
{
comment.parent = this.parent;
comment.writeHtml( writer, filter );
return;
}
}
writer.comment( comment );
}
};
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
/**
* A lightweight representation of HTML text.
* @constructor
* @example
*/
CKEDITOR.htmlParser.text = function( value )
{
/**
* The text value.
* @type String
* @example
*/
this.value = value;
/** @private */
this._ =
{
isBlockLike : false
};
};
CKEDITOR.htmlParser.text.prototype =
{
/**
* The node type. This is a constant value set to {@link CKEDITOR.NODE_TEXT}.
* @type Number
* @example
*/
type : CKEDITOR.NODE_TEXT,
/**
* Writes the HTML representation of this text to a CKEDITOR.htmlWriter.
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
* @example
*/
writeHtml : function( writer, filter )
{
var text = this.value;
if ( filter && !( text = filter.onText( text, this ) ) )
return;
writer.text( text );
}
};
})();
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.htmlParser.basicWriter = CKEDITOR.tools.createClass(
{
$ : function()
{
this._ =
{
output : []
};
},
proto :
{
/**
* Writes the tag opening part for a opener tag.
* @param {String} tagName The element name for this tag.
* @param {Object} attributes The attributes defined for this tag. The
* attributes could be used to inspect the tag.
* @example
* // Writes "<p".
* writer.openTag( 'p', { class : 'MyClass', id : 'MyId' } );
*/
openTag : function( tagName, attributes )
{
this._.output.push( '<', tagName );
},
/**
* Writes the tag closing part for a opener tag.
* @param {String} tagName The element name for this tag.
* @param {Boolean} isSelfClose Indicates that this is a self-closing tag,
* like "br" or "img".
* @example
* // Writes ">".
* writer.openTagClose( 'p', false );
* @example
* // Writes " />".
* writer.openTagClose( 'br', true );
*/
openTagClose : function( tagName, isSelfClose )
{
if ( isSelfClose )
this._.output.push( ' />' );
else
this._.output.push( '>' );
},
/**
* Writes an attribute. This function should be called after opening the
* tag with {@link #openTagClose}.
* @param {String} attName The attribute name.
* @param {String} attValue The attribute value.
* @example
* // Writes ' class="MyClass"'.
* writer.attribute( 'class', 'MyClass' );
*/
attribute : function( attName, attValue )
{
// Browsers don't always escape special character in attribute values. (#4683, #4719).
if ( typeof attValue == 'string' )
attValue = CKEDITOR.tools.htmlEncodeAttr( attValue );
this._.output.push( ' ', attName, '="', attValue, '"' );
},
/**
* Writes a closer tag.
* @param {String} tagName The element name for this tag.
* @example
* // Writes "</p>".
* writer.closeTag( 'p' );
*/
closeTag : function( tagName )
{
this._.output.push( '</', tagName, '>' );
},
/**
* Writes text.
* @param {String} text The text value
* @example
* // Writes "Hello Word".
* writer.text( 'Hello Word' );
*/
text : function( text )
{
this._.output.push( text );
},
/**
* Writes a comment.
* @param {String} comment The comment text.
* @example
* // Writes "<!-- My comment -->".
* writer.comment( ' My comment ' );
*/
comment : function( comment )
{
this._.output.push( '<!--', comment, '-->' );
},
/**
* Writes any kind of data to the ouput.
* @example
* writer.write( 'This is an <b>example</b>.' );
*/
write : function( data )
{
this._.output.push( data );
},
/**
* Empties the current output buffer.
* @example
* writer.reset();
*/
reset : function()
{
this._.output = [];
this._.indent = false;
},
/**
* Empties the current output buffer.
* @param {Boolean} reset Indicates that the {@link reset} function is to
* be automatically called after retrieving the HTML.
* @returns {String} The HTML written to the writer so far.
* @example
* var html = writer.getHtml();
*/
getHtml : function( reset )
{
var html = this._.output.join( '' );
if ( reset )
this.reset();
return html;
}
}
});
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* A lightweight representation of an HTML DOM structure.
* @constructor
* @example
*/
CKEDITOR.htmlParser.fragment = function()
{
/**
* The nodes contained in the root of this fragment.
* @type Array
* @example
* var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<b>Sample</b> Text' );
* alert( fragment.children.length ); "2"
*/
this.children = [];
/**
* Get the fragment parent. Should always be null.
* @type Object
* @default null
* @example
*/
this.parent = null;
/** @private */
this._ =
{
isBlockLike : true,
hasInlineStarted : false
};
};
(function()
{
// Block-level elements whose internal structure should be respected during
// parser fixing.
var nonBreakingBlocks = CKEDITOR.tools.extend( { table:1,ul:1,ol:1,dl:1 }, CKEDITOR.dtd.table, CKEDITOR.dtd.ul, CKEDITOR.dtd.ol, CKEDITOR.dtd.dl );
// IE < 8 don't output the close tag on definition list items. (#6975)
var optionalCloseTags = CKEDITOR.env.ie && CKEDITOR.env.version < 8 ? { dd : 1, dt :1 } : {};
var listBlocks = { ol:1, ul:1 };
// Dtd of the fragment element, basically it accept anything except for intermediate structure, e.g. orphan <li>.
var rootDtd = CKEDITOR.tools.extend( {}, { html: 1 }, CKEDITOR.dtd.html, CKEDITOR.dtd.body, CKEDITOR.dtd.head, { style:1,script:1 } );
function isRemoveEmpty( node )
{
// Empty link is to be removed when empty but not anchor. (#7894)
return node.name == 'a' && node.attributes.href
|| CKEDITOR.dtd.$removeEmpty[ node.name ];
}
/**
* Creates a {@link CKEDITOR.htmlParser.fragment} from an HTML string.
* @param {String} fragmentHtml The HTML to be parsed, filling the fragment.
* @param {Number} [fixForBody=false] Wrap body with specified element if needed.
* @param {CKEDITOR.htmlParser.element} contextNode Parse the html as the content of this element.
* @returns CKEDITOR.htmlParser.fragment The fragment created.
* @example
* var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<b>Sample</b> Text' );
* alert( fragment.children[0].name ); "b"
* alert( fragment.children[1].value ); " Text"
*/
CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml, fixForBody, contextNode )
{
var parser = new CKEDITOR.htmlParser(),
fragment = contextNode || new CKEDITOR.htmlParser.fragment(),
pendingInline = [],
pendingBRs = [],
currentNode = fragment,
// Indicate we're inside a <textarea> element, spaces should be touched differently.
inTextarea = false,
// Indicate we're inside a <pre> element, spaces should be touched differently.
inPre = false;
function checkPending( newTagName )
{
var pendingBRsSent;
if ( pendingInline.length > 0 )
{
for ( var i = 0 ; i < pendingInline.length ; i++ )
{
var pendingElement = pendingInline[ i ],
pendingName = pendingElement.name,
pendingDtd = CKEDITOR.dtd[ pendingName ],
currentDtd = currentNode.name && CKEDITOR.dtd[ currentNode.name ];
if ( ( !currentDtd || currentDtd[ pendingName ] ) && ( !newTagName || !pendingDtd || pendingDtd[ newTagName ] || !CKEDITOR.dtd[ newTagName ] ) )
{
if ( !pendingBRsSent )
{
sendPendingBRs();
pendingBRsSent = 1;
}
// Get a clone for the pending element.
pendingElement = pendingElement.clone();
// Add it to the current node and make it the current,
// so the new element will be added inside of it.
pendingElement.parent = currentNode;
currentNode = pendingElement;
// Remove the pending element (back the index by one
// to properly process the next entry).
pendingInline.splice( i, 1 );
i--;
}
else
{
// Some element of the same type cannot be nested, flat them,
// e.g. <a href="#">foo<a href="#">bar</a></a>. (#7894)
if ( pendingName == currentNode.name )
addElement( currentNode, currentNode.parent, 1 ), i--;
}
}
}
}
function sendPendingBRs()
{
while ( pendingBRs.length )
currentNode.add( pendingBRs.shift() );
}
/*
* Beside of simply append specified element to target, this function also takes
* care of other dirty lifts like forcing block in body, trimming spaces at
* the block boundaries etc.
*
* @param {Element} element The element to be added as the last child of {@link target}.
* @param {Element} target The parent element to relieve the new node.
* @param {Boolean} [moveCurrent=false] Don't change the "currentNode" global unless
* there's a return point node specified on the element, otherwise move current onto {@link target} node.
*/
function addElement( element, target, moveCurrent )
{
// Ignore any element that has already been added.
if ( element.previous !== undefined )
return;
target = target || currentNode || fragment;
// Current element might be mangled by fix body below,
// save it for restore later.
var savedCurrent = currentNode;
// If the target is the fragment and this inline element can't go inside
// body (if fixForBody).
if ( fixForBody && ( !target.type || target.name == 'body' ) )
{
var elementName, realElementName;
if ( element.attributes
&& ( realElementName =
element.attributes[ 'data-cke-real-element-type' ] ) )
elementName = realElementName;
else
elementName = element.name;
if ( elementName && !( elementName in CKEDITOR.dtd.$body || elementName == 'body' || element.isOrphan ) )
{
// Create a <p> in the fragment.
currentNode = target;
parser.onTagOpen( fixForBody, {} );
// The new target now is the <p>.
element.returnPoint = target = currentNode;
}
}
// Rtrim empty spaces on block end boundary. (#3585)
if ( element._.isBlockLike
&& element.name != 'pre' && element.name != 'textarea' )
{
var length = element.children.length,
lastChild = element.children[ length - 1 ],
text;
if ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT )
{
if ( !( text = CKEDITOR.tools.rtrim( lastChild.value ) ) )
element.children.length = length -1;
else
lastChild.value = text;
}
}
target.add( element );
if ( element.returnPoint )
{
currentNode = element.returnPoint;
delete element.returnPoint;
}
else
currentNode = moveCurrent ? target : savedCurrent;
}
parser.onTagOpen = function( tagName, attributes, selfClosing, optionalClose )
{
var element = new CKEDITOR.htmlParser.element( tagName, attributes );
// "isEmpty" will be always "false" for unknown elements, so we
// must force it if the parser has identified it as a selfClosing tag.
if ( element.isUnknown && selfClosing )
element.isEmpty = true;
// Check for optional closed elements, including browser quirks and manually opened blocks.
element.isOptionalClose = tagName in optionalCloseTags || optionalClose;
// This is a tag to be removed if empty, so do not add it immediately.
if ( isRemoveEmpty( element ) )
{
pendingInline.push( element );
return;
}
else if ( tagName == 'pre' )
inPre = true;
else if ( tagName == 'br' && inPre )
{
currentNode.add( new CKEDITOR.htmlParser.text( '\n' ) );
return;
}
else if ( tagName == 'textarea' )
inTextarea = true;
if ( tagName == 'br' )
{
pendingBRs.push( element );
return;
}
while( 1 )
{
var currentName = currentNode.name;
var currentDtd = currentName ? ( CKEDITOR.dtd[ currentName ]
|| ( currentNode._.isBlockLike ? CKEDITOR.dtd.div : CKEDITOR.dtd.span ) )
: rootDtd;
// If the element cannot be child of the current element.
if ( !element.isUnknown && !currentNode.isUnknown && !currentDtd[ tagName ] )
{
// Current node doesn't have a close tag, time for a close
// as this element isn't fit in. (#7497)
if ( currentNode.isOptionalClose )
parser.onTagClose( currentName );
// Fixing malformed nested lists by moving it into a previous list item. (#3828)
else if ( tagName in listBlocks
&& currentName in listBlocks )
{
var children = currentNode.children,
lastChild = children[ children.length - 1 ];
// Establish the list item if it's not existed.
if ( !( lastChild && lastChild.name == 'li' ) )
addElement( ( lastChild = new CKEDITOR.htmlParser.element( 'li' ) ), currentNode );
!element.returnPoint && ( element.returnPoint = currentNode );
currentNode = lastChild;
}
// Establish new list root for orphan list items.
else if ( tagName in CKEDITOR.dtd.$listItem && currentName != tagName )
parser.onTagOpen( tagName == 'li' ? 'ul' : 'dl', {}, 0, 1 );
// We're inside a structural block like table and list, AND the incoming element
// is not of the same type (e.g. <td>td1<td>td2</td>), we simply add this new one before it,
// and most importantly, return back to here once this element is added,
// e.g. <table><tr><td>td1</td><p>p1</p><td>td2</td></tr></table>
else if ( currentName in nonBreakingBlocks && currentName != tagName )
{
!element.returnPoint && ( element.returnPoint = currentNode );
currentNode = currentNode.parent;
}
else
{
// The current element is an inline element, which
// need to be continued even after the close, so put
// it in the pending list.
if ( currentName in CKEDITOR.dtd.$inline )
pendingInline.unshift( currentNode );
// The most common case where we just need to close the
// current one and append the new one to the parent.
if ( currentNode.parent )
addElement( currentNode, currentNode.parent, 1 );
// We've tried our best to fix the embarrassment here, while
// this element still doesn't find it's parent, mark it as
// orphan and show our tolerance to it.
else
{
element.isOrphan = 1;
break;
}
}
}
else
break;
}
checkPending( tagName );
sendPendingBRs();
element.parent = currentNode;
if ( element.isEmpty )
addElement( element );
else
currentNode = element;
};
parser.onTagClose = function( tagName )
{
// Check if there is any pending tag to be closed.
for ( var i = pendingInline.length - 1 ; i >= 0 ; i-- )
{
// If found, just remove it from the list.
if ( tagName == pendingInline[ i ].name )
{
pendingInline.splice( i, 1 );
return;
}
}
var pendingAdd = [],
newPendingInline = [],
candidate = currentNode;
while ( candidate != fragment && candidate.name != tagName )
{
// If this is an inline element, add it to the pending list, if we're
// really closing one of the parents element later, they will continue
// after it.
if ( !candidate._.isBlockLike )
newPendingInline.unshift( candidate );
// This node should be added to it's parent at this point. But,
// it should happen only if the closing tag is really closing
// one of the nodes. So, for now, we just cache it.
pendingAdd.push( candidate );
// Make sure return point is properly restored.
candidate = candidate.returnPoint || candidate.parent;
}
if ( candidate != fragment )
{
// Add all elements that have been found in the above loop.
for ( i = 0 ; i < pendingAdd.length ; i++ )
{
var node = pendingAdd[ i ];
addElement( node, node.parent );
}
currentNode = candidate;
if ( currentNode.name == 'pre' )
inPre = false;
if ( currentNode.name == 'textarea' )
inTextarea = false;
if ( candidate._.isBlockLike )
sendPendingBRs();
addElement( candidate, candidate.parent );
// The parent should start receiving new nodes now, except if
// addElement changed the currentNode.
if ( candidate == currentNode )
currentNode = currentNode.parent;
pendingInline = pendingInline.concat( newPendingInline );
}
if ( tagName == 'body' )
fixForBody = false;
};
parser.onText = function( text )
{
// Trim empty spaces at beginning of text contents except <pre> and <textarea>.
if ( ( !currentNode._.hasInlineStarted || pendingBRs.length ) && !inPre && !inTextarea )
{
text = CKEDITOR.tools.ltrim( text );
if ( text.length === 0 )
return;
}
sendPendingBRs();
checkPending();
if ( fixForBody
&& ( !currentNode.type || currentNode.name == 'body' )
&& CKEDITOR.tools.trim( text ) )
{
this.onTagOpen( fixForBody, {}, 0, 1 );
}
// Shrinking consequential spaces into one single for all elements
// text contents.
if ( !inPre && !inTextarea )
text = text.replace( /[\t\r\n ]{2,}|[\t\r\n]/g, ' ' );
currentNode.add( new CKEDITOR.htmlParser.text( text ) );
};
parser.onCDATA = function( cdata )
{
currentNode.add( new CKEDITOR.htmlParser.cdata( cdata ) );
};
parser.onComment = function( comment )
{
sendPendingBRs();
checkPending();
currentNode.add( new CKEDITOR.htmlParser.comment( comment ) );
};
// Parse it.
parser.parse( fragmentHtml );
// Send all pending BRs except one, which we consider a unwanted bogus. (#5293)
sendPendingBRs( !CKEDITOR.env.ie && 1 );
// Close all pending nodes, make sure return point is properly restored.
while ( currentNode != fragment )
addElement( currentNode, currentNode.parent, 1 );
return fragment;
};
CKEDITOR.htmlParser.fragment.prototype =
{
/**
* Adds a node to this fragment.
* @param {Object} node The node to be added. It can be any of of the
* following types: {@link CKEDITOR.htmlParser.element},
* {@link CKEDITOR.htmlParser.text} and
* {@link CKEDITOR.htmlParser.comment}.
* @param {Number} [index] From where the insertion happens.
* @example
*/
add : function( node, index )
{
isNaN( index ) && ( index = this.children.length );
var previous = index > 0 ? this.children[ index - 1 ] : null;
if ( previous )
{
// If the block to be appended is following text, trim spaces at
// the right of it.
if ( node._.isBlockLike && previous.type == CKEDITOR.NODE_TEXT )
{
previous.value = CKEDITOR.tools.rtrim( previous.value );
// If we have completely cleared the previous node.
if ( previous.value.length === 0 )
{
// Remove it from the list and add the node again.
this.children.pop();
this.add( node );
return;
}
}
previous.next = node;
}
node.previous = previous;
node.parent = this;
this.children.splice( index, 0, node );
this._.hasInlineStarted = node.type == CKEDITOR.NODE_TEXT || ( node.type == CKEDITOR.NODE_ELEMENT && !node._.isBlockLike );
},
/**
* Writes the fragment HTML to a CKEDITOR.htmlWriter.
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
* @example
* var writer = new CKEDITOR.htmlWriter();
* var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<P><B>Example' );
* fragment.writeHtml( writer )
* alert( writer.getHtml() ); "<p><b>Example</b></p>"
*/
writeHtml : function( writer, filter )
{
var isChildrenFiltered;
this.filterChildren = function()
{
var writer = new CKEDITOR.htmlParser.basicWriter();
this.writeChildrenHtml.call( this, writer, filter, true );
var html = writer.getHtml();
this.children = new CKEDITOR.htmlParser.fragment.fromHtml( html ).children;
isChildrenFiltered = 1;
};
// Filtering the root fragment before anything else.
!this.name && filter && filter.onFragment( this );
this.writeChildrenHtml( writer, isChildrenFiltered ? null : filter );
},
writeChildrenHtml : function( writer, filter )
{
for ( var i = 0 ; i < this.children.length ; i++ )
this.children[i].writeHtml( writer, filter );
}
};
})();
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* A lightweight representation of an HTML element.
* @param {String} name The element name.
* @param {Object} attributes And object holding all attributes defined for
* this element.
* @constructor
* @example
*/
CKEDITOR.htmlParser.element = function( name, attributes )
{
/**
* The element name.
* @type String
* @example
*/
this.name = name;
/**
* Holds the attributes defined for this element.
* @type Object
* @example
*/
this.attributes = attributes || ( attributes = {} );
/**
* The nodes that are direct children of this element.
* @type Array
* @example
*/
this.children = [];
var tagName = attributes[ 'data-cke-real-element-type' ] || name || '';
// Reveal the real semantic of our internal custom tag name (#6639).
var internalTag = tagName.match( /^cke:(.*)/ );
internalTag && ( tagName = internalTag[ 1 ] );
var dtd = CKEDITOR.dtd,
isBlockLike = !!( dtd.$nonBodyContent[ tagName ]
|| dtd.$block[ tagName ]
|| dtd.$listItem[ tagName ]
|| dtd.$tableContent[ tagName ]
|| dtd.$nonEditable[ tagName ]
|| tagName == 'br' ),
isEmpty = !!dtd.$empty[ name ];
this.isEmpty = isEmpty;
this.isUnknown = !dtd[ name ];
/** @private */
this._ =
{
isBlockLike : isBlockLike,
hasInlineStarted : isEmpty || !isBlockLike
};
};
/**
* Object presentation of CSS style declaration text.
* @param {CKEDITOR.htmlParser.element|String} elementOrStyleText A html parser element or the inline style text.
*/
CKEDITOR.htmlParser.cssStyle = function()
{
var styleText,
arg = arguments[ 0 ],
rules = {};
styleText = arg instanceof CKEDITOR.htmlParser.element ? arg.attributes.style : arg;
// html-encoded quote might be introduced by 'font-family'
// from MS-Word which confused the following regexp. e.g.
//'font-family: "Lucida, Console"'
( styleText || '' )
.replace( /"/g, '"' )
.replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g,
function( match, name, value )
{
name == 'font-family' && ( value = value.replace( /["']/g, '' ) );
rules[ name.toLowerCase() ] = value;
});
return {
rules : rules,
/**
* Apply the styles onto the specified element or object.
* @param {CKEDITOR.htmlParser.element|CKEDITOR.dom.element|Object} obj
*/
populate : function( obj )
{
var style = this.toString();
if ( style )
{
obj instanceof CKEDITOR.dom.element ?
obj.setAttribute( 'style', style ) :
obj instanceof CKEDITOR.htmlParser.element ?
obj.attributes.style = style :
obj.style = style;
}
},
toString : function()
{
var output = [];
for ( var i in rules )
rules[ i ] && output.push( i, ':', rules[ i ], ';' );
return output.join( '' );
}
};
};
(function()
{
// Used to sort attribute entries in an array, where the first element of
// each object is the attribute name.
var sortAttribs = function( a, b )
{
a = a[0];
b = b[0];
return a < b ? -1 : a > b ? 1 : 0;
};
CKEDITOR.htmlParser.element.prototype =
{
/**
* The node type. This is a constant value set to {@link CKEDITOR.NODE_ELEMENT}.
* @type Number
* @example
*/
type : CKEDITOR.NODE_ELEMENT,
/**
* Adds a node to the element children list.
* @param {Object} node The node to be added. It can be any of of the
* following types: {@link CKEDITOR.htmlParser.element},
* {@link CKEDITOR.htmlParser.text} and
* {@link CKEDITOR.htmlParser.comment}.
* @function
* @example
*/
add : CKEDITOR.htmlParser.fragment.prototype.add,
/**
* Clone this element.
* @returns {CKEDITOR.htmlParser.element} The element clone.
* @example
*/
clone : function()
{
return new CKEDITOR.htmlParser.element( this.name, this.attributes );
},
/**
* Writes the element HTML to a CKEDITOR.htmlWriter.
* @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
* @example
*/
writeHtml : function( writer, filter )
{
var attributes = this.attributes;
// Ignore cke: prefixes when writing HTML.
var element = this,
writeName = element.name,
a, newAttrName, value;
var isChildrenFiltered;
/**
* Providing an option for bottom-up filtering order ( element
* children to be pre-filtered before the element itself ).
*/
element.filterChildren = function()
{
if ( !isChildrenFiltered )
{
var writer = new CKEDITOR.htmlParser.basicWriter();
CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.call( element, writer, filter );
element.children = new CKEDITOR.htmlParser.fragment.fromHtml( writer.getHtml(), 0, element.clone() ).children;
isChildrenFiltered = 1;
}
};
if ( filter )
{
while ( true )
{
if ( !( writeName = filter.onElementName( writeName ) ) )
return;
element.name = writeName;
if ( !( element = filter.onElement( element ) ) )
return;
element.parent = this.parent;
if ( element.name == writeName )
break;
// If the element has been replaced with something of a
// different type, then make the replacement write itself.
if ( element.type != CKEDITOR.NODE_ELEMENT )
{
element.writeHtml( writer, filter );
return;
}
writeName = element.name;
// This indicate that the element has been dropped by
// filter but not the children.
if ( !writeName )
{
// Fix broken parent refs.
for ( var c = 0, length = this.children.length ; c < length ; c++ )
this.children[ c ].parent = element.parent;
this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter );
return;
}
}
// The element may have been changed, so update the local
// references.
attributes = element.attributes;
}
// Open element tag.
writer.openTag( writeName, attributes );
// Copy all attributes to an array.
var attribsArray = [];
// Iterate over the attributes twice since filters may alter
// other attributes.
for ( var i = 0 ; i < 2; i++ )
{
for ( a in attributes )
{
newAttrName = a;
value = attributes[ a ];
if ( i == 1 )
attribsArray.push( [ a, value ] );
else if ( filter )
{
while ( true )
{
if ( !( newAttrName = filter.onAttributeName( a ) ) )
{
delete attributes[ a ];
break;
}
else if ( newAttrName != a )
{
delete attributes[ a ];
a = newAttrName;
continue;
}
else
break;
}
if ( newAttrName )
{
if ( ( value = filter.onAttribute( element, newAttrName, value ) ) === false )
delete attributes[ newAttrName ];
else
attributes [ newAttrName ] = value;
}
}
}
}
// Sort the attributes by name.
if ( writer.sortAttributes )
attribsArray.sort( sortAttribs );
// Send the attributes.
var len = attribsArray.length;
for ( i = 0 ; i < len ; i++ )
{
var attrib = attribsArray[ i ];
writer.attribute( attrib[0], attrib[1] );
}
// Close the tag.
writer.openTagClose( writeName, element.isEmpty );
if ( !element.isEmpty )
{
this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter );
// Close the element.
writer.closeTag( writeName );
}
},
writeChildrenHtml : function( writer, filter )
{
// Send children.
CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.apply( this, arguments );
}
};
})();
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
var loadedLangs = {};
/**
* @namespace Holds language related functions.
*/
CKEDITOR.lang =
{
/**
* The list of languages available in the editor core.
* @type Object
* @example
* alert( CKEDITOR.lang.en ); // "true"
*/
languages :
{
'af' : 1,
'ar' : 1,
'bg' : 1,
'bn' : 1,
'bs' : 1,
'ca' : 1,
'cs' : 1,
'cy' : 1,
'da' : 1,
'de' : 1,
'el' : 1,
'en-au' : 1,
'en-ca' : 1,
'en-gb' : 1,
'en' : 1,
'eo' : 1,
'es' : 1,
'et' : 1,
'eu' : 1,
'fa' : 1,
'fi' : 1,
'fo' : 1,
'fr-ca' : 1,
'fr' : 1,
'gl' : 1,
'gu' : 1,
'he' : 1,
'hi' : 1,
'hr' : 1,
'hu' : 1,
'is' : 1,
'it' : 1,
'ja' : 1,
'ka' : 1,
'km' : 1,
'ko' : 1,
'lt' : 1,
'lv' : 1,
'mn' : 1,
'ms' : 1,
'nb' : 1,
'nl' : 1,
'no' : 1,
'pl' : 1,
'pt-br' : 1,
'pt' : 1,
'ro' : 1,
'ru' : 1,
'sk' : 1,
'sl' : 1,
'sr-latn' : 1,
'sr' : 1,
'sv' : 1,
'th' : 1,
'tr' : 1,
'uk' : 1,
'vi' : 1,
'zh-cn' : 1,
'zh' : 1
},
/**
* Loads a specific language file, or auto detect it. A callback is
* then called when the file gets loaded.
* @param {String} languageCode The code of the language file to be
* loaded. If null or empty, autodetection will be performed. The
* same happens if the language is not supported.
* @param {String} defaultLanguage The language to be used if
* languageCode is not supported or if the autodetection fails.
* @param {Function} callback A function to be called once the
* language file is loaded. Two parameters are passed to this
* function: the language code and the loaded language entries.
* @example
*/
load : function( languageCode, defaultLanguage, callback )
{
// If no languageCode - fallback to browser or default.
// If languageCode - fallback to no-localized version or default.
if ( !languageCode || !CKEDITOR.lang.languages[ languageCode ] )
languageCode = this.detect( defaultLanguage, languageCode );
if ( !this[ languageCode ] )
{
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl(
'_source/' + // @Packager.RemoveLine
'lang/' + languageCode + '.js' ),
function()
{
callback( languageCode, this[ languageCode ] );
}
, this );
}
else
callback( languageCode, this[ languageCode ] );
},
/**
* Returns the language that best fit the user language. For example,
* suppose that the user language is "pt-br". If this language is
* supported by the editor, it is returned. Otherwise, if only "pt" is
* supported, it is returned instead. If none of the previous are
* supported, a default language is then returned.
* @param {String} defaultLanguage The default language to be returned
* if the user language is not supported.
* @param {String} [probeLanguage] A language code to try to use,
* instead of the browser based autodetection.
* @returns {String} The detected language code.
* @example
* alert( CKEDITOR.lang.detect( 'en' ) ); // e.g., in a German browser: "de"
*/
detect : function( defaultLanguage, probeLanguage )
{
var languages = this.languages;
probeLanguage = probeLanguage || navigator.userLanguage || navigator.language || defaultLanguage;
var parts = probeLanguage
.toLowerCase()
.match( /([a-z]+)(?:-([a-z]+))?/ ),
lang = parts[1],
locale = parts[2];
if ( languages[ lang + '-' + locale ] )
lang = lang + '-' + locale;
else if ( !languages[ lang ] )
lang = null;
CKEDITOR.lang.detect = lang ?
function() { return lang; } :
function( defaultLanguage ) { return defaultLanguage; };
return lang || defaultLanguage;
}
};
})();
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.dom} object, which contains DOM
* manipulation objects and function.
*/
/**
* @namespace DOM manipulation objects, classes and functions.
* @see CKEDITOR.dom.element
* @see CKEDITOR.dom.node
* @example
*/
CKEDITOR.dom =
{};
// PACKAGER_RENAME( CKEDITOR.dom )
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.lang} object for the
* Dutch language.
*/
/**#@+
@type String
@example
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKEDITOR.lang['nl'] =
{
/**
* The language reading direction. Possible values are "rtl" for
* Right-To-Left languages (like Arabic) and "ltr" for Left-To-Right
* languages (like English).
* @default 'ltr'
*/
dir : 'ltr',
/*
* Screenreader titles. Please note that screenreaders are not always capable
* of reading non-English words. So be careful while translating it.
*/
editorTitle : 'Tekstverwerker, %1, druk op ALT 0 voor hulp.',
// ARIA descriptions.
toolbars : 'Werkbalken',
editor : 'Tekstverwerker',
// Toolbar buttons without dialogs.
source : 'Code',
newPage : 'Nieuwe pagina',
save : 'Opslaan',
preview : 'Voorbeeld',
cut : 'Knippen',
copy : 'Kopiëren',
paste : 'Plakken',
print : 'Printen',
underline : 'Onderstreept',
bold : 'Vet',
italic : 'Schuingedrukt',
selectAll : 'Alles selecteren',
removeFormat : 'Opmaak verwijderen',
strike : 'Doorhalen',
subscript : 'Subscript',
superscript : 'Superscript',
horizontalrule : 'Horizontale lijn invoegen',
pagebreak : 'Pagina-einde invoegen',
pagebreakAlt : 'Pagina-einde',
unlink : 'Link verwijderen',
undo : 'Ongedaan maken',
redo : 'Opnieuw uitvoeren',
// Common messages and labels.
common :
{
browseServer : 'Bladeren op server',
url : 'URL',
protocol : 'Protocol',
upload : 'Upload',
uploadSubmit : 'Naar server verzenden',
image : 'Afbeelding',
flash : 'Flash',
form : 'Formulier',
checkbox : 'Aanvinkvakje',
radio : 'Selectievakje',
textField : 'Tekstveld',
textarea : 'Tekstvak',
hiddenField : 'Verborgen veld',
button : 'Knop',
select : 'Selectieveld',
imageButton : 'Afbeeldingsknop',
notSet : '<niet ingevuld>',
id : 'Kenmerk',
name : 'Naam',
langDir : 'Schrijfrichting',
langDirLtr : 'Links naar rechts (LTR)',
langDirRtl : 'Rechts naar links (RTL)',
langCode : 'Taalcode',
longDescr : 'Lange URL-omschrijving',
cssClass : 'Stylesheet-klassen',
advisoryTitle : 'Aanbevolen titel',
cssStyle : 'Stijl',
ok : 'OK',
cancel : 'Annuleren',
close : 'Sluiten',
preview : 'Voorbeeld',
generalTab : 'Algemeen',
advancedTab : 'Geavanceerd',
validateNumberFailed : 'Deze waarde is geen geldig getal.',
confirmNewPage : 'Alle aangebrachte wijzigingen gaan verloren. Weet u zeker dat u een nieuwe pagina wilt openen?',
confirmCancel : 'Enkele opties zijn gewijzigd. Weet u zeker dat u dit dialoogvenster wilt sluiten?',
options : 'Opties',
target : 'Doel',
targetNew : 'Nieuw venster (_blank)',
targetTop : 'Hele venster (_top)',
targetSelf : 'Zelfde venster (_self)',
targetParent : 'Origineel venster (_parent)',
langDirLTR : 'Links naar rechts (LTR)',
langDirRTL : 'Rechts naar links (RTL)',
styles : 'Stijlen',
cssClasses : 'Stylesheet klassen',
width : 'Breedte',
height : 'Hoogte',
align : 'Uitlijning',
alignLeft : 'Links',
alignRight : 'Rechts',
alignCenter : 'Centreren',
alignTop : 'Boven',
alignMiddle : 'Midden',
alignBottom : 'Beneden',
invalidHeight : 'De hoogte moet een getal zijn.',
invalidWidth : 'De breedte moet een getal zijn.',
invalidCssLength : 'Waarde in veld "%1" moet een positief nummer zijn, met of zonder een geldige CSS meeteenheid (px, %, in, cm, mm, em, ex, pt of pc).',
invalidHtmlLength : 'Waarde in veld "%1" moet een positief nummer zijn, met of zonder een geldige HTML meeteenheid (px of %).',
invalidInlineStyle : 'Waarde voor de online stijl moet bestaan uit een of meerdere tupels met het formaat "naam : waarde", gescheiden door puntkomma\'s.',
cssLengthTooltip : 'Geef een nummer in voor een waarde in pixels of geef een nummer in met een geldige CSS eenheid (px, %, in, cm, mm, em, ex, pt, of pc).',
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, niet beschikbaar</span>'
},
contextmenu :
{
options : 'Context menu opties'
},
// Special char dialog.
specialChar :
{
toolbar : 'Speciaal teken invoegen',
title : 'Selecteer speciaal teken',
options : 'Speciale tekens opties'
},
// Link dialog.
link :
{
toolbar : 'Link invoegen/wijzigen',
other : '<ander>',
menu : 'Link wijzigen',
title : 'Link',
info : 'Linkomschrijving',
target : 'Doel',
upload : 'Upload',
advanced : 'Geavanceerd',
type : 'Linktype',
toUrl : 'URL',
toAnchor : 'Interne link in pagina',
toEmail : 'E-mail',
targetFrame : '<frame>',
targetPopup : '<popup window>',
targetFrameName : 'Naam doelframe',
targetPopupName : 'Naam popupvenster',
popupFeatures : 'Instellingen popupvenster',
popupResizable : 'Herschaalbaar',
popupStatusBar : 'Statusbalk',
popupLocationBar: 'Locatiemenu',
popupToolbar : 'Menubalk',
popupMenuBar : 'Menubalk',
popupFullScreen : 'Volledig scherm (IE)',
popupScrollBars : 'Schuifbalken',
popupDependent : 'Afhankelijk (Netscape)',
popupLeft : 'Positie links',
popupTop : 'Positie boven',
id : 'Id',
langDir : 'Schrijfrichting',
langDirLTR : 'Links naar rechts (LTR)',
langDirRTL : 'Rechts naar links (RTL)',
acccessKey : 'Toegangstoets',
name : 'Naam',
langCode : 'Schrijfrichting',
tabIndex : 'Tabvolgorde',
advisoryTitle : 'Aanbevolen titel',
advisoryContentType : 'Aanbevolen content-type',
cssClasses : 'Stylesheet-klassen',
charset : 'Karakterset van gelinkte bron',
styles : 'Stijl',
rel : 'Relatie',
selectAnchor : 'Kies een interne link',
anchorName : 'Op naam interne link',
anchorId : 'Op kenmerk interne link',
emailAddress : 'E-mailadres',
emailSubject : 'Onderwerp bericht',
emailBody : 'Inhoud bericht',
noAnchors : '(Geen interne links in document gevonden)',
noUrl : 'Geef de link van de URL',
noEmail : 'Geef een e-mailadres'
},
// Anchor dialog
anchor :
{
toolbar : 'Interne link',
menu : 'Eigenschappen interne link',
title : 'Eigenschappen interne link',
name : 'Naam interne link',
errorName : 'Geef de naam van de interne link op',
remove : 'Interne link verwijderen'
},
// List style dialog
list:
{
numberedTitle : 'Eigenschappen genummerde lijst',
bulletedTitle : 'Eigenschappen lijst met opsommingstekens',
type : 'Type',
start : 'Start',
validateStartNumber :'Starnummer van de lijst moet een heel nummer zijn.',
circle : 'Cirkel',
disc : 'Schijf',
square : 'Vierkant',
none : 'Geen',
notset : '<niet gezet>',
armenian : 'Armeense numering',
georgian : 'Greorgische numering (an, ban, gan, etc.)',
lowerRoman : 'Romeins kleine letters (i, ii, iii, iv, v, etc.)',
upperRoman : 'Romeins hoofdletters (I, II, III, IV, V, etc.)',
lowerAlpha : 'Kleine letters (a, b, c, d, e, etc.)',
upperAlpha : 'Hoofdletters (A, B, C, D, E, etc.)',
lowerGreek : 'Grieks kleine letters (alpha, beta, gamma, etc.)',
decimal : 'Cijfers (1, 2, 3, etc.)',
decimalLeadingZero : 'Cijfers beginnen met nul (01, 02, 03, etc.)'
},
// Find And Replace Dialog
findAndReplace :
{
title : 'Zoeken en vervangen',
find : 'Zoeken',
replace : 'Vervangen',
findWhat : 'Zoeken naar:',
replaceWith : 'Vervangen met:',
notFoundMsg : 'De opgegeven tekst is niet gevonden.',
findOptions : 'Zoekopties',
matchCase : 'Hoofdlettergevoelig',
matchWord : 'Hele woord moet voorkomen',
matchCyclic : 'Doorlopend zoeken',
replaceAll : 'Alles vervangen',
replaceSuccessMsg : '%1 resulaten vervangen.'
},
// Table Dialog
table :
{
toolbar : 'Tabel',
title : 'Eigenschappen tabel',
menu : 'Eigenschappen tabel',
deleteTable : 'Tabel verwijderen',
rows : 'Rijen',
columns : 'Kolommen',
border : 'Breedte rand',
widthPx : 'pixels',
widthPc : 'procent',
widthUnit : 'eenheid breedte',
cellSpace : 'Afstand tussen cellen',
cellPad : 'Ruimte in de cel',
caption : 'Naam',
summary : 'Samenvatting',
headers : 'Koppen',
headersNone : 'Geen',
headersColumn : 'Eerste kolom',
headersRow : 'Eerste rij',
headersBoth : 'Beide',
invalidRows : 'Het aantal rijen moet een getal zijn groter dan 0.',
invalidCols : 'Het aantal kolommen moet een getal zijn groter dan 0.',
invalidBorder : 'De rand breedte moet een getal zijn.',
invalidWidth : 'De tabel breedte moet een getal zijn.',
invalidHeight : 'De tabel hoogte moet een getal zijn.',
invalidCellSpacing : 'Afstand tussen cellen moet een getal zijn.',
invalidCellPadding : 'Ruimte in de cel moet een getal zijn.',
cell :
{
menu : 'Cel',
insertBefore : 'Voeg cel in voor',
insertAfter : 'Voeg cel in achter',
deleteCell : 'Cellen verwijderen',
merge : 'Cellen samenvoegen',
mergeRight : 'Voeg samen naar rechts',
mergeDown : 'Voeg samen naar beneden',
splitHorizontal : 'Splits cellen horizontaal',
splitVertical : 'Splits cellen verticaal',
title : 'Cel eigenschappen',
cellType : 'Cel type',
rowSpan : 'Rijen samenvoegen',
colSpan : 'Kolommen samenvoegen',
wordWrap : 'Automatische terugloop',
hAlign : 'Horizontale uitlijning',
vAlign : 'Verticale uitlijning',
alignBaseline : 'Basislijn',
bgColor : 'Achtergrondkleur',
borderColor : 'Kleur rand',
data : 'Inhoud',
header : 'Kop',
yes : 'Ja',
no : 'Nee',
invalidWidth : 'De celbreedte moet een getal zijn.',
invalidHeight : 'De celhoogte moet een getal zijn.',
invalidRowSpan : 'Rijen samenvoegen moet een heel getal zijn.',
invalidColSpan : 'Kolommen samenvoegen moet een heel getal zijn.',
chooseColor : 'Kies'
},
row :
{
menu : 'Rij',
insertBefore : 'Voeg rij in voor',
insertAfter : 'Voeg rij in achter',
deleteRow : 'Rijen verwijderen'
},
column :
{
menu : 'Kolom',
insertBefore : 'Voeg kolom in voor',
insertAfter : 'Voeg kolom in achter',
deleteColumn : 'Kolommen verwijderen'
}
},
// Button Dialog.
button :
{
title : 'Eigenschappen knop',
text : 'Tekst (waarde)',
type : 'Soort',
typeBtn : 'Knop',
typeSbm : 'Versturen',
typeRst : 'Leegmaken'
},
// Checkbox and Radio Button Dialogs.
checkboxAndRadio :
{
checkboxTitle : 'Eigenschappen aanvinkvakje',
radioTitle : 'Eigenschappen selectievakje',
value : 'Waarde',
selected : 'Geselecteerd'
},
// Form Dialog.
form :
{
title : 'Eigenschappen formulier',
menu : 'Eigenschappen formulier',
action : 'Actie',
method : 'Methode',
encoding : 'Codering'
},
// Select Field Dialog.
select :
{
title : 'Eigenschappen selectieveld',
selectInfo : 'Informatie',
opAvail : 'Beschikbare opties',
value : 'Waarde',
size : 'Grootte',
lines : 'Regels',
chkMulti : 'Gecombineerde selecties toestaan',
opText : 'Tekst',
opValue : 'Waarde',
btnAdd : 'Toevoegen',
btnModify : 'Wijzigen',
btnUp : 'Omhoog',
btnDown : 'Omlaag',
btnSetValue : 'Als geselecteerde waarde instellen',
btnDelete : 'Verwijderen'
},
// Textarea Dialog.
textarea :
{
title : 'Eigenschappen tekstvak',
cols : 'Kolommen',
rows : 'Rijen'
},
// Text Field Dialog.
textfield :
{
title : 'Eigenschappen tekstveld',
name : 'Naam',
value : 'Waarde',
charWidth : 'Breedte (tekens)',
maxChars : 'Maximum aantal tekens',
type : 'Soort',
typeText : 'Tekst',
typePass : 'Wachtwoord'
},
// Hidden Field Dialog.
hidden :
{
title : 'Eigenschappen verborgen veld',
name : 'Naam',
value : 'Waarde'
},
// Image Dialog.
image :
{
title : 'Eigenschappen afbeelding',
titleButton : 'Eigenschappen afbeeldingsknop',
menu : 'Eigenschappen afbeelding',
infoTab : 'Informatie afbeelding',
btnUpload : 'Naar server verzenden',
upload : 'Upload',
alt : 'Alternatieve tekst',
lockRatio : 'Afmetingen vergrendelen',
resetSize : 'Afmetingen resetten',
border : 'Rand',
hSpace : 'HSpace',
vSpace : 'VSpace',
alertUrl : 'Geef de URL van de afbeelding',
linkTab : 'Link',
button2Img : 'Wilt u de geselecteerde afbeeldingsknop vervangen door een eenvoudige afbeelding?',
img2Button : 'Wilt u de geselecteerde afbeelding vervangen door een afbeeldingsknop?',
urlMissing : 'De URL naar de afbeelding ontbreekt.',
validateBorder : 'Rand moet een heel nummer zijn.',
validateHSpace : 'HSpace moet een heel nummer zijn.',
validateVSpace : 'VSpace moet een heel nummer zijn.'
},
// Flash Dialog
flash :
{
properties : 'Eigenschappen Flash',
propertiesTab : 'Eigenschappen',
title : 'Eigenschappen Flash',
chkPlay : 'Automatisch afspelen',
chkLoop : 'Herhalen',
chkMenu : 'Flashmenu\'s inschakelen',
chkFull : 'Schermvullend toestaan',
scale : 'Schaal',
scaleAll : 'Alles tonen',
scaleNoBorder : 'Geen rand',
scaleFit : 'Precies passend',
access : 'Script toegang',
accessAlways : 'Altijd',
accessSameDomain: 'Zelfde domeinnaam',
accessNever : 'Nooit',
alignAbsBottom : 'Absoluut-onder',
alignAbsMiddle : 'Absoluut-midden',
alignBaseline : 'Basislijn',
alignTextTop : 'Boven tekst',
quality : 'Kwaliteit',
qualityBest : 'Beste',
qualityHigh : 'Hoog',
qualityAutoHigh : 'Automatisch hoog',
qualityMedium : 'Gemiddeld',
qualityAutoLow : 'Automatisch laag',
qualityLow : 'Laag',
windowModeWindow: 'Venster',
windowModeOpaque: 'Ondoorzichtig',
windowModeTransparent : 'Doorzichtig',
windowMode : 'Venster modus',
flashvars : 'Variabelen voor Flash',
bgcolor : 'Achtergrondkleur',
hSpace : 'HSpace',
vSpace : 'VSpace',
validateSrc : 'Geef de link van de URL',
validateHSpace : 'De HSpace moet een getal zijn.',
validateVSpace : 'De VSpace moet een getal zijn.'
},
// Speller Pages Dialog
spellCheck :
{
toolbar : 'Spellingscontrole',
title : 'Spellingscontrole',
notAvailable : 'Excuses, deze dienst is momenteel niet beschikbaar.',
errorLoading : 'Er is een fout opgetreden bij het laden van de diesnt: %s.',
notInDic : 'Niet in het woordenboek',
changeTo : 'Wijzig in',
btnIgnore : 'Negeren',
btnIgnoreAll : 'Alles negeren',
btnReplace : 'Vervangen',
btnReplaceAll : 'Alles vervangen',
btnUndo : 'Ongedaan maken',
noSuggestions : '-Geen suggesties-',
progress : 'Bezig met spellingscontrole...',
noMispell : 'Klaar met spellingscontrole: geen fouten gevonden',
noChanges : 'Klaar met spellingscontrole: geen woorden aangepast',
oneChange : 'Klaar met spellingscontrole: één woord aangepast',
manyChanges : 'Klaar met spellingscontrole: %1 woorden aangepast',
ieSpellDownload : 'De spellingscontrole niet geïnstalleerd. Wilt u deze nu downloaden?'
},
smiley :
{
toolbar : 'Smiley',
title : 'Smiley invoegen',
options : 'Smiley opties'
},
elementsPath :
{
eleLabel : 'Elementenpad',
eleTitle : '%1 element'
},
numberedlist : 'Genummerde lijst',
bulletedlist : 'Opsomming',
indent : 'Inspringen vergroten',
outdent : 'Inspringen verkleinen',
justify :
{
left : 'Links uitlijnen',
center : 'Centreren',
right : 'Rechts uitlijnen',
block : 'Uitvullen'
},
blockquote : 'Citaatblok',
clipboard :
{
title : 'Plakken',
cutError : 'De beveiligingsinstelling van de browser verhinderen het automatisch knippen. Gebruik de sneltoets Ctrl/Cmd+X van het toetsenbord.',
copyError : 'De beveiligingsinstelling van de browser verhinderen het automatisch kopiëren. Gebruik de sneltoets Ctrl/Cmd+C van het toetsenbord.',
pasteMsg : 'Plak de tekst in het volgende vak gebruik makend van uw toetsenbord (<strong>Ctrl/Cmd+V</strong>) en klik op <strong>OK</strong>.',
securityMsg : 'Door de beveiligingsinstellingen van uw browser is het niet mogelijk om direct vanuit het klembord in de editor te plakken. Middels opnieuw plakken in dit venster kunt u de tekst alsnog plakken in de editor.',
pasteArea : 'Plakgebied'
},
pastefromword :
{
confirmCleanup : 'De tekst die u plakte lijkt gekopieerd te zijn vanuit Word. Wilt u de tekst opschonen voordat deze geplakt wordt?',
toolbar : 'Plakken als Word-gegevens',
title : 'Plakken als Word-gegevens',
error : 'Het was niet mogelijk om de geplakte tekst op te schonen door een interne fout'
},
pasteText :
{
button : 'Plakken als platte tekst',
title : 'Plakken als platte tekst'
},
templates :
{
button : 'Sjablonen',
title : 'Inhoud sjabonen',
options : 'Template opties',
insertOption : 'Vervang de huidige inhoud',
selectPromptMsg : 'Selecteer het sjabloon dat in de editor geopend moet worden (de actuele inhoud gaat verloren):',
emptyListMsg : '(Geen sjablonen gedefinieerd)'
},
showBlocks : 'Toon blokken',
stylesCombo :
{
label : 'Stijl',
panelTitle : 'Opmaakstijlen',
panelTitle1 : 'Blok stijlen',
panelTitle2 : 'In-line stijlen',
panelTitle3 : 'Object stijlen'
},
format :
{
label : 'Opmaak',
panelTitle : 'Opmaak',
tag_p : 'Normaal',
tag_pre : 'Met opmaak',
tag_address : 'Adres',
tag_h1 : 'Kop 1',
tag_h2 : 'Kop 2',
tag_h3 : 'Kop 3',
tag_h4 : 'Kop 4',
tag_h5 : 'Kop 5',
tag_h6 : 'Kop 6',
tag_div : 'Normaal (DIV)'
},
div :
{
title : 'Div aanmaken',
toolbar : 'Div aanmaken',
cssClassInputLabel : 'Stylesheet klassen',
styleSelectLabel : 'Stijl',
IdInputLabel : 'Id',
languageCodeInputLabel : ' Taalcode',
inlineStyleInputLabel : 'Inline stijl',
advisoryTitleInputLabel : 'informatieve titel',
langDirLabel : 'Schrijfrichting',
langDirLTRLabel : 'Links naar rechts (LTR)',
langDirRTLLabel : 'Rechts naar links (RTL)',
edit : 'Div wijzigen',
remove : 'Div verwijderen'
},
iframe :
{
title : 'IFrame eigenschappen',
toolbar : 'IFrame',
noUrl : 'Geef de IFrame URL in',
scrolling : 'Scrollbalken inschakelen',
border : 'Framerand tonen'
},
font :
{
label : 'Lettertype',
voiceLabel : 'Lettertype',
panelTitle : 'Lettertype'
},
fontSize :
{
label : 'Lettergrootte',
voiceLabel : 'Lettergrootte',
panelTitle : 'Lettergrootte'
},
colorButton :
{
textColorTitle : 'Tekstkleur',
bgColorTitle : 'Achtergrondkleur',
panelTitle : 'Kleuren',
auto : 'Automatisch',
more : 'Meer kleuren...'
},
colors :
{
'000' : 'Zwart',
'800000' : 'Kastanjebruin',
'8B4513' : 'Chocoladebruin',
'2F4F4F' : 'Donkerleigrijs',
'008080' : 'Blauwgroen',
'000080' : 'Marine',
'4B0082' : 'Indigo',
'696969' : 'Donkergrijs',
'B22222' : 'Baksteen',
'A52A2A' : 'Bruin',
'DAA520' : 'Donkergeel',
'006400' : 'Donkergroen',
'40E0D0' : 'Turquoise',
'0000CD' : 'Middenblauw',
'800080' : 'Paars',
'808080' : 'Grijs',
'F00' : 'Rood',
'FF8C00' : 'Donkeroranje',
'FFD700' : 'Goud',
'008000' : 'Groen',
'0FF' : 'Cyaan',
'00F' : 'Blauw',
'EE82EE' : 'Violet',
'A9A9A9' : 'Donkergrijs',
'FFA07A' : 'Lichtzalm',
'FFA500' : 'Oranje',
'FFFF00' : 'Geel',
'00FF00' : 'Felgroen',
'AFEEEE' : 'Lichtturquoise',
'ADD8E6' : 'Lichtblauw',
'DDA0DD' : 'Pruim',
'D3D3D3' : 'Lichtgrijs',
'FFF0F5' : 'Linnen',
'FAEBD7' : 'Ivoor',
'FFFFE0' : 'Lichtgeel',
'F0FFF0' : 'Honingdauw',
'F0FFFF' : 'Azuur',
'F0F8FF' : 'Licht hemelsblauw',
'E6E6FA' : 'Lavendel',
'FFF' : 'Wit'
},
scayt :
{
title : 'Controleer de spelling tijdens het typen',
opera_title : 'Niet ondersteund door Opera',
enable : 'SCAYT inschakelen',
disable : 'SCAYT uitschakelen',
about : 'Over SCAYT',
toggle : 'SCAYT in/uitschakelen',
options : 'Opties',
langs : 'Talen',
moreSuggestions : 'Meer suggesties',
ignore : 'Negeren',
ignoreAll : 'Alles negeren',
addWord : 'Woord toevoegen',
emptyDic : 'De naam van het woordenboek mag niet leeg zijn.',
optionsTab : 'Opties',
allCaps : 'Negeer woorden helemaal in hoofdletters',
ignoreDomainNames : 'Negeer domeinnamen',
mixedCase : 'Negeer woorden met hoofd- en kleine letters',
mixedWithDigits : 'Negeer woorden met cijfers',
languagesTab : 'Talen',
dictionariesTab : 'Woordenboeken',
dic_field_name : 'Naam woordenboek',
dic_create : 'Aanmaken',
dic_restore : 'Terugzetten',
dic_delete : 'Verwijderen',
dic_rename : 'Hernoemen',
dic_info : 'Initieel wordt het gebruikerswoordenboek opgeslagen in een cookie. Cookies zijn echter beperkt in grootte. Zodra het gebruikerswoordenboek het punt bereikt waarop het niet meer in een cookie opgeslagen kan worden, dan wordt het woordenboek op de server opgeslagen. Om je persoonlijke woordenboek op je eigen server op te slaan, moet je een mapnaam opgeven. Indien je al een woordenboek hebt opgeslagen, typ dan de naam en klik op de Terugzetten knop.',
aboutTab : 'Over'
},
about :
{
title : 'Over CKEditor',
dlgTitle : 'Over CKEditor',
help : 'Bekijk $1 voor hulp.',
userGuide : 'CKEditor gebruiksaanwijzing',
moreInfo : 'Voor licentie informatie, bezoek onze website:',
copy : 'Copyright © $1. Alle rechten voorbehouden.'
},
maximize : 'Maximaliseren',
minimize : 'Minimaliseren',
fakeobjects :
{
anchor : 'Anker',
flash : 'Flash animatie',
iframe : 'IFrame',
hiddenfield : 'Verborgen veld',
unknown : 'Onbekend object'
},
resize : 'Sleep om te herschalen',
colordialog :
{
title : 'Selecteer kleur',
options : 'Kleuropties',
highlight : 'Actief',
selected : 'Geselecteerd',
clear : 'Wissen'
},
toolbarCollapse : 'Werkbalk inklappen',
toolbarExpand : 'Werkbalk uitklappen',
toolbarGroups :
{
document : 'Document',
clipboard : 'Klembord/Ongedaan maken',
editing : 'Bewerken',
forms : 'Formulieren',
basicstyles : 'Basisstijlen',
paragraph : 'Paragraaf',
links : 'Links',
insert : 'Invoegen',
styles : 'Stijlen',
colors : 'Kleuren',
tools : 'Toepassingen'
},
bidi :
{
ltr : 'Schrijfrichting van links naar rechts',
rtl : 'Schrijfrichting van rechts naar links'
},
docprops :
{
label : 'Documenteigenschappen',
title : 'Documenteigenschappen',
design : 'Ontwerp',
meta : 'Meta tags',
chooseColor : 'Kiezen',
other : 'Anders...',
docTitle : 'Paginatitel',
charset : 'Tekencodering',
charsetOther : 'Andere tekencodering',
charsetASCII : 'ASCII',
charsetCE : 'Centraal Europees',
charsetCT : 'Tranditioneel Chinees (Big5)',
charsetCR : 'Cyrillisch',
charsetGR : 'Grieks',
charsetJP : 'Japans',
charsetKR : 'Koreaans',
charsetTR : 'Turks',
charsetUN : 'Unicode (UTF-8)',
charsetWE : 'West Europees',
docType : 'Documenttype-definitie',
docTypeOther : 'Andere documenttype-definitie',
xhtmlDec : 'XHTML declaratie invoegen',
bgColor : 'Achtergrondkleur',
bgImage : 'Achtergrondafbeelding URL',
bgFixed : 'Niet-scrollend (gefixeerde) achtergrond',
txtColor : 'Tekstkleur',
margin : 'Pagina marges',
marginTop : 'Boven',
marginLeft : 'Links',
marginRight : 'Rechts',
marginBottom : 'Onder',
metaKeywords : 'Trefwoorden voor indexering (komma-gescheiden)',
metaDescription : 'Documentbeschrijving',
metaAuthor : 'Auteur',
metaCopyright : 'Auteursrechten',
previewHtml : '<p>Dit is <strong>voorbeeld tekst</strong>. Je gebruikt <a href="javascript:void(0)">CKEditor</a>.</p>'
}
};
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.lang} object, for the
* Italian language.
*/
/**#@+
@type String
@example
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKEDITOR.lang['it'] =
{
/**
* The language reading direction. Possible values are "rtl" for
* Right-To-Left languages (like Arabic) and "ltr" for Left-To-Right
* languages (like English).
* @default 'ltr'
*/
dir : 'ltr',
/*
* Screenreader titles. Please note that screenreaders are not always capable
* of reading non-English words. So be careful while translating it.
*/
editorTitle : 'Rich text editor, %1, premere ALT 0 per l\'help in linea.',
// ARIA descriptions.
toolbars : 'Editor toolbar',
editor : 'Rich Text Editor',
// Toolbar buttons without dialogs.
source : 'Codice Sorgente',
newPage : 'Nuova pagina vuota',
save : 'Salva',
preview : 'Anteprima',
cut : 'Taglia',
copy : 'Copia',
paste : 'Incolla',
print : 'Stampa',
underline : 'Sottolineato',
bold : 'Grassetto',
italic : 'Corsivo',
selectAll : 'Seleziona tutto',
removeFormat : 'Elimina formattazione',
strike : 'Barrato',
subscript : 'Pedice',
superscript : 'Apice',
horizontalrule : 'Inserisci riga orizzontale',
pagebreak : 'Inserisci interruzione di pagina',
pagebreakAlt : 'Interruzione di pagina',
unlink : 'Elimina collegamento',
undo : 'Annulla',
redo : 'Ripristina',
// Common messages and labels.
common :
{
browseServer : 'Cerca sul server',
url : 'URL',
protocol : 'Protocollo',
upload : 'Carica',
uploadSubmit : 'Invia al server',
image : 'Immagine',
flash : 'Oggetto Flash',
form : 'Modulo',
checkbox : 'Checkbox',
radio : 'Radio Button',
textField : 'Campo di testo',
textarea : 'Area di testo',
hiddenField : 'Campo nascosto',
button : 'Bottone',
select : 'Menu di selezione',
imageButton : 'Bottone immagine',
notSet : '<non impostato>',
id : 'Id',
name : 'Nome',
langDir : 'Direzione scrittura',
langDirLtr : 'Da Sinistra a Destra (LTR)',
langDirRtl : 'Da Destra a Sinistra (RTL)',
langCode : 'Codice Lingua',
longDescr : 'URL descrizione estesa',
cssClass : 'Nome classe CSS',
advisoryTitle : 'Titolo',
cssStyle : 'Stile',
ok : 'OK',
cancel : 'Annulla',
close : 'Chiudi',
preview : 'Anteprima',
generalTab : 'Generale',
advancedTab : 'Avanzate',
validateNumberFailed : 'Il valore inserito non è un numero.',
confirmNewPage : 'Ogni modifica non salvata sarà persa. Sei sicuro di voler caricare una nuova pagina?',
confirmCancel : 'Alcune delle opzioni sono state cambiate. Sei sicuro di voler chiudere la finestra di dialogo?',
options : 'Opzioni',
target : 'Destinazione',
targetNew : 'Nuova finestra (_blank)',
targetTop : 'Finestra in primo piano (_top)',
targetSelf : 'Stessa finestra (_self)',
targetParent : 'Finestra Padre (_parent)',
langDirLTR : 'Da sinistra a destra (LTR)',
langDirRTL : 'Da destra a sinistra (RTL)',
styles : 'Stile',
cssClasses : 'Classi di stile',
width : 'Larghezza',
height : 'Altezza',
align : 'Allineamento',
alignLeft : 'Sinistra',
alignRight : 'Destra',
alignCenter : 'Centrato',
alignTop : 'In Alto',
alignMiddle : 'Centrato',
alignBottom : 'In Basso',
invalidHeight : 'L\'altezza dev\'essere un numero',
invalidWidth : 'La Larghezza dev\'essere un numero',
invalidCssLength : 'Il valore indicato per il campo "%1" deve essere un numero positivo con o senza indicazione di una valida unità di misura per le classi CSS (px, %, in, cm, mm, em, ex, pt, o pc).',
invalidHtmlLength : 'Il valore indicato per il campo "%1" deve essere un numero positivo con o senza indicazione di una valida unità di misura per le pagine HTML (px o %).',
invalidInlineStyle : 'Value specified for the inline style must consist of one or more tuples with the format of "name : value", separated by semi-colons.', // MISSING
cssLengthTooltip : 'Enter a number for a value in pixels or a number with a valid CSS unit (px, %, in, cm, mm, em, ex, pt, or pc).', // MISSING
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, non disponibile</span>'
},
contextmenu :
{
options : 'Opzioni del menù contestuale'
},
// Special char dialog.
specialChar :
{
toolbar : 'Inserisci carattere speciale',
title : 'Seleziona carattere speciale',
options : 'Opzioni carattere speciale'
},
// Link dialog.
link :
{
toolbar : 'Inserisci/Modifica collegamento',
other : '<altro>',
menu : 'Modifica collegamento',
title : 'Collegamento',
info : 'Informazioni collegamento',
target : 'Destinazione',
upload : 'Carica',
advanced : 'Avanzate',
type : 'Tipo di Collegamento',
toUrl : 'URL',
toAnchor : 'Ancora nella pagina',
toEmail : 'E-Mail',
targetFrame : '<riquadro>',
targetPopup : '<finestra popup>',
targetFrameName : 'Nome del riquadro di destinazione',
targetPopupName : 'Nome finestra popup',
popupFeatures : 'Caratteristiche finestra popup',
popupResizable : 'Ridimensionabile',
popupStatusBar : 'Barra di stato',
popupLocationBar: 'Barra degli indirizzi',
popupToolbar : 'Barra degli strumenti',
popupMenuBar : 'Barra del menu',
popupFullScreen : 'A tutto schermo (IE)',
popupScrollBars : 'Barre di scorrimento',
popupDependent : 'Dipendente (Netscape)',
popupLeft : 'Posizione da sinistra',
popupTop : 'Posizione dall\'alto',
id : 'Id',
langDir : 'Direzione scrittura',
langDirLTR : 'Da Sinistra a Destra (LTR)',
langDirRTL : 'Da Destra a Sinistra (RTL)',
acccessKey : 'Scorciatoia<br />da tastiera',
name : 'Nome',
langCode : 'Direzione scrittura',
tabIndex : 'Ordine di tabulazione',
advisoryTitle : 'Titolo',
advisoryContentType : 'Tipo della risorsa collegata',
cssClasses : 'Nome classe CSS',
charset : 'Set di caretteri della risorsa collegata',
styles : 'Stile',
rel : 'Relazioni',
selectAnchor : 'Scegli Ancora',
anchorName : 'Per Nome',
anchorId : 'Per id elemento',
emailAddress : 'Indirizzo E-Mail',
emailSubject : 'Oggetto del messaggio',
emailBody : 'Corpo del messaggio',
noAnchors : '(Nessuna ancora disponibile nel documento)',
noUrl : 'Devi inserire l\'URL del collegamento',
noEmail : 'Devi inserire un\'indirizzo e-mail'
},
// Anchor dialog
anchor :
{
toolbar : 'Inserisci/Modifica Ancora',
menu : 'Proprietà ancora',
title : 'Proprietà ancora',
name : 'Nome ancora',
errorName : 'Inserici il nome dell\'ancora',
remove : 'Rimuovi l\'ancora'
},
// List style dialog
list:
{
numberedTitle : 'Proprietà liste numerate',
bulletedTitle : 'Proprietà liste puntate',
type : 'Tipo',
start : 'Inizio',
validateStartNumber :'Il numero di inizio di una lista numerata deve essere un numero intero.',
circle : 'Cerchio',
disc : 'Disco',
square : 'Quadrato',
none : 'Nessuno',
notset : '<non impostato>',
armenian : 'Numerazione Armena',
georgian : 'Numerazione Georgiana (an, ban, gan, ecc.)',
lowerRoman : 'Numerazione Romana minuscola (i, ii, iii, iv, v, ecc.)',
upperRoman : 'Numerazione Romana maiuscola (I, II, III, IV, V, ecc.)',
lowerAlpha : 'Alfabetico minuscolo (a, b, c, d, e, ecc.)',
upperAlpha : 'Alfabetico maiuscolo (A, B, C, D, E, ecc.)',
lowerGreek : 'Greco minuscolo (alpha, beta, gamma, ecc.)',
decimal : 'Decimale (1, 2, 3, ecc.)',
decimalLeadingZero : 'Decimale preceduto da 0 (01, 02, 03, ecc.)'
},
// Find And Replace Dialog
findAndReplace :
{
title : 'Cerca e Sostituisci',
find : 'Trova',
replace : 'Sostituisci',
findWhat : 'Trova:',
replaceWith : 'Sostituisci con:',
notFoundMsg : 'L\'elemento cercato non è stato trovato.',
findOptions : 'Find Options', // MISSING
matchCase : 'Maiuscole/minuscole',
matchWord : 'Solo parole intere',
matchCyclic : 'Ricerca ciclica',
replaceAll : 'Sostituisci tutto',
replaceSuccessMsg : '%1 occorrenza(e) sostituite.'
},
// Table Dialog
table :
{
toolbar : 'Tabella',
title : 'Proprietà tabella',
menu : 'Proprietà tabella',
deleteTable : 'Cancella Tabella',
rows : 'Righe',
columns : 'Colonne',
border : 'Dimensione bordo',
widthPx : 'pixel',
widthPc : 'percento',
widthUnit : 'unità larghezza',
cellSpace : 'Spaziatura celle',
cellPad : 'Padding celle',
caption : 'Intestazione',
summary : 'Indice',
headers : 'Intestazione',
headersNone : 'Nessuna',
headersColumn : 'Prima Colonna',
headersRow : 'Prima Riga',
headersBoth : 'Entrambe',
invalidRows : 'Il numero di righe dev\'essere un numero maggiore di 0.',
invalidCols : 'Il numero di colonne dev\'essere un numero maggiore di 0.',
invalidBorder : 'La dimensione del bordo dev\'essere un numero.',
invalidWidth : 'La larghezza della tabella dev\'essere un numero.',
invalidHeight : 'L\'altezza della tabella dev\'essere un numero.',
invalidCellSpacing : 'La spaziatura tra le celle dev\'essere un numero.',
invalidCellPadding : 'Il paging delle celle dev\'essere un numero',
cell :
{
menu : 'Cella',
insertBefore : 'Inserisci Cella Prima',
insertAfter : 'Inserisci Cella Dopo',
deleteCell : 'Elimina celle',
merge : 'Unisce celle',
mergeRight : 'Unisci a Destra',
mergeDown : 'Unisci in Basso',
splitHorizontal : 'Dividi Cella Orizzontalmente',
splitVertical : 'Dividi Cella Verticalmente',
title : 'Proprietà della cella',
cellType : 'Tipo di cella',
rowSpan : 'Su più righe',
colSpan : 'Su più colonne',
wordWrap : 'Ritorno a capo',
hAlign : 'Allineamento orizzontale',
vAlign : 'Allineamento verticale',
alignBaseline : 'Linea Base',
bgColor : 'Colore di Sfondo',
borderColor : 'Colore del Bordo',
data : 'Dati',
header : 'Intestazione',
yes : 'Si',
no : 'No',
invalidWidth : 'La larghezza della cella dev\'essere un numero.',
invalidHeight : 'L\'altezza della cella dev\'essere un numero.',
invalidRowSpan : 'Il numero di righe dev\'essere un numero intero.',
invalidColSpan : 'Il numero di colonne dev\'essere un numero intero.',
chooseColor : 'Scegli'
},
row :
{
menu : 'Riga',
insertBefore : 'Inserisci Riga Prima',
insertAfter : 'Inserisci Riga Dopo',
deleteRow : 'Elimina righe'
},
column :
{
menu : 'Colonna',
insertBefore : 'Inserisci Colonna Prima',
insertAfter : 'Inserisci Colonna Dopo',
deleteColumn : 'Elimina colonne'
}
},
// Button Dialog.
button :
{
title : 'Proprietà bottone',
text : 'Testo (Valore)',
type : 'Tipo',
typeBtn : 'Bottone',
typeSbm : 'Invio',
typeRst : 'Annulla'
},
// Checkbox and Radio Button Dialogs.
checkboxAndRadio :
{
checkboxTitle : 'Proprietà checkbox',
radioTitle : 'Proprietà radio button',
value : 'Valore',
selected : 'Selezionato'
},
// Form Dialog.
form :
{
title : 'Proprietà modulo',
menu : 'Proprietà modulo',
action : 'Azione',
method : 'Metodo',
encoding : 'Codifica'
},
// Select Field Dialog.
select :
{
title : 'Proprietà menu di selezione',
selectInfo : 'Info',
opAvail : 'Opzioni disponibili',
value : 'Valore',
size : 'Dimensione',
lines : 'righe',
chkMulti : 'Permetti selezione multipla',
opText : 'Testo',
opValue : 'Valore',
btnAdd : 'Aggiungi',
btnModify : 'Modifica',
btnUp : 'Su',
btnDown : 'Gi',
btnSetValue : 'Imposta come predefinito',
btnDelete : 'Rimuovi'
},
// Textarea Dialog.
textarea :
{
title : 'Proprietà area di testo',
cols : 'Colonne',
rows : 'Righe'
},
// Text Field Dialog.
textfield :
{
title : 'Proprietà campo di testo',
name : 'Nome',
value : 'Valore',
charWidth : 'Larghezza',
maxChars : 'Numero massimo di caratteri',
type : 'Tipo',
typeText : 'Testo',
typePass : 'Password'
},
// Hidden Field Dialog.
hidden :
{
title : 'Proprietà campo nascosto',
name : 'Nome',
value : 'Valore'
},
// Image Dialog.
image :
{
title : 'Proprietà immagine',
titleButton : 'Proprietà bottone immagine',
menu : 'Proprietà immagine',
infoTab : 'Informazioni immagine',
btnUpload : 'Invia al server',
upload : 'Carica',
alt : 'Testo alternativo',
lockRatio : 'Blocca rapporto',
resetSize : 'Reimposta dimensione',
border : 'Bordo',
hSpace : 'HSpace',
vSpace : 'VSpace',
alertUrl : 'Devi inserire l\'URL per l\'immagine',
linkTab : 'Collegamento',
button2Img : 'Vuoi trasformare il bottone immagine selezionato in un\'immagine semplice?',
img2Button : 'Vuoi trasferomare l\'immagine selezionata in un bottone immagine?',
urlMissing : 'Manca l\'URL dell\'immagine.',
validateBorder : 'Il campo Bordo deve essere un numero intero.',
validateHSpace : 'Il campo HSpace deve essere un numero intero.',
validateVSpace : 'Il campo VSpace deve essere un numero intero.'
},
// Flash Dialog
flash :
{
properties : 'Proprietà Oggetto Flash',
propertiesTab : 'Proprietà',
title : 'Proprietà Oggetto Flash',
chkPlay : 'Avvio Automatico',
chkLoop : 'Riavvio automatico',
chkMenu : 'Abilita Menu di Flash',
chkFull : 'Permetti la modalità tutto schermo',
scale : 'Ridimensiona',
scaleAll : 'Mostra Tutto',
scaleNoBorder : 'Senza Bordo',
scaleFit : 'Dimensione Esatta',
access : 'Accesso Script',
accessAlways : 'Sempre',
accessSameDomain: 'Solo stesso dominio',
accessNever : 'Mai',
alignAbsBottom : 'In basso assoluto',
alignAbsMiddle : 'Centrato assoluto',
alignBaseline : 'Linea base',
alignTextTop : 'In alto al testo',
quality : 'Qualità',
qualityBest : 'Massima',
qualityHigh : 'Alta',
qualityAutoHigh : 'Alta Automatica',
qualityMedium : 'Intermedia',
qualityAutoLow : 'Bassa Automatica',
qualityLow : 'Bassa',
windowModeWindow: 'Finestra',
windowModeOpaque: 'Opaca',
windowModeTransparent : 'Trasparente',
windowMode : 'Modalità finestra',
flashvars : 'Variabili per Flash',
bgcolor : 'Colore sfondo',
hSpace : 'HSpace',
vSpace : 'VSpace',
validateSrc : 'Devi inserire l\'URL del collegamento',
validateHSpace : 'L\'HSpace dev\'essere un numero.',
validateVSpace : 'Il VSpace dev\'essere un numero.'
},
// Speller Pages Dialog
spellCheck :
{
toolbar : 'Correttore ortografico',
title : 'Controllo ortografico',
notAvailable : 'Il servizio non è momentaneamente disponibile.',
errorLoading : 'Errore nel caricamento dell\'host col servizio applicativo: %s.',
notInDic : 'Non nel dizionario',
changeTo : 'Cambia in',
btnIgnore : 'Ignora',
btnIgnoreAll : 'Ignora tutto',
btnReplace : 'Cambia',
btnReplaceAll : 'Cambia tutto',
btnUndo : 'Annulla',
noSuggestions : '- Nessun suggerimento -',
progress : 'Controllo ortografico in corso',
noMispell : 'Controllo ortografico completato: nessun errore trovato',
noChanges : 'Controllo ortografico completato: nessuna parola cambiata',
oneChange : 'Controllo ortografico completato: 1 parola cambiata',
manyChanges : 'Controllo ortografico completato: %1 parole cambiate',
ieSpellDownload : 'Contollo ortografico non installato. Lo vuoi scaricare ora?'
},
smiley :
{
toolbar : 'Emoticon',
title : 'Inserisci emoticon',
options : 'Opzioni Smiley'
},
elementsPath :
{
eleLabel : 'Percorso degli elementi',
eleTitle : '%1 elemento'
},
numberedlist : 'Elenco numerato',
bulletedlist : 'Elenco puntato',
indent : 'Aumenta rientro',
outdent : 'Riduci rientro',
justify :
{
left : 'Allinea a sinistra',
center : 'Centra',
right : 'Allinea a destra',
block : 'Giustifica'
},
blockquote : 'Citazione',
clipboard :
{
title : 'Incolla',
cutError : 'Le impostazioni di sicurezza del browser non permettono di tagliare automaticamente il testo. Usa la tastiera (Ctrl/Cmd+X).',
copyError : 'Le impostazioni di sicurezza del browser non permettono di copiare automaticamente il testo. Usa la tastiera (Ctrl/Cmd+C).',
pasteMsg : 'Incolla il testo all\'interno dell\'area sottostante usando la scorciatoia di tastiere (<STRONG>Ctrl/Cmd+V</STRONG>) e premi <STRONG>OK</STRONG>.',
securityMsg : 'A causa delle impostazioni di sicurezza del browser,l\'editor non è in grado di accedere direttamente agli appunti. E\' pertanto necessario incollarli di nuovo in questa finestra.',
pasteArea : 'Incolla'
},
pastefromword :
{
confirmCleanup : 'Il testo da incollare sembra provenire da Word. Desideri pulirlo prima di incollare?',
toolbar : 'Incolla da Word',
title : 'Incolla da Word',
error : 'Non è stato possibile eliminarre il testo incollato a causa di un errore interno.'
},
pasteText :
{
button : 'Incolla come testo semplice',
title : 'Incolla come testo semplice'
},
templates :
{
button : 'Modelli',
title : 'Contenuto dei modelli',
options : 'Opzioni del Modello',
insertOption : 'Cancella il contenuto corrente',
selectPromptMsg : 'Seleziona il modello da aprire nell\'editor<br />(il contenuto attuale verrà eliminato):',
emptyListMsg : '(Nessun modello definito)'
},
showBlocks : 'Visualizza Blocchi',
stylesCombo :
{
label : 'Stile',
panelTitle : 'Stili di formattazione',
panelTitle1 : 'Stili per blocchi',
panelTitle2 : 'Stili in linea',
panelTitle3 : 'Stili per oggetti'
},
format :
{
label : 'Formato',
panelTitle : 'Formato',
tag_p : 'Normale',
tag_pre : 'Formattato',
tag_address : 'Indirizzo',
tag_h1 : 'Titolo 1',
tag_h2 : 'Titolo 2',
tag_h3 : 'Titolo 3',
tag_h4 : 'Titolo 4',
tag_h5 : 'Titolo 5',
tag_h6 : 'Titolo 6',
tag_div : 'Paragrafo (DIV)'
},
div :
{
title : 'Crea DIV contenitore',
toolbar : 'Crea DIV contenitore',
cssClassInputLabel : 'Classi di stile',
styleSelectLabel : 'Stile',
IdInputLabel : 'Id',
languageCodeInputLabel : 'Codice lingua',
inlineStyleInputLabel : 'Stile Inline',
advisoryTitleInputLabel : 'Titolo Avviso',
langDirLabel : 'Direzione di scrittura',
langDirLTRLabel : 'Da sinistra a destra (LTR)',
langDirRTLLabel : 'Da destra a sinistra (RTL)',
edit : 'Modifica DIV',
remove : 'Rimuovi DIV'
},
iframe :
{
title : 'Proprietà IFrame',
toolbar : 'IFrame',
noUrl : 'Inserire l\'URL del campo IFrame',
scrolling : 'Abilita scrollbar',
border : 'Mostra il bordo'
},
font :
{
label : 'Carattere',
voiceLabel : 'Carattere',
panelTitle : 'Carattere'
},
fontSize :
{
label : 'Dimensione',
voiceLabel : 'Dimensione Carattere',
panelTitle : 'Dimensione'
},
colorButton :
{
textColorTitle : 'Colore testo',
bgColorTitle : 'Colore sfondo',
panelTitle : 'Colori',
auto : 'Automatico',
more : 'Altri colori...'
},
colors :
{
'000' : 'Nero',
'800000' : 'Marrone Castagna',
'8B4513' : 'Marrone Cuoio',
'2F4F4F' : 'Grigio Fumo di Londra',
'008080' : 'Acquamarina',
'000080' : 'Blu Oceano',
'4B0082' : 'Indigo',
'696969' : 'Grigio Scuro',
'B22222' : 'Giallo Fiamma',
'A52A2A' : 'Marrone',
'DAA520' : 'Giallo Mimosa',
'006400' : 'Verde Scuro',
'40E0D0' : 'Turchese',
'0000CD' : 'Blue Scuro',
'800080' : 'Viola',
'808080' : 'Grigio',
'F00' : 'Rosso',
'FF8C00' : 'Arancio Scuro',
'FFD700' : 'Oro',
'008000' : 'Verde',
'0FF' : 'Ciano',
'00F' : 'Blu',
'EE82EE' : 'Violetto',
'A9A9A9' : 'Grigio Scuro',
'FFA07A' : 'Salmone',
'FFA500' : 'Arancio',
'FFFF00' : 'Giallo',
'00FF00' : 'Lime',
'AFEEEE' : 'Turchese Chiaro',
'ADD8E6' : 'Blu Chiaro',
'DDA0DD' : 'Rosso Ciliegia',
'D3D3D3' : 'Grigio Chiaro',
'FFF0F5' : 'Lavanda Chiara',
'FAEBD7' : 'Bianco Antico',
'FFFFE0' : 'Giallo Chiaro',
'F0FFF0' : 'Verde Mela',
'F0FFFF' : 'Azzurro',
'F0F8FF' : 'Celeste',
'E6E6FA' : 'Lavanda',
'FFF' : 'Bianco'
},
scayt :
{
title : 'Controllo Ortografico Mentre Scrivi',
opera_title : 'Non supportato da Opera',
enable : 'Abilita COMS',
disable : 'Disabilita COMS',
about : 'About COMS',
toggle : 'Inverti abilitazione SCOMS',
options : 'Opzioni',
langs : 'Lingue',
moreSuggestions : 'Altri suggerimenti',
ignore : 'Ignora',
ignoreAll : 'Ignora tutti',
addWord : 'Aggiungi Parola',
emptyDic : 'Il nome del dizionario non può essere vuoto.',
optionsTab : 'Opzioni',
allCaps : 'Ignora Parole in maiuscolo',
ignoreDomainNames : 'Ignora nomi di dominio',
mixedCase : 'Ignora parole con maiuscole e minuscole',
mixedWithDigits : 'Ignora parole con numeri',
languagesTab : 'Lingue',
dictionariesTab : 'Dizionari',
dic_field_name : 'Nome del dizionario',
dic_create : 'Crea',
dic_restore : 'Ripristina',
dic_delete : 'Cancella',
dic_rename : 'Rinomina',
dic_info : 'Inizialmente il dizionario utente è memorizzato in un Cookie. I Cookie però hanno una dimensioni massima limitata. Quando il dizionario utente creasce a tal punto da non poter più essere memorizzato in un Cookie, allora il dizionario può essere memorizzato sul nostro server. Per memorizzare il proprio dizionario personale sul nostro server, è necessario specificare un nome per il proprio dizionario. Se avete già memorizzato un dizionario, inserite il nome che gli avete dato e premete il pulsante Ripristina.',
aboutTab : 'Info'
},
about :
{
title : 'Riguardo CKEditor',
dlgTitle : 'Riguardo CKEditor',
help : 'Vedi $1 per l\'aiuto.',
userGuide : 'Guida Utente CKEditor',
moreInfo : 'Per le informazioni sulla licenza si prega di visitare il nostro sito:',
copy : 'Copyright © $1. Tutti i diritti riservati.'
},
maximize : 'Massimizza',
minimize : 'Minimizza',
fakeobjects :
{
anchor : 'Ancora',
flash : 'Animazione Flash',
iframe : 'IFrame',
hiddenfield : 'Campo Nascosto',
unknown : 'Oggetto sconosciuto'
},
resize : 'Trascina per ridimensionare',
colordialog :
{
title : 'Selezionare il colore',
options : 'Opzioni colore',
highlight : 'Evidenzia',
selected : 'Seleziona il colore',
clear : 'cancella'
},
toolbarCollapse : 'Minimizza Toolbar',
toolbarExpand : 'Espandi Toolbar',
toolbarGroups :
{
document : 'Documento',
clipboard : 'Copia negli appunti/Indietro',
editing : 'Modifica',
forms : 'Form',
basicstyles : 'Stili di base',
paragraph : 'Paragrafo',
links : 'Link',
insert : 'Inserisci',
styles : 'Stili',
colors : 'Colori',
tools : 'Strumenti'
},
bidi :
{
ltr : 'Direzione del testo da sinistra verso destra',
rtl : 'Direzione del testo da destra verso sinistra'
},
docprops :
{
label : 'Proprietà del Documento',
title : 'Proprietà del Documento',
design : 'Disegna',
meta : 'Meta Data',
chooseColor : 'Scegli',
other : '<altro>',
docTitle : 'Titolo pagina',
charset : 'Set di caretteri',
charsetOther : 'Altro set di caretteri',
charsetASCII : 'ASCII',
charsetCE : 'Europa Centrale',
charsetCT : 'Cinese Tradizionale (Big5)',
charsetCR : 'Cirillico',
charsetGR : 'Greco',
charsetJP : 'Giapponese',
charsetKR : 'Coreano',
charsetTR : 'Turco',
charsetUN : 'Unicode (UTF-8)',
charsetWE : 'Europa Occidentale',
docType : 'Intestazione DocType',
docTypeOther : 'Altra intestazione DocType',
xhtmlDec : 'Includi dichiarazione XHTML',
bgColor : 'Colore di sfondo',
bgImage : 'Immagine di sfondo',
bgFixed : 'Sfondo fissato',
txtColor : 'Colore testo',
margin : 'Margini',
marginTop : 'In Alto',
marginLeft : 'A Sinistra',
marginRight : 'A Destra',
marginBottom : 'In Basso',
metaKeywords : 'Chiavi di indicizzazione documento (separate da virgola)',
metaDescription : 'Descrizione documento',
metaAuthor : 'Autore',
metaCopyright : 'Copyright',
previewHtml : '<p>Questo è un <strong>testo di esempio</strong>. State usando <a href="javascript:void(0)">CKEditor</a>.</p>'
}
};
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.lang} object, for the
* German language.
*/
/**#@+
@type String
@example
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKEDITOR.lang['de'] =
{
/**
* The language reading direction. Possible values are "rtl" for
* Right-To-Left languages (like Arabic) and "ltr" for Left-To-Right
* languages (like English).
* @default 'ltr'
*/
dir : 'ltr',
/*
* Screenreader titles. Please note that screenreaders are not always capable
* of reading non-English words. So be careful while translating it.
*/
editorTitle : 'WYSIWYG-Editor, %1, drücken Sie ALT 0 für Hilfe.',
// ARIA descriptions.
toolbars : 'Editor Symbolleisten',
editor : 'WYSIWYG-Editor',
// Toolbar buttons without dialogs.
source : 'Quellcode',
newPage : 'Neue Seite',
save : 'Speichern',
preview : 'Vorschau',
cut : 'Ausschneiden',
copy : 'Kopieren',
paste : 'Einfügen',
print : 'Drucken',
underline : 'Unterstrichen',
bold : 'Fett',
italic : 'Kursiv',
selectAll : 'Alles auswählen',
removeFormat : 'Formatierungen entfernen',
strike : 'Durchgestrichen',
subscript : 'Tiefgestellt',
superscript : 'Hochgestellt',
horizontalrule : 'Horizontale Linie einfügen',
pagebreak : 'Seitenumbruch einfügen',
pagebreakAlt : 'Seitenumbruch einfügen',
unlink : 'Link entfernen',
undo : 'Rückgängig',
redo : 'Wiederherstellen',
// Common messages and labels.
common :
{
browseServer : 'Server durchsuchen',
url : 'URL',
protocol : 'Protokoll',
upload : 'Hochladen',
uploadSubmit : 'Zum Server senden',
image : 'Bild',
flash : 'Flash',
form : 'Formular',
checkbox : 'Checkbox',
radio : 'Radiobutton',
textField : 'Textfeld einzeilig',
textarea : 'Textfeld mehrzeilig',
hiddenField : 'Verstecktes Feld',
button : 'Klickbutton',
select : 'Auswahlfeld',
imageButton : 'Bildbutton',
notSet : '<nichts>',
id : 'ID',
name : 'Name',
langDir : 'Schreibrichtung',
langDirLtr : 'Links nach Rechts (LTR)',
langDirRtl : 'Rechts nach Links (RTL)',
langCode : 'Sprachenkürzel',
longDescr : 'Langform URL',
cssClass : 'Stylesheet Klasse',
advisoryTitle : 'Titel Beschreibung',
cssStyle : 'Style',
ok : 'OK',
cancel : 'Abbrechen',
close : 'Schließen',
preview : 'Vorschau',
generalTab : 'Allgemein',
advancedTab : 'Erweitert',
validateNumberFailed : 'Dieser Wert ist keine Nummer.',
confirmNewPage : 'Alle nicht gespeicherten Änderungen gehen verlohren. Sind Sie sicher die neue Seite zu laden?',
confirmCancel : 'Einige Optionen wurden geändert. Wollen Sie den Dialog dennoch schließen?',
options : 'Optionen',
target : 'Zielseite',
targetNew : 'Neues Fenster (_blank)',
targetTop : 'Oberstes Fenster (_top)',
targetSelf : 'Gleiches Fenster (_self)',
targetParent : 'Oberes Fenster (_parent)',
langDirLTR : 'Links nach Rechts (LNR)',
langDirRTL : 'Rechts nach Links (RNL)',
styles : 'Style',
cssClasses : 'Stylesheet Klasse',
width : 'Breite',
height : 'Höhe',
align : 'Ausrichtung',
alignLeft : 'Links',
alignRight : 'Rechts',
alignCenter : 'Zentriert',
alignTop : 'Oben',
alignMiddle : 'Mitte',
alignBottom : 'Unten',
invalidHeight : 'Höhe muss eine Zahl sein.',
invalidWidth : 'Breite muss eine Zahl sein.',
invalidCssLength : 'Wert spezifiziert für "%1" Feld muss ein positiver numerischer Wert sein mit oder ohne korrekte CSS Messeinheit (px, %, in, cm, mm, em, ex, pt oder pc).',
invalidHtmlLength : 'Wert spezifiziert für "%1" Feld muss ein positiver numerischer Wert sein mit oder ohne korrekte HTML Messeinheit (px oder %).',
invalidInlineStyle : 'Wert spezifiziert für inline Stilart muss enthalten ein oder mehr Tupels mit dem Format "Name : Wert" getrennt mit Semikolons.',
cssLengthTooltip : 'Gebe eine Zahl ein für ein Wert in pixels oder eine Zahl mit einer korrekten CSS Messeinheit (px, %, in, cm, mm, em, ex, pt oder pc).',
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, nicht verfügbar</span>'
},
contextmenu :
{
options : 'Kontextmenü Optionen'
},
// Special char dialog.
specialChar :
{
toolbar : 'Sonderzeichen einfügen/editieren',
title : 'Sonderzeichen auswählen',
options : 'Sonderzeichen Optionen'
},
// Link dialog.
link :
{
toolbar : 'Link einfügen/editieren',
other : '<andere>',
menu : 'Link editieren',
title : 'Link',
info : 'Link-Info',
target : 'Zielseite',
upload : 'Hochladen',
advanced : 'Erweitert',
type : 'Link-Typ',
toUrl : 'URL',
toAnchor : 'Anker in dieser Seite',
toEmail : 'E-Mail',
targetFrame : '<Frame>',
targetPopup : '<Pop-up Fenster>',
targetFrameName : 'Ziel-Fenster-Name',
targetPopupName : 'Pop-up Fenster-Name',
popupFeatures : 'Pop-up Fenster-Eigenschaften',
popupResizable : 'Größe änderbar',
popupStatusBar : 'Statusleiste',
popupLocationBar: 'Adress-Leiste',
popupToolbar : 'Symbolleiste',
popupMenuBar : 'Menü-Leiste',
popupFullScreen : 'Vollbild (IE)',
popupScrollBars : 'Rollbalken',
popupDependent : 'Abhängig (Netscape)',
popupLeft : 'Linke Position',
popupTop : 'Obere Position',
id : 'Id',
langDir : 'Schreibrichtung',
langDirLTR : 'Links nach Rechts (LTR)',
langDirRTL : 'Rechts nach Links (RTL)',
acccessKey : 'Zugriffstaste',
name : 'Name',
langCode : 'Sprachenkürzel',
tabIndex : 'Tab-Index',
advisoryTitle : 'Titel Beschreibung',
advisoryContentType : 'Inhaltstyp',
cssClasses : 'Stylesheet Klasse',
charset : 'Ziel-Zeichensatz',
styles : 'Style',
rel : 'Beziehung',
selectAnchor : 'Anker auswählen',
anchorName : 'nach Anker Name',
anchorId : 'nach Element Id',
emailAddress : 'E-Mail Addresse',
emailSubject : 'Betreffzeile',
emailBody : 'Nachrichtentext',
noAnchors : '(keine Anker im Dokument vorhanden)',
noUrl : 'Bitte geben Sie die Link-URL an',
noEmail : 'Bitte geben Sie e-Mail Adresse an'
},
// Anchor dialog
anchor :
{
toolbar : 'Anker einfügen/editieren',
menu : 'Anker-Eigenschaften',
title : 'Anker-Eigenschaften',
name : 'Anker Name',
errorName : 'Bitte geben Sie den Namen des Ankers ein',
remove : 'Anker entfernen'
},
// List style dialog
list:
{
numberedTitle : 'Nummerierte Listen-Eigenschaften',
bulletedTitle : 'Listen-Eigenschaften',
type : 'Typ',
start : 'Start',
validateStartNumber :'List Startnummer muss eine ganze Zahl sein.',
circle : 'Ring',
disc : 'Kreis',
square : 'Quadrat',
none : 'Keine',
notset : '<nicht gesetzt>',
armenian : 'Armenisch Nummerierung',
georgian : 'Georgisch Nummerierung (an, ban, gan, etc.)',
lowerRoman : 'Klein römisch (i, ii, iii, iv, v, etc.)',
upperRoman : 'Groß römisch (I, II, III, IV, V, etc.)',
lowerAlpha : 'Klein alpha (a, b, c, d, e, etc.)',
upperAlpha : 'Groß alpha (A, B, C, D, E, etc.)',
lowerGreek : 'Klein griechisch (alpha, beta, gamma, etc.)',
decimal : 'Dezimal (1, 2, 3, etc.)',
decimalLeadingZero : 'Dezimal mit führende Null (01, 02, 03, etc.)'
},
// Find And Replace Dialog
findAndReplace :
{
title : 'Suchen und Ersetzen',
find : 'Suchen',
replace : 'Ersetzen',
findWhat : 'Suche nach:',
replaceWith : 'Ersetze mit:',
notFoundMsg : 'Der gesuchte Text wurde nicht gefunden.',
findOptions : 'Suchoptionen',
matchCase : 'Groß-Kleinschreibung beachten',
matchWord : 'Nur ganze Worte suchen',
matchCyclic : 'Zyklische Suche',
replaceAll : 'Alle ersetzen',
replaceSuccessMsg : '%1 vorkommen ersetzt.'
},
// Table Dialog
table :
{
toolbar : 'Tabelle',
title : 'Tabellen-Eigenschaften',
menu : 'Tabellen-Eigenschaften',
deleteTable : 'Tabelle löschen',
rows : 'Zeile',
columns : 'Spalte',
border : 'Rahmen',
widthPx : 'Pixel',
widthPc : '%',
widthUnit : 'Breite Einheit',
cellSpace : 'Zellenabstand außen',
cellPad : 'Zellenabstand innen',
caption : 'Überschrift',
summary : 'Inhaltsübersicht',
headers : 'Kopfzeile',
headersNone : 'Keine',
headersColumn : 'Erste Spalte',
headersRow : 'Erste Zeile',
headersBoth : 'Beide',
invalidRows : 'Die Anzahl der Zeilen muß größer als 0 sein.',
invalidCols : 'Die Anzahl der Spalten muß größer als 0 sein..',
invalidBorder : 'Die Rahmenbreite muß eine Zahl sein.',
invalidWidth : 'Die Tabellenbreite muss eine Zahl sein.',
invalidHeight : 'Die Tabellenbreite muß eine Zahl sein.',
invalidCellSpacing : 'Der Zellenabstand außen muß eine positive Zahl sein.',
invalidCellPadding : 'Der Zellenabstand innen muß eine positive Zahl sein.',
cell :
{
menu : 'Zelle',
insertBefore : 'Zelle davor einfügen',
insertAfter : 'Zelle danach einfügen',
deleteCell : 'Zelle löschen',
merge : 'Zellen verbinden',
mergeRight : 'Nach rechts verbinden',
mergeDown : 'Nach unten verbinden',
splitHorizontal : 'Zelle horizontal teilen',
splitVertical : 'Zelle vertikal teilen',
title : 'Zellen-Eigenschaften',
cellType : 'Zellart',
rowSpan : 'Anzahl Zeilen verbinden',
colSpan : 'Anzahl Spalten verbinden',
wordWrap : 'Zeilenumbruch',
hAlign : 'Horizontale Ausrichtung',
vAlign : 'Vertikale Ausrichtung',
alignBaseline : 'Grundlinie',
bgColor : 'Hintergrundfarbe',
borderColor : 'Rahmenfarbe',
data : 'Daten',
header : 'Überschrift',
yes : 'Ja',
no : 'Nein',
invalidWidth : 'Zellenbreite muß eine Zahl sein.',
invalidHeight : 'Zellenhöhe muß eine Zahl sein.',
invalidRowSpan : '"Anzahl Zeilen verbinden" muss eine Ganzzahl sein.',
invalidColSpan : '"Anzahl Spalten verbinden" muss eine Ganzzahl sein.',
chooseColor : 'Wählen'
},
row :
{
menu : 'Zeile',
insertBefore : 'Zeile oberhalb einfügen',
insertAfter : 'Zeile unterhalb einfügen',
deleteRow : 'Zeile entfernen'
},
column :
{
menu : 'Spalte',
insertBefore : 'Spalte links davor einfügen',
insertAfter : 'Spalte rechts danach einfügen',
deleteColumn : 'Spalte löschen'
}
},
// Button Dialog.
button :
{
title : 'Button-Eigenschaften',
text : 'Text (Wert)',
type : 'Typ',
typeBtn : 'Button',
typeSbm : 'Absenden',
typeRst : 'Zurücksetzen'
},
// Checkbox and Radio Button Dialogs.
checkboxAndRadio :
{
checkboxTitle : 'Checkbox-Eigenschaften',
radioTitle : 'Optionsfeld-Eigenschaften',
value : 'Wert',
selected : 'ausgewählt'
},
// Form Dialog.
form :
{
title : 'Formular-Eigenschaften',
menu : 'Formular-Eigenschaften',
action : 'Action',
method : 'Method',
encoding : 'Zeichenkodierung'
},
// Select Field Dialog.
select :
{
title : 'Auswahlfeld-Eigenschaften',
selectInfo : 'Info',
opAvail : 'Mögliche Optionen',
value : 'Wert',
size : 'Größe',
lines : 'Linien',
chkMulti : 'Erlaube Mehrfachauswahl',
opText : 'Text',
opValue : 'Wert',
btnAdd : 'Hinzufügen',
btnModify : 'Ändern',
btnUp : 'Hoch',
btnDown : 'Runter',
btnSetValue : 'Setze als Standardwert',
btnDelete : 'Entfernen'
},
// Textarea Dialog.
textarea :
{
title : 'Textfeld (mehrzeilig) Eigenschaften',
cols : 'Spalten',
rows : 'Reihen'
},
// Text Field Dialog.
textfield :
{
title : 'Textfeld (einzeilig) Eigenschaften',
name : 'Name',
value : 'Wert',
charWidth : 'Zeichenbreite',
maxChars : 'Max. Zeichen',
type : 'Typ',
typeText : 'Text',
typePass : 'Passwort'
},
// Hidden Field Dialog.
hidden :
{
title : 'Verstecktes Feld-Eigenschaften',
name : 'Name',
value : 'Wert'
},
// Image Dialog.
image :
{
title : 'Bild-Eigenschaften',
titleButton : 'Bildbutton-Eigenschaften',
menu : 'Bild-Eigenschaften',
infoTab : 'Bild-Info',
btnUpload : 'Zum Server senden',
upload : 'Hochladen',
alt : 'Alternativer Text',
lockRatio : 'Größenverhältnis beibehalten',
resetSize : 'Größe zurücksetzen',
border : 'Rahmen',
hSpace : 'Horizontal-Abstand',
vSpace : 'Vertikal-Abstand',
alertUrl : 'Bitte geben Sie die Bild-URL an',
linkTab : 'Link',
button2Img : 'Möchten Sie den gewählten Bild-Button in ein einfaches Bild umwandeln?',
img2Button : 'Möchten Sie das gewählten Bild in einen Bild-Button umwandeln?',
urlMissing : 'Imagequelle URL fehlt.',
validateBorder : 'Rahmen muß eine ganze Zahl sein.',
validateHSpace : 'Horizontal-Abstand muß eine ganze Zahl sein.',
validateVSpace : 'Vertikal-Abstand muß eine ganze Zahl sein.'
},
// Flash Dialog
flash :
{
properties : 'Flash-Eigenschaften',
propertiesTab : 'Eigenschaften',
title : 'Flash-Eigenschaften',
chkPlay : 'Automatisch Abspielen',
chkLoop : 'Endlosschleife',
chkMenu : 'Flash-Menü aktivieren',
chkFull : 'Vollbildmodus erlauben',
scale : 'Skalierung',
scaleAll : 'Alles anzeigen',
scaleNoBorder : 'Ohne Rand',
scaleFit : 'Passgenau',
access : 'Skript Zugang',
accessAlways : 'Immer',
accessSameDomain: 'Gleiche Domain',
accessNever : 'Nie',
alignAbsBottom : 'Abs Unten',
alignAbsMiddle : 'Abs Mitte',
alignBaseline : 'Baseline',
alignTextTop : 'Text Oben',
quality : 'Qualität',
qualityBest : 'Beste',
qualityHigh : 'Hoch',
qualityAutoHigh : 'Auto Hoch',
qualityMedium : 'Medium',
qualityAutoLow : 'Auto Niedrig',
qualityLow : 'Niedrig',
windowModeWindow: 'Fenster',
windowModeOpaque: 'Deckend',
windowModeTransparent : 'Transparent',
windowMode : 'Fenster Modus',
flashvars : 'Variablen für Flash',
bgcolor : 'Hintergrundfarbe',
hSpace : 'Horizontal-Abstand',
vSpace : 'Vertikal-Abstand',
validateSrc : 'Bitte geben Sie die Link-URL an',
validateHSpace : 'HSpace muss eine Zahl sein.',
validateVSpace : 'VSpace muss eine Zahl sein.'
},
// Speller Pages Dialog
spellCheck :
{
toolbar : 'Rechtschreibprüfung',
title : 'Rechtschreibprüfung',
notAvailable : 'Entschuldigung, aber dieser Dienst steht im Moment nicht zur Verfügung.',
errorLoading : 'Fehler beim laden des Dienstanbieters: %s.',
notInDic : 'Nicht im Wörterbuch',
changeTo : 'Ändern in',
btnIgnore : 'Ignorieren',
btnIgnoreAll : 'Alle Ignorieren',
btnReplace : 'Ersetzen',
btnReplaceAll : 'Alle Ersetzen',
btnUndo : 'Rückgängig',
noSuggestions : ' - keine Vorschläge - ',
progress : 'Rechtschreibprüfung läuft...',
noMispell : 'Rechtschreibprüfung abgeschlossen - keine Fehler gefunden',
noChanges : 'Rechtschreibprüfung abgeschlossen - keine Worte geändert',
oneChange : 'Rechtschreibprüfung abgeschlossen - ein Wort geändert',
manyChanges : 'Rechtschreibprüfung abgeschlossen - %1 Wörter geändert',
ieSpellDownload : 'Rechtschreibprüfung nicht installiert. Möchten Sie sie jetzt herunterladen?'
},
smiley :
{
toolbar : 'Smiley',
title : 'Smiley auswählen',
options : 'Smiley Optionen'
},
elementsPath :
{
eleLabel : 'Elements Pfad',
eleTitle : '%1 Element'
},
numberedlist : 'Nummerierte Liste',
bulletedlist : 'Liste',
indent : 'Einzug erhöhen',
outdent : 'Einzug verringern',
justify :
{
left : 'Linksbündig',
center : 'Zentriert',
right : 'Rechtsbündig',
block : 'Blocksatz'
},
blockquote : 'Zitatblock',
clipboard :
{
title : 'Einfügen',
cutError : 'Die Sicherheitseinstellungen Ihres Browsers lassen es nicht zu, den Text automatisch auszuschneiden. Bitte benutzen Sie die System-Zwischenablage über STRG-X (ausschneiden) und STRG-V (einfügen).',
copyError : 'Die Sicherheitseinstellungen Ihres Browsers lassen es nicht zu, den Text automatisch kopieren. Bitte benutzen Sie die System-Zwischenablage über STRG-C (kopieren).',
pasteMsg : 'Bitte fügen Sie den Text in der folgenden Box über die Tastatur (mit <STRONG>Strg+V</STRONG>) ein und bestätigen Sie mit <STRONG>OK</STRONG>.',
securityMsg : 'Aufgrund von Sicherheitsbeschränkungen Ihres Browsers kann der Editor nicht direkt auf die Zwischenablage zugreifen. Bitte fügen Sie den Inhalt erneut in diesem Fenster ein.',
pasteArea : 'Einfügebereich'
},
pastefromword :
{
confirmCleanup : 'Der Text, den Sie einfügen möchten, scheint aus MS-Word kopiert zu sein. Möchten Sie ihn zuvor bereinigen lassen?',
toolbar : 'Aus MS-Word einfügen',
title : 'Aus MS-Word einfügen',
error : 'Aufgrund eines internen Fehlers war es nicht möglich die eingefügten Daten zu bereinigen'
},
pasteText :
{
button : 'Als Text einfügen',
title : 'Als Text einfügen'
},
templates :
{
button : 'Vorlagen',
title : 'Vorlagen',
options : 'Vorlagen Optionen',
insertOption : 'Aktuellen Inhalt ersetzen',
selectPromptMsg : 'Klicken Sie auf eine Vorlage, um sie im Editor zu öffnen (der aktuelle Inhalt wird dabei gelöscht!):',
emptyListMsg : '(keine Vorlagen definiert)'
},
showBlocks : 'Blöcke anzeigen',
stylesCombo :
{
label : 'Stil',
panelTitle : 'Formatierungenstil',
panelTitle1 : 'Block Stilart',
panelTitle2 : 'Inline Stilart',
panelTitle3 : 'Objekt Stilart'
},
format :
{
label : 'Format',
panelTitle : 'Format',
tag_p : 'Normal',
tag_pre : 'Formatiert',
tag_address : 'Addresse',
tag_h1 : 'Überschrift 1',
tag_h2 : 'Überschrift 2',
tag_h3 : 'Überschrift 3',
tag_h4 : 'Überschrift 4',
tag_h5 : 'Überschrift 5',
tag_h6 : 'Überschrift 6',
tag_div : 'Normal (DIV)'
},
div :
{
title : 'Div Container erzeugen',
toolbar : 'Div Container erzeugen',
cssClassInputLabel : 'Stylesheet Klasse',
styleSelectLabel : 'Style',
IdInputLabel : 'Id',
languageCodeInputLabel : 'Sprachenkürzel',
inlineStyleInputLabel : 'Inline Stil',
advisoryTitleInputLabel : 'Tooltip',
langDirLabel : 'Sprache Richtung',
langDirLTRLabel : 'Links nach Rechs (LTR)',
langDirRTLLabel : 'Rechs nach Links (RTL)',
edit : 'Div bearbeiten',
remove : 'Div entfernen'
},
iframe :
{
title : 'IFrame-Eigenschaften',
toolbar : 'IFrame',
noUrl : 'Bitte geben Sie die IFrame-URL an',
scrolling : 'Rollbalken anzeigen',
border : 'Rahmen anzeigen'
},
font :
{
label : 'Schriftart',
voiceLabel : 'Schriftart',
panelTitle : 'Schriftart'
},
fontSize :
{
label : 'Größe',
voiceLabel : 'Schrifgröße',
panelTitle : 'Größe'
},
colorButton :
{
textColorTitle : 'Textfarbe',
bgColorTitle : 'Hintergrundfarbe',
panelTitle : 'Farben',
auto : 'Automatisch',
more : 'Weitere Farben...'
},
colors :
{
'000' : 'Schwarz',
'800000' : 'Kastanienbraun',
'8B4513' : 'Braun',
'2F4F4F' : 'Dunkles Schiefergrau',
'008080' : 'Blaugrün',
'000080' : 'Navy',
'4B0082' : 'Indigo',
'696969' : 'Dunkelgrau',
'B22222' : 'Ziegelrot',
'A52A2A' : 'Braun',
'DAA520' : 'Goldgelb',
'006400' : 'Dunkelgrün',
'40E0D0' : 'Türkis',
'0000CD' : 'Medium Blau',
'800080' : 'Lila',
'808080' : 'Grau',
'F00' : 'Rot',
'FF8C00' : 'Dunkelorange',
'FFD700' : 'Gold',
'008000' : 'Grün',
'0FF' : 'Cyan',
'00F' : 'Blau',
'EE82EE' : 'Hellviolett',
'A9A9A9' : 'Dunkelgrau',
'FFA07A' : 'Helles Lachsrosa',
'FFA500' : 'Orange',
'FFFF00' : 'Gelb',
'00FF00' : 'Lime',
'AFEEEE' : 'Blaß-Türkis',
'ADD8E6' : 'Hellblau',
'DDA0DD' : 'Pflaumenblau',
'D3D3D3' : 'Hellgrau',
'FFF0F5' : 'Lavendel',
'FAEBD7' : 'Antik Weiß',
'FFFFE0' : 'Hellgelb',
'F0FFF0' : 'Honigtau',
'F0FFFF' : 'Azurblau',
'F0F8FF' : 'Alice Blau',
'E6E6FA' : 'Lavendel',
'FFF' : 'Weiß'
},
scayt :
{
title : 'Rechtschreibprüfung während der Texteingabe (SCAYT)',
opera_title : 'Nicht von Opera unterstützt',
enable : 'SCAYT einschalten',
disable : 'SCAYT ausschalten',
about : 'Über SCAYT',
toggle : 'SCAYT umschalten',
options : 'Optionen',
langs : 'Sprachen',
moreSuggestions : 'Mehr Vorschläge',
ignore : 'Ignorieren',
ignoreAll : 'Alle ignorieren',
addWord : 'Wort hinzufügen',
emptyDic : 'Wörterbuchname sollte leer sein.',
optionsTab : 'Optionen',
allCaps : 'Groß geschriebenen Wörter ignorieren',
ignoreDomainNames : 'Domain-Namen ignorieren',
mixedCase : 'Wörter mit gemischte Setzkasten ignorieren',
mixedWithDigits : 'Wörter mit Zahlen ignorieren',
languagesTab : 'Sprachen',
dictionariesTab : 'Wörterbücher',
dic_field_name : 'Wörterbuchname',
dic_create : 'Erzeugen',
dic_restore : 'Wiederherstellen',
dic_delete : 'Löschen',
dic_rename : 'Umbenennen',
dic_info : 'Anfangs wird das Benutzerwörterbuch in einem Cookie gespeichert. Allerdings sind Cookies in der Größe begrenzt. Wenn das Benutzerwörterbuch bis zu einem Punkt wächst, wo es nicht mehr in einem Cookie gespeichert werden kann, wird das Benutzerwörterbuch auf dem Server gespeichert. Um Ihr persönliches Wörterbuch auf dem Server zu speichern, müssen Sie einen Namen für das Wörterbuch angeben. Falls Sie schon ein gespeicherte Wörterbuch haben, geben Sie bitte dessen Namen ein und klicken Sie auf die Schaltfläche Wiederherstellen.',
aboutTab : 'Über'
},
about :
{
title : 'Über CKEditor',
dlgTitle : 'Über CKEditor',
help : 'Prüfe $1 für Hilfe.',
userGuide : 'CKEditor Benutzerhandbuch',
moreInfo : 'Für Informationen über unsere Lizenzbestimmungen besuchen sie bitte unsere Webseite:',
copy : 'Copyright © $1. Alle Rechte vorbehalten.'
},
maximize : 'Maximieren',
minimize : 'Minimieren',
fakeobjects :
{
anchor : 'Anker',
flash : 'Flash Animation',
iframe : 'IFrame',
hiddenfield : 'Verstecktes Feld',
unknown : 'Unbekanntes Objekt'
},
resize : 'Zum Vergrößern ziehen',
colordialog :
{
title : 'Farbe wählen',
options : 'Farbeoptionen',
highlight : 'Hervorheben',
selected : 'Ausgewählte Farbe',
clear : 'Entfernen'
},
toolbarCollapse : 'Symbolleiste einklappen',
toolbarExpand : 'Symbolleiste ausklappen',
toolbarGroups :
{
document : 'Dokument',
clipboard : 'Zwischenablage/Rückgängig',
editing : 'Editieren',
forms : 'Formularen',
basicstyles : 'Grundstile',
paragraph : 'Absatz',
links : 'Links',
insert : 'Einfügen',
styles : 'Stile',
colors : 'Farben',
tools : 'Werkzeuge'
},
bidi :
{
ltr : 'Leserichtung von Links nach Rechts',
rtl : 'Leserichtung von Rechts nach Links'
},
docprops :
{
label : 'Dokument-Eigenschaften',
title : 'Dokument-Eigenschaften',
design : 'Design',
meta : 'Metadaten',
chooseColor : 'Wählen',
other : '<andere>',
docTitle : 'Seitentitel',
charset : 'Zeichenkodierung',
charsetOther : 'Andere Zeichenkodierung',
charsetASCII : 'ASCII',
charsetCE : 'Zentraleuropäisch',
charsetCT : 'traditionell Chinesisch (Big5)',
charsetCR : 'Kyrillisch',
charsetGR : 'Griechisch',
charsetJP : 'Japanisch',
charsetKR : 'Koreanisch',
charsetTR : 'Türkisch',
charsetUN : 'Unicode (UTF-8)',
charsetWE : 'Westeuropäisch',
docType : 'Dokumententyp',
docTypeOther : 'Anderer Dokumententyp',
xhtmlDec : 'Beziehe XHTML Deklarationen ein',
bgColor : 'Hintergrundfarbe',
bgImage : 'Hintergrundbild URL',
bgFixed : 'feststehender Hintergrund',
txtColor : 'Textfarbe',
margin : 'Seitenränder',
marginTop : 'Oben',
marginLeft : 'Links',
marginRight : 'Rechts',
marginBottom : 'Unten',
metaKeywords : 'Schlüsselwörter (durch Komma getrennt)',
metaDescription : 'Dokument-Beschreibung',
metaAuthor : 'Autor',
metaCopyright : 'Copyright',
previewHtml : '<p>Das ist ein <strong>Beispieltext</strong>. Du schreibst in <a href="javascript:void(0)">CKEditor</a>.</p>'
}
};
| JavaScript |
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.lang} object for the
* Polish language.
*/
/**#@+
@type String
@example
*/
/**
* Contains the dictionary of language entries.
* @namespace
*/
CKEDITOR.lang['pl'] =
{
/**
* The language reading direction. Possible values are "rtl" for
* Right-To-Left languages (like Arabic) and "ltr" for Left-To-Right
* languages (like English).
* @default 'ltr'
*/
dir : 'ltr',
/*
* Screenreader titles. Please note that screenreaders are not always capable
* of reading non-English words. So be careful while translating it.
*/
editorTitle : 'Edytor tekstu sformatowanego, %1, w celu uzyskania pomocy naciśnij ALT 0.',
// ARIA descriptions.
toolbars : 'Paski narzędzi edytora',
editor : 'Edytor tekstu sformatowanego',
// Toolbar buttons without dialogs.
source : 'Źródło dokumentu',
newPage : 'Nowa strona',
save : 'Zapisz',
preview : 'Podgląd',
cut : 'Wytnij',
copy : 'Kopiuj',
paste : 'Wklej',
print : 'Drukuj',
underline : 'Podkreślenie',
bold : 'Pogrubienie',
italic : 'Kursywa',
selectAll : 'Zaznacz wszystko',
removeFormat : 'Usuń formatowanie',
strike : 'Przekreślenie',
subscript : 'Indeks dolny',
superscript : 'Indeks górny',
horizontalrule : 'Wstaw poziomą linię',
pagebreak : 'Wstaw pdodział strony',
pagebreakAlt : 'Wstaw podział strony',
unlink : 'Usuń odnośnik',
undo : 'Cofnij',
redo : 'Ponów',
// Common messages and labels.
common :
{
browseServer : 'Przeglądaj',
url : 'Adres URL',
protocol : 'Protokół',
upload : 'Wyślij',
uploadSubmit : 'Wyślij',
image : 'Obrazek',
flash : 'Flash',
form : 'Formularz',
checkbox : 'Pole wyboru (checkbox)',
radio : 'Przycisk opcji (radio)',
textField : 'Pole tekstowe',
textarea : 'Obszar tekstowy',
hiddenField : 'Pole ukryte',
button : 'Przycisk',
select : 'Lista wyboru',
imageButton : 'Przycisk graficzny',
notSet : '<nie ustawiono>',
id : 'Id',
name : 'Nazwa',
langDir : 'Kierunek tekstu',
langDirLtr : 'Od lewej do prawej (LTR)',
langDirRtl : 'Od prawej do lewej (RTL)',
langCode : 'Kod języka',
longDescr : 'Adres URL długiego opisu',
cssClass : 'Nazwa klasy CSS',
advisoryTitle : 'Opis obiektu docelowego',
cssStyle : 'Styl',
ok : 'OK',
cancel : 'Anuluj',
close : 'Zamknij',
preview : 'Podgląd',
generalTab : 'Ogólne',
advancedTab : 'Zaawansowane',
validateNumberFailed : 'Ta wartość nie jest liczbą.',
confirmNewPage : 'Wszystkie niezapisane zmiany zostaną utracone. Czy na pewno wczytać nową stronę?',
confirmCancel : 'Pewne opcje zostały zmienione. Czy na pewno zamknąć okno dialogowe?',
options : 'Opcje',
target : 'Obiekt docelowy',
targetNew : 'Nowe okno (_blank)',
targetTop : 'Okno najwyżej w hierarchii (_top)',
targetSelf : 'To samo okno (_self)',
targetParent : 'Okno nadrzędne (_parent)',
langDirLTR : 'Od lewej do prawej (LTR)',
langDirRTL : 'Od prawej do lewej (RTL)',
styles : 'Style',
cssClasses : 'Klasy arkusza stylów',
width : 'Szerokość',
height : 'Wysokość',
align : 'Wyrównaj',
alignLeft : 'Do lewej',
alignRight : 'Do prawej',
alignCenter : 'Do środka',
alignTop : 'Do góry',
alignMiddle : 'Do środka',
alignBottom : 'Do dołu',
invalidHeight : 'Wysokość musi być liczbą.',
invalidWidth : 'Szerokość musi być liczbą.',
invalidCssLength : 'Wartość podana dla pola "%1" musi być liczbą dodatnią bez jednostki lub z poprawną jednostką długości zgodną z CSS (px, %, in, cm, mm, em, ex, pt lub pc).',
invalidHtmlLength : 'Wartość podana dla pola "%1" musi być liczbą dodatnią bez jednostki lub z poprawną jednostką długości zgodną z HTML (px lub %).',
invalidInlineStyle : 'Wartość podana dla stylu musi składać się z jednej lub większej liczby krotek w formacie "nazwa : wartość", rozdzielonych średnikami.',
cssLengthTooltip : 'Wpisz liczbę dla wartości w pikselach lub liczbę wraz z jednostką długości zgodną z CSS (px, %, in, cm, mm, em, ex, pt lub pc).',
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, niedostępne</span>'
},
contextmenu :
{
options : 'Opcje menu kontekstowego'
},
// Special char dialog.
specialChar :
{
toolbar : 'Wstaw znak specjalny',
title : 'Wybierz znak specjalny',
options : 'Opcje znaków specjalnych'
},
// Link dialog.
link :
{
toolbar : 'Wstaw/edytuj odnośnik',
other : '<inny>',
menu : 'Edytuj odnośnik',
title : 'Odnośnik',
info : 'Informacje ',
target : 'Obiekt docelowy',
upload : 'Wyślij',
advanced : 'Zaawansowane',
type : 'Typ odnośnika',
toUrl : 'Adres URL',
toAnchor : 'Odnośnik wewnątrz strony (kotwica)',
toEmail : 'Adres e-mail',
targetFrame : '<ramka>',
targetPopup : '<wyskakujące okno>',
targetFrameName : 'Nazwa ramki docelowej',
targetPopupName : 'Nazwa wyskakującego okna',
popupFeatures : 'Właściwości wyskakującego okna',
popupResizable : 'Skalowalny',
popupStatusBar : 'Pasek statusu',
popupLocationBar: 'Pasek adresu',
popupToolbar : 'Pasek narzędzi',
popupMenuBar : 'Pasek menu',
popupFullScreen : 'Pełny ekran (IE)',
popupScrollBars : 'Paski przewijania',
popupDependent : 'Okno zależne (Netscape)',
popupLeft : 'Pozycja w poziomie',
popupTop : 'Pozycja w pionie',
id : 'Id',
langDir : 'Kierunek tekstu',
langDirLTR : 'Od lewej do prawej (LTR)',
langDirRTL : 'Od prawej do lewej (RTL)',
acccessKey : 'Klawisz dostępu',
name : 'Nazwa',
langCode : 'Kod języka',
tabIndex : 'Indeks kolejności',
advisoryTitle : 'Opis obiektu docelowego',
advisoryContentType : 'Typ MIME obiektu docelowego',
cssClasses : 'Nazwa klasy CSS',
charset : 'Kodowanie znaków obiektu docelowego',
styles : 'Styl',
rel : 'Relacja',
selectAnchor : 'Wybierz kotwicę',
anchorName : 'Wg nazwy',
anchorId : 'Wg identyfikatora',
emailAddress : 'Adres e-mail',
emailSubject : 'Temat',
emailBody : 'Treść',
noAnchors : '(W dokumencie nie zdefiniowano żadnych kotwic)',
noUrl : 'Podaj adres URL',
noEmail : 'Podaj adres e-mail'
},
// Anchor dialog
anchor :
{
toolbar : 'Wstaw/edytuj kotwicę',
menu : 'Właściwości kotwicy',
title : 'Właściwości kotwicy',
name : 'Nazwa kotwicy',
errorName : 'Wpisz nazwę kotwicy',
remove : 'Usuń kotwicę'
},
// List style dialog
list:
{
numberedTitle : 'Właściwości list numerowanych',
bulletedTitle : 'Właściwości list wypunktowanych',
type : 'Typ punktora',
start : 'Początek',
validateStartNumber :'Listę musi rozpoczynać liczba całkowita.',
circle : 'Koło',
disc : 'Okrąg',
square : 'Kwadrat',
none : 'Brak',
notset : '<nie ustawiono>',
armenian : 'Numerowanie armeńskie',
georgian : 'Numerowanie gruzińskie (an, ban, gan itd.)',
lowerRoman : 'Małe cyfry rzymskie (i, ii, iii, iv, v itd.)',
upperRoman : 'Duże cyfry rzymskie (I, II, III, IV, V itd.)',
lowerAlpha : 'Małe litery (a, b, c, d, e itd.)',
upperAlpha : 'Duże litery (A, B, C, D, E itd.)',
lowerGreek : 'Małe litery greckie (alpha, beta, gamma itd.)',
decimal : 'Liczby (1, 2, 3 itd.)',
decimalLeadingZero : 'Liczby z początkowym zerem (01, 02, 03 itd.)'
},
// Find And Replace Dialog
findAndReplace :
{
title : 'Znajdź i zamień',
find : 'Znajdź',
replace : 'Zamień',
findWhat : 'Znajdź:',
replaceWith : 'Zastąp przez:',
notFoundMsg : 'Nie znaleziono szukanego hasła.',
findOptions : 'Opcje wyszukiwania',
matchCase : 'Uwzględnij wielkość liter',
matchWord : 'Całe słowa',
matchCyclic : 'Cykliczne dopasowanie',
replaceAll : 'Zamień wszystko',
replaceSuccessMsg : '%1 wystąpień zastąpionych.'
},
// Table Dialog
table :
{
toolbar : 'Tabela',
title : 'Właściwości tabeli',
menu : 'Właściwości tabeli',
deleteTable : 'Usuń tabelę',
rows : 'Liczba wierszy',
columns : 'Liczba kolumn',
border : 'Grubość obramowania',
widthPx : 'piksele',
widthPc : '%',
widthUnit : 'jednostka szerokości',
cellSpace : 'Odstęp pomiędzy komórkami',
cellPad : 'Dopełnienie komórek',
caption : 'Tytuł',
summary : 'Podsumowanie',
headers : 'Nagłówki',
headersNone : 'Brak',
headersColumn : 'Pierwsza kolumna',
headersRow : 'Pierwszy wiersz',
headersBoth : 'Oba',
invalidRows : 'Liczba wierszy musi być większa niż 0.',
invalidCols : 'Liczba kolumn musi być większa niż 0.',
invalidBorder : 'Wartość obramowania musi być liczbą.',
invalidWidth : 'Szerokość tabeli musi być liczbą.',
invalidHeight : 'Wysokość tabeli musi być liczbą.',
invalidCellSpacing : 'Odstęp pomiędzy komórkami musi być liczbą dodatnią.',
invalidCellPadding : 'Dopełnienie komórek musi być liczbą dodatnią.',
cell :
{
menu : 'Komórka',
insertBefore : 'Wstaw komórkę z lewej',
insertAfter : 'Wstaw komórkę z prawej',
deleteCell : 'Usuń komórki',
merge : 'Połącz komórki',
mergeRight : 'Połącz z komórką z prawej',
mergeDown : 'Połącz z komórką poniżej',
splitHorizontal : 'Podziel komórkę poziomo',
splitVertical : 'Podziel komórkę pionowo',
title : 'Właściwości komórki',
cellType : 'Typ komórki',
rowSpan : 'Scalenie wierszy',
colSpan : 'Scalenie komórek',
wordWrap : 'Zawijanie słów',
hAlign : 'Wyrównanie poziome',
vAlign : 'Wyrównanie pionowe',
alignBaseline : 'Linia bazowa',
bgColor : 'Kolor tła',
borderColor : 'Kolor obramowania',
data : 'Dane',
header : 'Nagłowek',
yes : 'Tak',
no : 'Nie',
invalidWidth : 'Szerokość komórki musi być liczbą.',
invalidHeight : 'Wysokość komórki musi być liczbą.',
invalidRowSpan : 'Scalenie wierszy musi być liczbą całkowitą.',
invalidColSpan : 'Scalenie komórek musi być liczbą całkowitą.',
chooseColor : 'Wybierz'
},
row :
{
menu : 'Wiersz',
insertBefore : 'Wstaw wiersz powyżej',
insertAfter : 'Wstaw wiersz poniżej',
deleteRow : 'Usuń wiersze'
},
column :
{
menu : 'Kolumna',
insertBefore : 'Wstaw kolumnę z lewej',
insertAfter : 'Wstaw kolumnę z prawej',
deleteColumn : 'Usuń kolumny'
}
},
// Button Dialog.
button :
{
title : 'Właściwości przycisku',
text : 'Tekst (Wartość)',
type : 'Typ',
typeBtn : 'Przycisk',
typeSbm : 'Wyślij',
typeRst : 'Wyczyść'
},
// Checkbox and Radio Button Dialogs.
checkboxAndRadio :
{
checkboxTitle : 'Właściwości pola wyboru (checkbox)',
radioTitle : 'Właściwości przycisku opcji (radio)',
value : 'Wartość',
selected : 'Zaznaczone'
},
// Form Dialog.
form :
{
title : 'Właściwości formularza',
menu : 'Właściwości formularza',
action : 'Akcja',
method : 'Metoda',
encoding : 'Kodowanie'
},
// Select Field Dialog.
select :
{
title : 'Właściwości listy wyboru',
selectInfo : 'Informacje',
opAvail : 'Dostępne opcje',
value : 'Wartość',
size : 'Rozmiar',
lines : 'wierszy',
chkMulti : 'Wielokrotny wybór',
opText : 'Tekst',
opValue : 'Wartość',
btnAdd : 'Dodaj',
btnModify : 'Zmień',
btnUp : 'Do góry',
btnDown : 'Do dołu',
btnSetValue : 'Ustaw jako zaznaczoną',
btnDelete : 'Usuń'
},
// Textarea Dialog.
textarea :
{
title : 'Właściwości obszaru tekstowego',
cols : 'Liczba kolumn',
rows : 'Liczba wierszy'
},
// Text Field Dialog.
textfield :
{
title : 'Właściwości pola tekstowego',
name : 'Nazwa',
value : 'Wartość',
charWidth : 'Szerokość w znakach',
maxChars : 'Szerokość maksymalna',
type : 'Typ',
typeText : 'Tekst',
typePass : 'Hasło'
},
// Hidden Field Dialog.
hidden :
{
title : 'Właściwości pola ukrytego',
name : 'Nazwa',
value : 'Wartość'
},
// Image Dialog.
image :
{
title : 'Właściwości obrazka',
titleButton : 'Właściwości przycisku graficznego',
menu : 'Właściwości obrazka',
infoTab : 'Informacje o obrazku',
btnUpload : 'Wyślij',
upload : 'Wyślij',
alt : 'Tekst zastępczy',
lockRatio : 'Zablokuj proporcje',
resetSize : 'Przywróć rozmiar',
border : 'Obramowanie',
hSpace : 'Odstęp poziomy',
vSpace : 'Odstęp pionowy',
alertUrl : 'Podaj adres obrazka.',
linkTab : 'Hiperłącze',
button2Img : 'Czy chcesz przekonwertować zaznaczony przycisk graficzny do zwykłego obrazka?',
img2Button : 'Czy chcesz przekonwertować zaznaczony obrazek do przycisku graficznego?',
urlMissing : 'Podaj adres URL obrazka.',
validateBorder : 'Wartość obramowania musi być liczbą całkowitą.',
validateHSpace : 'Wartość odstępu poziomego musi być liczbą całkowitą.',
validateVSpace : 'Wartość odstępu pionowego musi być liczbą całkowitą.'
},
// Flash Dialog
flash :
{
properties : 'Właściwości obiektu Flash',
propertiesTab : 'Właściwości',
title : 'Właściwości obiektu Flash',
chkPlay : 'Autoodtwarzanie',
chkLoop : 'Pętla',
chkMenu : 'Włącz menu',
chkFull : 'Zezwól na pełny ekran',
scale : 'Skaluj',
scaleAll : 'Pokaż wszystko',
scaleNoBorder : 'Bez obramowania',
scaleFit : 'Dokładne dopasowanie',
access : 'Dostęp skryptów',
accessAlways : 'Zawsze',
accessSameDomain: 'Ta sama domena',
accessNever : 'Nigdy',
alignAbsBottom : 'Do dołu',
alignAbsMiddle : 'Do środka w pionie',
alignBaseline : 'Do linii bazowej',
alignTextTop : 'Do góry tekstu',
quality : 'Jakość',
qualityBest : 'Najlepsza',
qualityHigh : 'Wysoka',
qualityAutoHigh : 'Auto wysoka',
qualityMedium : 'Średnia',
qualityAutoLow : 'Auto niska',
qualityLow : 'Niska',
windowModeWindow: 'Okno',
windowModeOpaque: 'Nieprzezroczyste',
windowModeTransparent : 'Przezroczyste',
windowMode : 'Tryb okna',
flashvars : 'Zmienne obiektu Flash',
bgcolor : 'Kolor tła',
hSpace : 'Odstęp poziomy',
vSpace : 'Odstęp pionowy',
validateSrc : 'Podaj adres URL',
validateHSpace : 'Odstęp poziomy musi być liczbą.',
validateVSpace : 'Odstęp pionowy musi być liczbą.'
},
// Speller Pages Dialog
spellCheck :
{
toolbar : 'Sprawdź pisownię',
title : 'Sprawdź pisownię',
notAvailable : 'Przepraszamy, ale usługa jest obecnie niedostępna.',
errorLoading : 'Błąd wczytywania hosta aplikacji usługi: %s.',
notInDic : 'Słowa nie ma w słowniku',
changeTo : 'Zmień na',
btnIgnore : 'Ignoruj',
btnIgnoreAll : 'Ignoruj wszystkie',
btnReplace : 'Zmień',
btnReplaceAll : 'Zmień wszystkie',
btnUndo : 'Cofnij',
noSuggestions : '- Brak sugestii -',
progress : 'Trwa sprawdzanie...',
noMispell : 'Sprawdzanie zakończone: nie znaleziono błędów',
noChanges : 'Sprawdzanie zakończone: nie zmieniono żadnego słowa',
oneChange : 'Sprawdzanie zakończone: zmieniono jedno słowo',
manyChanges : 'Sprawdzanie zakończone: zmieniono %l słów',
ieSpellDownload : 'Słownik nie jest zainstalowany. Czy chcesz go pobrać?'
},
smiley :
{
toolbar : 'Emotikony',
title : 'Wstaw emotikona',
options : 'Opcje emotikonów'
},
elementsPath :
{
eleLabel : 'Ścieżka elementów',
eleTitle : 'element %1'
},
numberedlist : 'Lista numerowana',
bulletedlist : 'Lista wypunktowana',
indent : 'Zwiększ wcięcie',
outdent : 'Zmniejsz wcięcie',
justify :
{
left : 'Wyrównaj do lewej',
center : 'Wyśrodkuj',
right : 'Wyrównaj do prawej',
block : 'Wyjustuj'
},
blockquote : 'Cytat',
clipboard :
{
title : 'Wklej',
cutError : 'Ustawienia bezpieczeństwa Twojej przeglądarki nie pozwalają na automatyczne wycinanie tekstu. Użyj skrótu klawiszowego Ctrl/Cmd+X.',
copyError : 'Ustawienia bezpieczeństwa Twojej przeglądarki nie pozwalają na automatyczne kopiowanie tekstu. Użyj skrótu klawiszowego Ctrl/Cmd+C.',
pasteMsg : 'Wklej tekst w poniższym polu, używając skrótu klawiaturowego (<STRONG>Ctrl/Cmd+V</STRONG>), i kliknij <STRONG>OK</STRONG>.',
securityMsg : 'Zabezpieczenia przeglądarki uniemożliwiają wklejenie danych bezpośrednio do edytora. Proszę ponownie wkleić dane w tym oknie.',
pasteArea : 'Obszar wklejania'
},
pastefromword :
{
confirmCleanup : 'Tekst, który chcesz wkleić, prawdopodobnie pochodzi z programu Microsoft Word. Czy chcesz go wyczyścić przed wklejeniem?',
toolbar : 'Wklej z programu MS Word',
title : 'Wklej z programu MS Word',
error : 'Wyczyszczenie wklejonych danych nie było możliwe z powodu wystąpienia błędu.'
},
pasteText :
{
button : 'Wklej jako czysty tekst',
title : 'Wklej jako czysty tekst'
},
templates :
{
button : 'Szablony',
title : 'Szablony zawartości',
options : 'Opcje szablonów',
insertOption : 'Zastąp obecną zawartość',
selectPromptMsg : 'Wybierz szablon do otwarcia w edytorze<br>(obecna zawartość okna edytora zostanie utracona):',
emptyListMsg : '(Brak zdefiniowanych szablonów)'
},
showBlocks : 'Pokaż bloki',
stylesCombo :
{
label : 'Styl',
panelTitle : 'Style formatujące',
panelTitle1 : 'Style blokowe',
panelTitle2 : 'Style liniowe',
panelTitle3 : 'Style obiektowe'
},
format :
{
label : 'Format',
panelTitle : 'Format',
tag_p : 'Normalny',
tag_pre : 'Tekst sformatowany',
tag_address : 'Adres',
tag_h1 : 'Nagłówek 1',
tag_h2 : 'Nagłówek 2',
tag_h3 : 'Nagłówek 3',
tag_h4 : 'Nagłówek 4',
tag_h5 : 'Nagłówek 5',
tag_h6 : 'Nagłówek 6',
tag_div : 'Normalny (DIV)'
},
div :
{
title : 'Utwórz pojemnik Div',
toolbar : 'Utwórz pojemnik Div',
cssClassInputLabel : 'Klasy arkusza stylów',
styleSelectLabel : 'Styl',
IdInputLabel : 'Id',
languageCodeInputLabel : 'Kod języka',
inlineStyleInputLabel : 'Style liniowe',
advisoryTitleInputLabel : 'Opis obiektu docelowego',
langDirLabel : 'Kierunek tekstu',
langDirLTRLabel : 'Od lewej do prawej (LTR)',
langDirRTLLabel : 'Od prawej do lewej (RTL)',
edit : 'Edytuj pojemnik Div',
remove : 'Usuń pojemnik Div'
},
iframe :
{
title : 'Właściwości elementu IFrame',
toolbar : 'IFrame',
noUrl : 'Podaj adres URL elementu IFrame',
scrolling : 'Włącz paski przewijania',
border : 'Pokaż obramowanie obiektu IFrame'
},
font :
{
label : 'Czcionka',
voiceLabel : 'Czcionka',
panelTitle : 'Czcionka'
},
fontSize :
{
label : 'Rozmiar',
voiceLabel : 'Rozmiar czcionki',
panelTitle : 'Rozmiar'
},
colorButton :
{
textColorTitle : 'Kolor tekstu',
bgColorTitle : 'Kolor tła',
panelTitle : 'Kolory',
auto : 'Automatycznie',
more : 'Więcej kolorów...'
},
colors :
{
'000' : 'Czarny',
'800000' : 'Kasztanowy',
'8B4513' : 'Czekoladowy',
'2F4F4F' : 'Ciemnografitowy',
'008080' : 'Morski',
'000080' : 'Granatowy',
'4B0082' : 'Indygo',
'696969' : 'Ciemnoszary',
'B22222' : 'Czerwień żelazowa',
'A52A2A' : 'Brązowy',
'DAA520' : 'Ciemnozłoty',
'006400' : 'Ciemnozielony',
'40E0D0' : 'Turkusowy',
'0000CD' : 'Ciemnoniebieski',
'800080' : 'Purpurowy',
'808080' : 'Szary',
'F00' : 'Czerwony',
'FF8C00' : 'Ciemnopomarańczowy',
'FFD700' : 'Złoty',
'008000' : 'Zielony',
'0FF' : 'Cyjan',
'00F' : 'Niebieski',
'EE82EE' : 'Fioletowy',
'A9A9A9' : 'Przygaszony szary',
'FFA07A' : 'Łososiowy',
'FFA500' : 'Pomarańczowy',
'FFFF00' : 'Żółty',
'00FF00' : 'Limonkowy',
'AFEEEE' : 'Bladoturkusowy',
'ADD8E6' : 'Jasnoniebieski',
'DDA0DD' : 'Śliwkowy',
'D3D3D3' : 'Jasnoszary',
'FFF0F5' : 'Jasnolawendowy',
'FAEBD7' : 'Kremowobiały',
'FFFFE0' : 'Jasnożółty',
'F0FFF0' : 'Bladozielony',
'F0FFFF' : 'Jasnolazurowy',
'F0F8FF' : 'Jasnobłękitny',
'E6E6FA' : 'Lawendowy',
'FFF' : 'Biały'
},
scayt :
{
title : 'Sprawdź pisownię podczas pisania (SCAYT)',
opera_title : 'Funkcja nie jest obsługiwana przez przeglądarkę Opera',
enable : 'Włącz SCAYT',
disable : 'Wyłącz SCAYT',
about : 'Informacje o SCAYT',
toggle : 'Przełącz SCAYT',
options : 'Opcje',
langs : 'Języki',
moreSuggestions : 'Więcej sugestii',
ignore : 'Ignoruj',
ignoreAll : 'Ignoruj wszystkie',
addWord : 'Dodaj słowo',
emptyDic : 'Nazwa słownika nie może być pusta.',
optionsTab : 'Opcje',
allCaps : 'Ignoruj wyrazy pisane dużymi literami',
ignoreDomainNames : 'Ignoruj nazwy domen',
mixedCase : 'Ignoruj wyrazy pisane dużymi i małymi literami',
mixedWithDigits : 'Ignoruj wyrazy zawierające cyfry',
languagesTab : 'Języki',
dictionariesTab : 'Słowniki',
dic_field_name : 'Nazwa słownika',
dic_create : 'Utwórz',
dic_restore : 'Przywróć',
dic_delete : 'Usuń',
dic_rename : 'Zmień nazwę',
dic_info : 'Początkowo słownik użytkownika przechowywany jest w cookie. Pliki cookie mają jednak ograniczoną pojemność. Jeśli słownik użytkownika przekroczy wielkość dopuszczalną dla pliku cookie, możliwe jest przechowanie go na naszym serwerze. W celu zapisania słownika na serwerze niezbędne jest nadanie mu nazwy. Jeśli słownik został już zapisany na serwerze, wystarczy podać jego nazwę i nacisnąć przycisk Przywróć.',
aboutTab : 'Informacje o SCAYT'
},
about :
{
title : 'Informacje o programie CKEditor',
dlgTitle : 'Informacje o programie CKEditor',
help : 'Pomoc znajdziesz w $1.',
userGuide : 'podręczniku użytkownika programu CKEditor',
moreInfo : 'Informacje na temat licencji można znaleźć na naszej stronie:',
copy : 'Copyright © $1. Wszelkie prawa zastrzeżone.'
},
maximize : 'Maksymalizuj',
minimize : 'Minimalizuj',
fakeobjects :
{
anchor : 'Kotwica',
flash : 'Animacja Flash',
iframe : 'IFrame',
hiddenfield : 'Pole ukryte',
unknown : 'Nieznany obiekt'
},
resize : 'Przeciągnij, aby zmienić rozmiar',
colordialog :
{
title : 'Wybierz kolor',
options : 'Opcje koloru',
highlight : 'Zaznacz',
selected : 'Wybrany',
clear : 'Wyczyść'
},
toolbarCollapse : 'Zwiń pasek narzędzi',
toolbarExpand : 'Rozwiń pasek narzędzi',
toolbarGroups :
{
document : 'Dokument',
clipboard : 'Schowek/Wstecz',
editing : 'Edycja',
forms : 'Formularze',
basicstyles : 'Style podstawowe',
paragraph : 'Akapit',
links : 'Hiperłącza',
insert : 'Wstawianie',
styles : 'Style',
colors : 'Kolory',
tools : 'Narzędzia'
},
bidi :
{
ltr : 'Kierunek tekstu od lewej strony do prawej',
rtl : 'Kierunek tekstu od prawej strony do lewej'
},
docprops :
{
label : 'Właściwości dokumentu',
title : 'Właściwości dokumentu',
design : 'Projekt strony',
meta : 'Znaczniki meta',
chooseColor : 'Wybierz',
other : 'Inne',
docTitle : 'Tytuł strony',
charset : 'Kodowanie znaków',
charsetOther : 'Inne kodowanie znaków',
charsetASCII : 'ASCII',
charsetCE : 'Środkowoeuropejskie',
charsetCT : 'Chińskie tradycyjne (Big5)',
charsetCR : 'Cyrylica',
charsetGR : 'Greckie',
charsetJP : 'Japońskie',
charsetKR : 'Koreańskie',
charsetTR : 'Tureckie',
charsetUN : 'Unicode (UTF-8)',
charsetWE : 'Zachodnioeuropejskie',
docType : 'Definicja typu dokumentu',
docTypeOther : 'Inna definicja typu dokumentu',
xhtmlDec : 'Uwzględnij deklaracje XHTML',
bgColor : 'Kolor tła',
bgImage : 'Adres URL obrazka tła',
bgFixed : 'Tło nieruchome (nieprzewijające się)',
txtColor : 'Kolor tekstu',
margin : 'Marginesy strony',
marginTop : 'Górny',
marginLeft : 'Lewy',
marginRight : 'Prawy',
marginBottom : 'Dolny',
metaKeywords : 'Słowa kluczowe dokumentu (oddzielone przecinkami)',
metaDescription : 'Opis dokumentu',
metaAuthor : 'Autor',
metaCopyright : 'Prawa autorskie',
previewHtml : '<p>To jest <strong>przykładowy tekst</strong>. Korzystasz z programu <a href="javascript:void(0)">CKEditor</a>.</p>'
}
};
| JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.