B2G/gecko/browser/devtools/styleeditor/StyleEditor.jsm
/**
   * Get a user-friendly name for the style sheet.
   *
   * @return string
   */
Get a user-friendly name for the style sheet.
@return string
Get a user - friendly name for the style sheet . @return string
function SE_getFriendlyName()
  {
    if (this.savedFile) { 
      return this.savedFile.leafName;
    }
    if (this.hasFlag(StyleEditorFlags.NEW)) {
      let index = this.styleSheetIndex + 1; 
      return _("newStyleSheet", index);
    }
    if (this.hasFlag(StyleEditorFlags.INLINE)) {
      let index = this.styleSheetIndex + 1; 
      return _("inlineStyleSheet", index);
    }
    if (!this._friendlyName) {
      let sheetURI = this.styleSheet.href;
      let contentURI = this.contentDocument.baseURIObject;
      let contentURIScheme = contentURI.scheme;
      let contentURILeafIndex = contentURI.specIgnoringRef.lastIndexOf("/");
      contentURI = contentURI.specIgnoringRef;
      if (contentURILeafIndex > contentURIScheme.length) {
        contentURI = contentURI.substring(0, contentURILeafIndex + 1);
      }
      this._friendlyName = (sheetURI.indexOf(contentURI) == 0)
                           ? sheetURI.substring(contentURI.length)
                           : sheetURI;
    }
    return this._friendlyName;
  }
function SE_getFriendlyName ( ) { if ( this . savedFile ) { return this . savedFile . leafName ; } if ( this . hasFlag ( StyleEditorFlags . NEW ) ) { let index = this . styleSheetIndex + 1 ; return _ ( "newStyleSheet" , index ) ; } if ( this . hasFlag ( StyleEditorFlags . INLINE ) ) { let index = this . styleSheetIndex + 1 ; return _ ( "inlineStyleSheet" , index ) ; } if ( ! this . _friendlyName ) { let sheetURI = this . styleSheet . href ; let contentURI = this . contentDocument . baseURIObject ; let contentURIScheme = contentURI . scheme ; let contentURILeafIndex = contentURI . specIgnoringRef . lastIndexOf ( "/" ) ; contentURI = contentURI . specIgnoringRef ; if ( contentURILeafIndex > contentURIScheme . length ) { contentURI = contentURI . substring ( 0 , contentURILeafIndex + 1 ) ; } this . _friendlyName = ( sheetURI . indexOf ( contentURI ) == 0 ) ? sheetURI . substring ( contentURI . length ) : sheetURI ; } return this . _friendlyName ; }
Get a user-friendly name for the style sheet.
Get a user - friendly name for the style sheet .
// reuse the saved filename if any // 0-indexing only works for devs // 0-indexing only works for devs // get content base URI without leaf name (if any) // avoid verbose repetition of absolute URI when the style sheet URI // is relative to the content URI